1. Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Is there anyway better to do this?

Discussion in 'Skript' started by AndreasLK, Mar 13, 2020.

Thread Status:
Not open for further replies.
  1. AndreasLK

    AndreasLK Member

    Joined:
    Mar 12, 2020
    Messages:
    16
    Likes Received:
    0
    Here's all my code. It's for a custom sign shop.
    Code (Text):
    1. on rightclick on sign:
    2.     if {sign.%player%} is "true":
    3.         if {%2nd line of event-block%} is not set:
    4.             set {%2nd line of event-block%} to 2nd line of event-block
    5.             set {%2nd line of event-block%} to 2nd line of event-block
    6.             add "%{%2nd line of event-block%}%" to {shop.signs::*}
    7.             set {%2nd line of event-block%.location} to location of event-block
    8.             set {%2nd line of event-block%.high} to 3rd line of event-block parsed as number
    9.             set {%2nd line of event-block%.low} to 4th line of event-block parsed as number
    10.             set {%2nd line of event-block%.amount} to 1st line of event-block
    11.             set {%2nd line of event-block%.price} to random number between {%2nd line of event-block%.low} and {%2nd line of event-block%.high}
    12.             wait 1 tick
    13.             set 1st line of event-block to "Admin Shop"
    14.             set 4th line of event-block to "%{%2nd line of event-block%}%"
    15.             if player's tool is green wool:
    16.                 set 3rd line of event-block to "B %{%2nd line of event-block%.price}%"
    17.                 set {%2nd line of event-block%.bs} to "buy"
    18.             if player's tool is red wool:
    19.                 set 3rd line of event-block to "S %{%2nd line of event-block%.price}%"
    20.                 set {%2nd line of event-block%.bs} to "sell"
    21.  
    22.             set 2nd line of event-block to "%{%2nd line of event-block%.amount}%"
    23.             clear {%2nd line of event-block%}
    24.         if {%2nd line of event-block%} is set:
    25.             if {%2nd line of event-block%.1} is not set:
    26.                 set {%2nd line of event-block%.1} to 2nd line of event-block
    27.                 set {%2nd line of event-block%.1} to 2nd line of event-block
    28.                 add "%{%2nd line of event-block%.1}%" to {shop.signs::*}
    29.                 set {%2nd line of event-block%.location.1} to location of event-block
    30.                 set {%2nd line of event-block%.high.1} to 3rd line of event-block parsed as number
    31.                 set {%2nd line of event-block%.low.1} to 4th line of event-block parsed as number
    32.                 set {%2nd line of event-block%.amount.1} to 1st line of event-block
    33.                 set {%2nd line of event-block%.price.1} to random number between {%2nd line of event-block%.low.1} and {%2nd line of event-block%.high.1}
    34.                 wait 1 tick
    35.                 set 1st line of event-block to "Admin Shop"
    36.                 set 4th line of event-block to "%{%2nd line of event-block%.1}%"
    37.                 if player's tool is green wool:
    38.                     set 3rd line of event-block to "B %{%2nd line of event-block%.price.1}%"
    39.                     set {%2nd line of event-block%.bs.1} to "buy"
    40.                 if player's tool is red wool:
    41.                     set 3rd line of event-block to "S %{%2nd line of event-block%.price.1}%"
    42.                     set {%2nd line of event-block%.bs.1} to "sell"
    43.  
    44.                 if {%2nd line of event-block%.1} is set:
    45.                     if {%2nd line of event-block%.2} is not set:
    46.                         set {%2nd line of event-block%.2} to 2nd line of event-block
    47.                         set {%2nd line of event-block%.2} to 2nd line of event-block
    48.                         add "%{%2nd line of event-block%.2}%" to {shop.signs::*}
    49.                         set {%2nd line of event-block%.location.2} to location of event-block
    50.                         set {%2nd line of event-block%.high.2} to 3rd line of event-block parsed as number
    51.                         set {%2nd line of event-block%.low.2} to 4th line of event-block parsed as number
    52.                         set {%2nd line of event-block%.amount.2} to 1st line of event-block
    53.                         set {%2nd line of event-block%.price.2} to random number between {%2nd line of event-block%.low.2} and {%2nd line of event-block%.high.2}
    54.                         wait 1 tick
    55.                         set 1st line of event-block to "Admin Shop"
    56.                         set 4th line of event-block to "%{%2nd line of event-block%.2}%"
    57.                         if player's tool is green wool:
    58.                             set 3rd line of event-block to "B %{%2nd line of event-block%.price.2}%"
    59.                             set {%2nd line of event-block%.bs.2} to "buy"
    60.                         if player's tool is red wool:
    61.                             set 3rd line of event-block to "S %{%2nd line of event-block%.price.2}%"
    62.                             set {%2nd line of event-block%.bs.2} to "sell"
    63.  
    Is there any way i can search for an existing variable and then make the number +1 of what it is? you can se the slow way I've done it for now
     
Thread Status:
Not open for further replies.

Share This Page

Loading...