Ingame Interface to Reset Interact Scripts!


Author: tstom0
Created: 2014-03-21T05:39:35-0400
Edited: 2014-03-21T05:39:35-0400
Denizen Version: 0.94
Views: 20
Downloads: 844
Likes: 2


WGET
Description:
## Easily allow staff on your server to reset an interact script for particular players ingame.
## Simple add the command below, an example would be on the chat trigger of "reset".

## ----------------------- FEATURES ----------------------- ##
##
## * Supports permissions, simply add the permission node "denizen.scripts.resetsteps".
## * Supports multiple interact scripts and multiple players.
##
## -------------------------------------------------------- ##

## COMMAND - RUN SCRIPT:RESETSTEPS DEF:<AmountOfInteractScriptsHere>|<FirstInteractScript>|<NextInteractScript>
## EXAMPLE - RUN SCRIPT:RESETSTEPS DEF:3|firstscript|secondscript|thirdscript
##
## INGAME - Enter names like "tstom0,Igkn,randomplayer"

##############################################################
#                                                            #
#                      MADE BY TSTOM0                        #
#                                                            #
##############################################################
 
## Easily allow staff on your server to reset an interact script for particular players ingame.
## Simple add the command below, an example would be on the chat trigger of "reset".
 
## ----------------------- FEATURES ----------------------- ##
##
##  * Supports permissions, simply add the permission node "denizen.scripts.resetsteps".
##  * Supports multiple interact scripts and multiple players.
##
## -------------------------------------------------------- ##
 
## COMMAND - RUN SCRIPT:RESETSTEPS DEF:<AmountOfInteractScriptsHere>|<FirstInteractScript>|<NextInteractScript>
## EXAMPLE - RUN SCRIPT:RESETSTEPS DEF:3|firstscript|secondscript|thirdscript
##
## INGAME - Enter names like "tstom0,Igkn,randomplayer"

ResetStepsChat:
  Type: World
  Debug: False
  Events:
    on player chats:
      - IF <player.has_flag[ResetSteps]> {
        - IF <context.message> == "cancel" || <context.message> == "exit" {
          - FLAG player "ResetSteps:!"
          - NARRATE "<red>Your chat capabilities have been restored."
          }
          ELSE {
          - NARRATE "<gold> ===================================================="
          - FOREACH "<context.message.split[,].as_list>" {
            - DEFINE playername "%value%"
            - IF <p@%playername%.has_played_before> {
              - FOREACH <player.flag[ResetSteps].as_list> {
                - DEFINE scriptname "%value%"
                - ZAP STEP:1 SCRIPT:%scriptname% PLAYER:p@%playername%
                }
              - NARRATE "<&d> - <green><aqua>%playername% <green>has had their progress reset!"
              }
              ELSE {
              - NARRATE "<&d> - <aqua>%playername% <yellow>is not a valid player!"
              }
            }
          - NARRATE "<red> Type <&d>cancel <red>or <&d>exit <red>to return to normal."
          - NARRATE "<gold> ===================================================="
          }
        - DETERMINE cancelled
        }

ResetSteps:
  Type: Task
  Script:
    - IF <player.has_permission[denizen.scripts.resetsteps]> != "true" {
      - NARRATE "<red>Insufficient Permissions!"
      - QUEUE clear
      }
    - DEFINE scriptamount "%1%"
    - DEFINE interactScript "2"
    - REPEAT %scriptamount% {
      - DEFINE value "<def[%interactScript%]>"
      - FLAG player "ResetSteps:->:%value%"
      - DEFINE interactScript "<def[interactScript].add[1].as_int>"
      }
    - ^NARRATE "<red>Please enter the players name."
    - ^NARRATE "<red>You will not be able to chat during this time."
    - ^NARRATE "<red>Type <&d>cancel <red>or <&d>exit <red>to return to normal."




Comments
2014-03-25 14:11:27 - wonderdude:

This is amazing, need this so much. Sadly I can't get it to work? In game I type /ex run script:ResetSteps def:1|IntroScript It prompts me with the username to reset. I type my minecraft username. It says the player has been reset for that interact script. I type "exit" to go back to normal chat. But after that I'm still at the same step I was at before. (which is one of the last steps) Any help :S? I looked through your script, I changed my first step to be called "1:" instead of what I had before. But it still doesn't work. It comes upw ith an ERROR: ERROR! 'SCRIPT:def[2]' is an unknown argument! ERROR! Woah!! An exception has been called with this command!
2014-04-02 02:27:28 - tstom0:

Could you run a debug with /denizen debug -r then once you've ran the script use /denizen submit and send me the link please.