#Anyone know how to shorten this code?

1 messages · Page 1 of 1 (latest)

jagged citrus
#

Im making a gui and it requires lots of code, i wanted to know if anyone could help shorten it, preferably the repeated events, thanks!

on inventory click:
    if name of event-inventory is "&5&lPowerups":
        if index of event-slot = 0:
            cancel event
on inventory click:
    if name of event-inventory is "&5&lPowerups":
        if index of event-slot = 1:
            cancel event
on inventory click:
    if name of event-inventory is "&5&lPowerups":
        if index of event-slot = 2:
            cancel event
on inventory click:
    if name of event-inventory is "&5&lPowerups":
        if index of event-slot = 3:
            cancel event
set {_gui} to a new chest inventory with 3 rows named "&c&lStrength"
        set slot 0 of {_gui} to 1 black stained glass pane named ""
on inventory click:
    if name of event-inventory is "&5&lPowerups":
        if index of event-slot = 4:
            cancel event
on inventory click:
    if name of event-inventory is "&5&lPowerups":
        if index of event-slot = 5:
            cancel event
on inventory click:
    if name of event-inventory is "&5&lPowerups":
        if index of event-slot = 6:
            cancel event
on inventory click:
    if name of event-inventory is "&5&lPowerups":
        if index of event-slot = 7:
            cancel event
on inventory click:
    if name of event-inventory is "&5&lPowerups":
        if index of event-slot = 8:
            cancel event
scenic reef
#

uhh yeah

#

for 1, dont have 20 different events

jagged citrus
#

alright, anything else u notice?

scenic reef
#

i mean, why cancel each slot individually?

#

you can cancel all the slots in the inventory by just running tha cancel event after checking the inventory's name

jagged citrus
#

oh smart, thanks