Solved Reaction events

  • 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!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

DrunkSheep73

Member
May 29, 2023
24
2
3
22
Hello!
I have a skript made for reaction events:

Code:
options:
    winner: &e&l%player% &r&aanswered first with &e&l
    end: &r&a!
    noans: &cNo one knows the answer: &6&l
    keytype: tripwire hook
    keyname: "&a&lCommon &r&7Key"
    keylore: "<##ff0000>Use &l/warp crates &r<##ff0000>to open!"
    axo: "<##00ff00>How much diferent types of axolotls are there?"
    keyextra: tripwire hook named "&a&lCommon &r&7Key" with lore "<##ff0000>Use &l/warp crates &r<##ff0000>to open!"
    creeper: "<##0000ff>By which entity did the creeper come into being?"
    top: "<##ff0000>How much blocks are there between build limit and the lowest place?"
    ame: "<##00ff00>Under which layer you can find amethyst?"

every 8 seconds:
    broadcast {@axo}
    set {_broadcastaxo} to 5
    wait 30 seconds
    if {_broadcastaxo} is true:
        broadcast "{@noans}5{@end}"
        set {_broadcastaxo} to false
        wait 90 seconds
    else:
        wait 90 seconds
        broadcast {@creeper}
        set {_broadcastcreeper} to true
        wait 30 seconds
        if {_broadcastcreeper} is true:
            broadcast "{@noans}pig{@end}"
            set {_broadcastcreeper} to false
            wait 90 seconds
        else:
            wait 90 seconds
            broadcast {@top}
            set {_broadcasttop} to true
            wait 30 seconds
            if {_broadcasttop} is true:
                broadcast "{@noans}385{@end}"
                set {_broadcasttop} to false
                wait 90 seconds
            else:
                wait 90 seconds
                broadcast {@ame}
                set {_broadcastame} to true
                wait 30 seconds
                if {_broadcastame} is true:
                    broadcast "{@noans}70{@end}"
                    set {_broadcastame} to false
                    wait 90 seconds
                else:
                    wait 90 seconds

on chat:
    if {_broadcastaxo} is 5:
        if message contains 5:
            give player {@keyextra}
            set {_broadcastaxo} to false
            broadcast "{@winner}5{@end}"
    if {_broadcastcreeper} is true:
        if message contains pig:
            give player {@keyextra}
            set {_broadcastcreeper} to false
            broadcast "{@winner}pig{@end}"
    if {_broadcasttop} is true:
        if message contains 385:
            give player {@keyextra}
            set {_broadcasttop} to false
            broadcast "{@winner}385{@end}"
    if {_broadcastame} is true:
        if message contains 70:
            give player {@keyextra}
            set {_broadcastame} to false
            broadcast "{@winner}70{@end}"
No errors.
The problem is:
I only get 2 broadcast from the first 2 broadcasts ({@axo} and {@creeper}).
And I don't get any rewards or a message for the winner.
I also want that if there was no answer it continious with the rest but that doesn't happens.

Thank you for help!
 
You using local variables , so you cant get value of {_broadcastaxo} from 'every 8 seconds' event inside 'on chat' event.
Read about difference of local and global variables, then fix your code
 
  • Like
Reactions: DrunkSheep73