Solved Variable triggers

Discussion in 'Bukkit Help' started by jjacobson, Nov 2, 2012.

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

    jjacobson

    I posted this in the variable triggers forums too, but decided to try my luck here as well.

    Im trying to make a script that will execute a command if a player has been in a vt defined area for a certain amount of time.

    Example, someone enters a VT defined area and starts a count down and after 120 seconds it checks to see if anyones still in the area. If they someone is in the area still it executes a console command. If they are not in the area anymore it does nothing until someone anyone again then it does it all again.


    Thanks, I would do this myself but I can seem to understand VT at all.
     
  2. Offline

    midnightfang22

    So, basically, you want it so they enter area A, and after 2 minutes (120 seconds) it checks if they are still inside of the area. If they are in the area, run a console command. If not, do nothing?
     
    jjacobson likes this.
  3. Offline

    jjacobson

    Yes, exactly.
     
  4. Offline

    midnightfang22

    Code:
        - '@IF i $timeLeft.<playername> < <secondticks:0>'
        - '  @SETINT $timeLeft.<playername> <secondticks:120>'
        - '  @PAUSE 120'
        - '  @IF si <getarea:<playerloc>> = areanamehere'
        - '    @CMDCON commandhere'
        - '    @DELVAR i $timeLeft.<playername>'
        - '      ELSE'
        - '    @DELVAR i $timeLeft.<playername>'
        - '  @ENDIF'
        - '@ENDIF'
    Just put that in for the ENTER section of the area and put a @ before the ELSE. Its tagging some person... Basically, if they enter the area once, it sets a timer on them (just so they can't enter the area, leave it, enter it again to spam the script) for 120 seconds, then pauses the script (that is where the actual delay comes in for the script) for 120 seconds, then it checks if they are still within an area after 120 seconds with the <getarea:<playerloc>>. If they are in any area, it places the name of it there and tests if that area name is the same as the one you are checking for. If they are in the area you want, then it will run the script right below it. If the player is not in that area, then it goes to the ELSE and runs that part of the script. The DELVAR is just so it doesn't forever keep holding that number....That is more long-winded than I thought...
     
    jjacobson likes this.
  5. Offline

    jjacobson

    Thanks!

    So it should look like this?

    Code:
    world:
      61,132,140,87,144,166:
        Name: default
        Enter:
          CoolDown: 0
          Script:
        - '@IF i $timeLeft.<playername> < <secondticks:0>'
        - '  @SETINT $timeLeft.<playername> <secondticks:120>'
        - '  @PAUSE 120'
        - '  @IF si <getarea:<playerloc>> = areanamehere'
        - '    @CMDCON ma force start default'
        - '    @DELVAR i $timeLeft.<playername>'
        - '      @ELSE'
        - '    @DELVAR i $timeLeft.<playername>'
        - '  @ENDIF'
        - '@ENDIF'
        Exit:
          CoolDown: 0
          Script: []
    
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 29, 2016
  6. Offline

    midnightfang22

    Code:
    world:
      61,132,140,87,144,166:
        Name: default
        Enter:
          CoolDown: 0
          Script:
          - '@IF i $timeLeft.<playername> < <secondticks:0>'
          - '  @SETINT $timeLeft.<playername> <secondticks:120>'
          - '  @PAUSE 120'
          - '  @IF si <getarea:<playerloc>> = default'
          - '    @CMDCON ma force start default'
          - '    @DELVAR i $timeLeft.<playername>'
          - '  @ELSE'
          - '    @DELVAR i $timeLeft.<playername>'
          - '  @ENDIF'
          - '@ENDIF'
        Exit:
          CoolDown: 0
          Script: []
        
    That should work...just replaced "areanamehere" with "default" (guessing that is the area name you need?).
     
    jjacobson likes this.
  7. Offline

    jjacobson

    yep, thanks I'm testing it now ill get back to you.

    I changed it to this to test it easier, but nothing seems to be happening.

    Code:
    world:
      61,132,140,87,144,166:
        Name: default
        Enter:
          CoolDown: 0
          Script:
          - '@IF i $timeLeft.<playername> < <secondticks:0>'
          - '  @SETINT $timeLeft.<playername> <secondticks:20>'
          - '  @PAUSE 20'
          - '  @IF si <getarea:<playerloc>> = default'
          - '    @CMDCON say it works'
          - '    @DELVAR i $timeLeft.<playername>'
          - '  @ELSE'
          - '    @DELVAR i $timeLeft.<playername>'
          - '  @ENDIF'
          - '@ENDIF'
        Exit:
          CoolDown: 0
          Script: []
    
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 29, 2016
  8. Offline

    midnightfang22

    Code:
    world:
      61,132,140,87,144,166:
        Name: default
        Enter:
          CoolDown: 0
          Script:
          - '@IF b $MobArena.<playername>_lobby = false'
          - '  @SETBOOL $MobArena.<playername>_lobby true'
          - '  @PAUSE 120'
          - '  @IF b $MobArena.<playername>_lobby = true'
          - '    @CMDCON ma force start default!'
          - '    @DELVAR b $MobArena.<playername>_lobby'
          - '  @ELSE'
          - '    @DELVAR b $MobArena.<playername>_lobby'
          - '  @ENDIF'
          - '@ENDIF'
        Exit:
          CoolDown: 0
          Script:
          - '@DELVAR b $MobArena.<playername>_lobby'
    
    This one works. Actually tested it to make sure...Not sure why, but it wasn't grabbing the area before.
     
    jjacobson likes this.
  9. Offline

    jjacobson

    Ok thanks i will test it.
    Edit: It works, thanks so much this is awesome!

    Last question, if I have 2 arenas will this work for both? If i just set this up under each lobby in the config?

    Like this
    Code:
    world:
      61,132,140,87,144,166:
        Name: default
        Enter:
          CoolDown: 0
          Script:
          - '@IF b $MobArena.<playername>_lobby = false'
          - '  @SETBOOL $MobArena.<playername>_lobby true'
          - '  @PAUSE 20'
          - '  @IF b $MobArena.<playername>_lobby = true'
          - '    @CMDCON ma force start default'
          - '    @DELVAR b $MobArena.<playername>_lobby'
          - '  @ELSE'
          - '    @DELVAR b $MobArena.<playername>_lobby'
          - '  @ENDIF'
          - '@ENDIF'
        Exit:
          CoolDown: 0
          Script:
          - '@DELVAR b $MobArena.<playername>_lobby'
      171,215,528,197,227,554:
        Enter:
          CoolDown: 0
          Script:
          - '@IF b $MobArena.<playername>_lobby = false'
          - '  @SETBOOL $MobArena.<playername>_lobby true'
          - '  @PAUSE 20'
          - '  @IF b $MobArena.<playername>_lobby = true'
          - '    @CMDCON ma force start ma1'
          - '    @DELVAR b $MobArena.<playername>_lobby'
          - '  @ELSE'
          - '    @DELVAR b $MobArena.<playername>_lobby'
          - '  @ENDIF'
          - '@ENDIF'
        Exit:
          CoolDown: 0
          Script:
          - '@DELVAR b $MobArena.<playername>_lobby'
    How would I make this work?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 29, 2016
  10. Offline

    midnightfang22

    just change or add 1 number/letter to the $MobArena.<playername>lobby like $MobArena.<playername>lobby1 for every reference, otherwise someone could join the default arena then go to ma1 and it would start the default arena.
     
    jjacobson likes this.
  11. Offline

    jjacobson

    I did this
    Code:
    world:
      61,132,140,87,144,166:
        Name: default
        Enter:
          CoolDown: 0
          Script:
          - '@IF b $MobArena.<playername>_lobby = false'
          - '  @SETBOOL $MobArena.<playername>_lobby true'
          - '  @PAUSE 20'
          - '  @IF b $MobArena.<playername>_lobby = true'
          - '    @CMDCON say ma force start default'
          - '    @DELVAR b $MobArena.<playername>_lobby'
          - '  @ELSE'
          - '    @DELVAR b $MobArena.<playername>_lobby'
          - '  @ENDIF'
          - '@ENDIF'
        Exit:
          CoolDown: 0
          Script:
          - '@DELVAR b $MobArena.<playername>_lobby'
      171,215,528,197,227,554:
        Enter:
          CoolDown: 0
          Script:
          - '@IF b $MobArena.<playername>_lobby1 = false'
          - '  @SETBOOL $MobArena.<playername>_lobby1 true'
          - '  @PAUSE 20'
          - '  @IF b $MobArena.<playername>_lobby1 = true'
          - '    @CMDCON say ma force start ma1'
          - '    @DELVAR b $MobArena.<playername>_lobby1'
          - '  @ELSE'
          - '    @DELVAR b $MobArena.<playername>_lobby1'
          - '  @ENDIF'
          - '@ENDIF'
        Exit:
          CoolDown: 0
          Script:
          - '@DELVAR b $MobArena.<playername>_lobby1'
    
    And got this error when I entered the region http://pastebin.com/7dxUtvaD

    EDIT: ah typo on my end, I see it now after looking through it. Works great now thank you so much!
     
Thread Status:
Not open for further replies.

Share This Page