[MECH] ScriptedEvents v1.7.3 - Make your own plugin-like functionality [1185]

Discussion in 'Inactive/Unsupported Plugins' started by Nopants, Jun 13, 2011.

  1. Offline

    Nopants

    ScriptedEvents - make your own plugin-like functionality:
    Version: v.1.7.3

    With this Plugin you are able to script your own events. This is the backbone of programming. The basic idea behind this plugin is to make server-admins or even players able to create their own little programms that will enhance gameplay, without any knowledge of java.
    How many different things those programms could do depends on this plugin and other plugins a server is running that provide commands.

    Features:
    • Simple copy/paste-able packages to share selfmade functionality
    • Create/delete/edit Cuboids, Triggers, Scripts and Conditions ingame or via a text-editor
    • Create/delete/edit Variables (Integer, String or Set) ingame
    • Use Triggers to execute Scripts on events
    • Use server-commands, plugin-commands, custom actions, custom functions, userdefined and predefined variables
    • Use Conditions that have to be fulfilled if a Trigger should executed a script
    • Scripts and Conditions send errors if syntax or semantics are incorrect
    • Permissions-Support
    By adding more and more events, actions, functions, conditions and more complex variable-management, the possibilities will go through the roof. Many plugin-requests can be done using this plugin and it adds another tool to creativity in playing minecraft.




    Usage:
    Run the Plugin and it will create all necessary files. Read "How things work in ScriptedEvents", "Usable Stuff", "Commands" and some Examples to understand how to use the plugin.

    How things work in ScriptedEvents (open)
    Triggers:
    If a trigger is released, it will check if it's conditions are fulfilled. If they are it executes all lines in a script-file. Triggers are stored in 'trigger.yml' in the plugin-folder.
    A trigger contains an event, an entity (depending on the event), a conditions-file and a script-file.

    Scripts:
    Script-files contain a list of commands that can be executed by a trigger. Every server-command can be used. You must start commands with the typical '/'. There are some further "actions" and "functions" that can be used, like messageTo(). They are listed below. Script-files are stored in the sub-dir 'scripts' of the plugin-dir. If you want to create them with a text-editor and you want them to contain special characters, like 'ä', you have to save them in UTF-8, not the default ANSI.

    Conditions:
    Condition-files contain a list of conditions that have to be fulfilled before a script will be executed. An example contition-file can be downloaded. Condition-files are stored in the sub-dir 'conditions' of the plugin-dir. If you want to create them with a text-editor and you want them to contain special characters, like 'ä', you have to save them in UTF-8, not the default ANSI.

    Cuboids:
    The fist two implemented events were cuboid-related, onEnter and onLeave. Cuboids are created via the common selection of two vertexes. You select the first and the secon vertex via right- and left-clicking a block with the seletion-item, which is defined in the 'config.yml'. The default item is a feather. After selection you can save a cuboid to the 'cuboids.yml'.

    Packages:
    What is the use of Packages:
    Packages will be usefull if you want to add functionality that has been created in ScriptedEvents by other people, or you want to share the functionality you've made with ScriptedEvents with others. Packages combine Cuboids, Triggers, Conditions and Scripts. Packages can be copied and pasted as a whole without any further changes to your plugin folder. This increases portability of user-created content.​
    What are Packages:
    Packages are subdirectories of the "packages" directory, which gets created in the plugin directory. Each Package derives its name from its folders name. They can simply be paste into / created in the "packages" directory and will get loaded on enable or refresh of the plugin. Each Package directory (e.g 'ScriptedEvents/packages/myPack') will have the same file- and folder-structure as the plugin directory (trigger.dat, cuboid.dat, scripts folder, etc.). Entities in Packages can have the same names as entities used in other packages or the main directory.​
    Combining Packages with your own content:
    Inside a Package (e.g. in a script contained in a Package) you can only use other entities contained in the same Package. At the same time entities contained in a Package cannot be used from the main directorie or other Packages. For now all variables have to be set up in the main directorys and they cannot get stored in Packages.​

    Usable Stuff (open)

    Events:
    • onEnter(<cuboid-name>)
    • onLeave(<cuboid-name>)
    • onCommand(<command>)
    • onInteract #works with buttons, levers, everything!
    • onDeath
    • onRespawn
    • onBlockPlace
    • onBlockBreak
    • onJoin
    • onQuit
    • onKick
    World-related Actions:
    • removeItemInHand(<player-name>)
    • removeItem(<player>,<itemID>[,<amount>]) #amount is optional. '1' is default
    • removeItemAt(<player>,<slot>[,<amount>]) #amount is optional. '1' is default
    • giveItem(<player>,<itemID>[,<amount>]) #amount is optional. '1' is default
    • giveItemAt(<player>,<slot>,<itemID>[,<amount>]) #amount is optional. '1' is default
    • setHealth(<player-name>,<new value>)
    • messageTo(<player-name>,<message>) #sends a message to a player without the additional output of the /say command
    • broadcast(<message>) #sends a message to all online players on the server
    • changeBlockType(<world-name>,<block-location>,<new Type-ID>) #changes the type of a block
    • changeBlockData(<world>,<location>,<new Data>)
    • playerCommand(<player-name>,<command>) #let a player execute a server command
    • playEffect(<player>,<effect>) #check the bottom of this spoiler for a list of effects
    • cancelEvent #can be used to cancel an interact()-Event
    • teleport(<player>,<world>,<location>)
    • toggleLever(<world>,<location>)
    • toggleDoor(<world>,<location>) #works with wooden doors, iron doors and trapdoors
    • setTime(<world>,<time>) #time reaches from '0' to '24000'
    Script-related Actions:
    • if(<condition>) #"if" can only be used if it's followed by "then" in the next action. it will execute the action included in the "then"-statement, if the condition is fulfilled
    • then(<action>) #"then" can only be used if it's preceded by an "if"-statement
    • else(<action>) #"else" can only be used if it's preceded by a "then"-statement. it will execute the action if the condition included in the "if"-statement is not fulfilled
    • delay(<milliseconds>) #pauses the script
    • trigger(<trigger-name>) #releases a trigger
    • doForCuboidBlocks(<cuboid-name>,<action>)
    • doForSetItems(<set-name>,<action>)
    • script(<script-name>)
    • do #will execute all following actions that begin with "|" as if they were one single action. use to execute mutiple lines in then() and else()
    • loop(<cycles>) #NEEDS TO BE ADDED AS THE LAST LINE
    • while(<condition>) #NEEDS TO BE ADDED AS THE LAST LINE
    Functions:
    • health(player-name) #will be dissolved to the amount health of the Player
    • itemInHand(player-name) #will be dissolved to <ItemInHandID>
    • itemAtSlot(<player>,<slot>) #will be dissolved to the itemID of the item at <slot>
    • searchItem(<player>,<itemID>[,<amount>]) #will be dissolved to a slot holding the searched item. amount is optional. '1' is default
    • slotInHand(<player>) #will be dissolved to the slot wich is in hand
    • time(<world>)
    • size(<set-name>) #will be dissolved to the number of items in the given set
    • isInBed(<player>)
    • isSneaking(<player>)
    • playerLocation(<player>)
    • playerLocationX(<player>)
    • playerLocationY(<player>)
    • playerLocationZ(<player>)
    • playerWorld(<player>)
    • blockID(<world>,<location>)
    • blockData(<world>,<location>)
    • calc(<mathematic expression>) #will be dissolved to a simple integer
    • random(<min>,<max> | <range>)
    • arg(<argument-position>) #/mycommand nopants test => arg(0) = mycommand; arg(1) = nopants; arg(2) = test
    Conditions:
    • equals(<StringX>,<StringY>) #will check if <StringX> equals <StringY>. works for integer-variables too
    • bigger(<biggerInteger>,<smallerInteger>) #will check if <biggerInteger> is bigger then <smallerInteger>
    • and(<firstCondition>,<secondCondition>) #will check if first AND second condition are met
    • or(<firstCondition>,<secondCondition>) #will check if first OR second condition is met
    • check(<condition-name>) #will check if all conditions in the condition-file are met
    • hasItem(<player>,<itemID>,<requiredAmount>) #requiredAmount is optional. '1' is default
    • isSwitchedOn(<world>,<location>) #works with levers
    • isOpen(<world>,<location>) #works with wooden doors, iron doors and trapdoors
    • isEmpty(<set>)
    • isInside(<player>,<cuboid>)
    • inGroup(<world>,<player>,<group>) #works with the Permissions plugin
    • hasPermission(<world>,<player>,<permission>) #works with the Permissions plugin
    • online(<player>)
    Premade event-related variables:
    • <triggeringPlayer> #will be dissolved to the name of the player, who releases the trigger the script is executed by
    • <triggeringCuboid> #will be dissolved to the name of the cuboid the trigger is released by
    • <cuboidBlockLocation> #will be dissolved to <x>;<y>;<z> of a block. can only be used in doForCuboidBlocks()
    • <cuboidBlockLocationX>
    • <cuboidBlockLocationY>
    • <cuboidBlockLocationZ>
    • <clickedLocation> #will be dissolved to <x>;<y>;<z> of the clicked location. if no location got clicked (air), it will get dissolved to "none"
    • <clickedLocationX>
    • <clickedLocationY>
    • <clickedLocationZ>
    • <clickedLocationID> #will be dissolved to the ID of the Block at the clicked location. If no location got clicked (air), it will get dissolved to "none"
    • <rightClick> #will be dissolved to true if the interaction-event was triggered by a right-click
    • <setItem> #will be dissolved to an item of a set. can only be used in doForSetItems()
    • <deathCause> #will be dissolved to the deathcause in onDeath events. check the bottom of this spoiler for a list of causes
    • <placedBlockLocation> #<x>,<y>,<z>
    • <placedBlockLocationX>
    • <placedBlockLocationY>
    • <placedBlockLocationZ>
    • <placedBlockID>
    • <placedBlockData>
    • <brokenBlockLocation> #<x>,<y>,<z>
    • <brokenBlockLocationX>
    • <brokenBlockLocationY>
    • <brokenBlockLocationZ>
    • <brokenBlockID>
    • <brokenBlockData>
    Permission-Nodes (case-sensitive):
    • se.debug
    • se.help
    • se.refresh
    • se.edit
      • se.edit.add
      • se.edit.delete
      • se.edit.name
      • se.edit.event
      • se.edit.entity
      • se.edit.script
      • se.edit.condition
      • se.edit.close
      • se.edit.save
    • se.cuboid
      • se.cuboid.create
      • se.cuboid.delete
      • se.cuboid.edit
    • se.trigger
      • se.trigger.create
      • se.trigger.delete
      • se.trigger.edit
    • se.script
      • se.script.create
      • se.script.delete
      • se.script.edit
    • se.condition
      • se.condition.create
      • se.condition.delete
      • se.condition.edit
    • se.variable
      • se.variable.create
      • se.variable.delete
      • se.variable.edit
    • se.customCMD
      • se.customCMD.<yourCommand>
    Effects:
    • BOW_FIRE
    • CLICK1
    • CLICK2
    • DOOR_TOGGLE
    • EXTINGUISH
    • RECORD_PLAY
    • SMOKE
    • STEP_SOUND
    Death Causes:
    • BLOCK_EXPLOSION
    • CONTACT
    • CUSTOM
    • DROWNING
    • FALL
    • FIRE
    • FIRE_TICK
    • LAVA
    • LIGHTNING
    • SUFFOCATION
    • VOID
    • SKELETON
    • GHAST
    • PVP
    • SLIME
    • WOLF
    • PIGZOMBIE
    • ZOMBIE
    • CREEPER
    • SPIDER


    Commands (open)

    If feel like creating stuff ingame needs way to many commands. I will try to provide the possibility to use less commands.
    Code:
    /SE.help [page]                                  or /se.h
    /SE.debug                                        or /se.d
    /SE.refresh                                      or /se.r
    
    /SE.cuboid.create <cuboid-name>                  or /se.c.s
    /SE.cuboid.delete <cuboid-name>                  or /se.c.d
    /SE.cuboid.edit <cuboid-name>                    or /se.c.e
    
    /SE.trigger.create <trigger-name>                or /se.t.c
    /SE.trigger.delete <trigger-name>                or /se.t.d
    /SE.trigger.edit <trigger-name>                  or /se.t.e
    
    /SE.script.create <script-name>                  or /se.s.c
    /SE.script.delete <script-name>                  or /se.s.d
    /SE.script.edit <script-name>                    or /se.s.e
    
    /SE.variable.create int|string <name> <value>    or /se.v.c
    /SE.variable.create set <name>                   or /se.v.c
    /SE.variable.delete <name>                       or /se.v.d
    /SE.variable.edit int|string <name> <value>      or /se.v.e
    /SE.variable.edit set <name> add|remove <value>  or /se.v.e
    
    /SE.edit.name <new trigger-name/new cuboid-name> or /se.e.n
    /SE.edit.script <script-name>                    or /se.e.scr
    /SE.edit.condition <condition-name>              or /se.e.co
    /SE.edit.event <trigger-event>                   or /se.e.e
    /SE.edit.entity <cuboid-name/command>            or /se.e.ent
    /SE.edit.add <action>                            or /se.e.e
    /SE.edit.save                                    or /se.e.s
    /SE.edit.close                                   or /se.e.cl
    

    Examples (open)

    Make a command-alias:
    1. Make a script that contains the command you want to have an alias of.
    /se.s.c myAliasScript #create a blank script​
    /se.s.e <script-name> #get into Edit-More​
    /se.e.a /<your Command> #add your Command to the script​
    /se.e.s #save the script​
    2. Make an onCommand(yourCommand)-trigger and link your script to it.
    /se.t.c myAliasTrigger #create a blank trigger​
    /se.t.e <trigger-name> #get into Edit-Mode​
    /se.e.e onCommand #set the trigger to get release when a command is used​
    /se.e.ent myAlias #set the trigger-entity to the new command "myAlias"​
    /se.e.scr <script-name> #link the trigger to your script​
    /se.e.s #save the trigger​

    Make a "Who am I?"-Command:
    1. Make the script that sends the players name to the triggering player:
    /se.script create whoamiScript​
    /se.script.edit whoamiScript​
    /se.edit.add messageTo(<triggeringPlayer>,Your name is <triggeringPlayer>!)​
    /se.edit.save​
    2. Make a trigger for the new Command:
    /se.trigger.create whoamiTrigger​
    /se.trigger.edit whoamiTrigger​
    /se.edit.event onCommand​
    /se.edit.entity whoami​
    /se.edit.script whoamiScript​
    /se.edit.save​

    Make a button that tells you the ID of an item:
    1. Make an onInteract()-trigger checking the following condition.
    2. Make a condition that checks if the <clickedLocation> equals the location of your button.
    3. Link a script that sends you a message containing <itemInHand>.

    Define "important places":
    1. Make a script that sends a message to the triggering player containing the name of the triggering cuboid.
    2. Make a cuboid for every important place
    3. Make a trigger for every cuboid that executes the script you've created, or if you don't have any other cuboid than the important places, make one trigger without including a trigger-cuboid.

    Code:
    # create a new cuboid with the name 'myNewCuboid'
    /SE.cuboid.create myNewCuboid
    # get into Edit-Mode for the cuboid myNewCuboid
     /SE.cuboid.edit myNewCuboid
    
    # create a new blank trigger with the name 'myNewTrigger'
    /SE.trigger.create myNewTrigger
    
    # get into Edit-Mode for the trigger myNewTrigger
     /SE.trigger.edit myNewTrigger
    # sets the name of the edited trigger or cuboid to 'newName'
    /SE.edit.name newName
    # sets the event of the edited trigger to onCommand
    /SE.edit.event onCommand
    # sets the trigger-entity, in this case the trigger-Command, to myCMD
    /SE.edit.entity myCMD
    # saves alle the changes to file
    /SE.edit.save
    
    # create a new blank script with the name 'myNewScript'
    /SE.script.create myNewScript
    
    # get into Edit-Mode for the script myNewScript
    /SE.script.edit myNewScript
    # add a new action 'messageTo(<triggeringPlayer>,Hello there!)' to the script
    /SE.edit.add messageTo(<triggeringPlayer>,Hello there!)
    # saves alle the changes to file
    /SE.edit.save
    
    # create a variable with the name 'PlayerName' and the value 'nopants'
    /SE.variable.create string PlayerName nopants
    # change the value of the variable 'PlayerName' to 'Notch'
    /SE.variable.edit string PlayerName Notch
    
    # create a new blank condition-file with the name 'myNewConditions'
    /SE.condition.create myNewConditions
    
    # get into Edit-Mode for the condition-file myNewConditions
    /SE.condition.edit myNewConditions
    # add a new condition 'equals(<triggeringPlayer>,<PlayerName>)' to the condition-file
    /SE.edit.add equals(<triggeringPlayer>,<PlayerName>)
    # saves alle the changes to file
    /SE.edit.save
    


    READ BEFORE USING:
    Some self-made scripts can send your server into an infinite loop and block changing actions will obviously change your world, so test your own scripts before running them on a public server.

    Download
    ScriptedEvents (JAR): v.1.7.3 , v.1.7.2 , v.1.6.8 , v.1.6.5 , v.1.6.1 , v.1.6 , v.1.5.9 , v.1.5.3 , v.1.5 , v.1.3.5
    An example script: HERE.
    An example condition: HERE.

    Changelog:
    • Version 1.7.3
      • updated to 1.8.1
    • Version 1.7.2
      • added function: <playerLocationX>
      • added function: <playerLocationY>
      • added function: <playerLocationZ>
      • added variable: <clickedLocationX>
      • added variable: <clickedLocationY>
      • added variable: <clickedLocationZ>
      • added variable: <placedBlockLocationX>
      • added variable: <placedBlockLocationY>
      • added variable: <placedBlockLocationZ>
      • added variable: <brokenBlockLocationX>
      • added variable: <brokenBlockLocationY>
      • added variable: <brokenBlockLocationZ>
      • added variable: <cuboidBlockLocationX>
      • added variable: <cuboidBlockLocationY>
      • added variable: <cuboidBlockLocationZ>
      • changed action: teleport(<player>,<world>,<location>)
      • added variable: <clickedLocationID> #use in interact events
      • added action: broadcast(<message>) #sends a message to all online players on the server
      • changed config flag: ErrorDestination #can now be 'PLAYER<playerName>'.
    • Version 1.7.1
      • added config flag: ErrorDestination #can be 'LOG' or 'FILE'. Will create itself. 'LOG' is default.
      • added condition: inGroup(<world>,<player>,<group>)
      • added condition: hasPermission(<world>,<player>,<permission>)
    • Version 1.7
      • added condition: isInside(<player>,<cuboid>)
      • added Premade Variable: <deathCause> #usable in onDeath-events
      • added event: onDeath
      • added event: onJoin
      • added event: onQuit
      • added event: onKick
    Further Changelog (open)


    • Version 1.6.8
      • added action: toggleLever(<world>,<location>)
      • added condition: isSwitchedOn(<world>,<location>) #works with levers
      • added action: toggleDoor(<world>,<location>) #works with wooden doors, iron doors and trapdoors
      • added condition: isOpen(<world>,<location>) #works with wooden doors, iron doors and trapdoors
      • added condition: isEmpty(<set>)
      • added condition: online(<player>)
      • added action: setTime(<world>,<time>) #time reaches from '0' to '24000'
      • fixed bug in "slotInHand()" returning null if no item is in hand
    • Version 1.6.5
      • fixed cancel Interaction-Event bug
      • fixed bracket bug inside comments
      • fixed saving trigger bug
      • added Packages
    • Version 1.6.1
      • added action: teleport(<player>,<location>)
      • added function: playerWorld(<player>)
      • fixed a couple of bugs
    • Version 1.6
      • added the possibility to mask strings with " #messageTo(<player>,"This is a masked string, that may contain a comma!")
      • added event: onRespawn
      • added event: onBlockPlace
      • added variable: <placedBlockLocation>
      • added variable: <placedBlockID>
      • added variable: <placedBlockData>
      • added event: onBlockBreak
      • added variable: <brokenBlockLocation>
      • added variable: <brokenBlockID>
      • added variable: <brokenBlockData>
    • Version 1.5.9
      • added Interpreter
      • added comments #begin with '#'
      • empty lines are okay from now on
      • changed the way server commands have to appear in scripts. they MUST begin with the typical '/' now
      • added action: removeItemAt(<player>,<slot>[,<amount>]) #amount is optional. '1' is default
      • added action: giveItem(<player>,<itemID>[,<amount>]) #amount is optional. '1' is default
      • added action: giveItemAt(<player>,<slot>[,<amount>]) #amount is optional. '1' is default
      • changed action: messageTo(<player-name>,<message>) #sends a message to a player without the
      • changed action: playerCommand(<player-name>,<command>) #let a player execute a server command
      • changed action: doForCuboidBlocks(<cuboid-name>,<action>)
      • changed action: doForSetItems(<set-name>,<action>)
      • added function: itemAtSlot(<player>,<slot>) #will be dissolved to the itemID of the item at <slot>
      • added function: searchItem(<player>,<itemID>[,<amount>]) #will be dissolved to a slot holding the searched item. amount is optional. '1' is default
      • added function: slotInHand(<player>) #will be dissolved to the slot wich is in hand
      • added function: isSneaking
      • added function: calc(<mathematic expression>) #will be dissolved to a simple integer
      • added function: size(<set-name>) #will be dissolved to the number of items in the given set
      • changed function: arg(<argument-position>) #/mycommand nopants test => arg(0) = mycommand; arg(1) = nopants; arg(2) = test
      • changed variable: <item> to <setItem>
      • changed variable: <blockLocation> to <cuboidBlockLocation>
    • Version 1.5.3
      • added set-variable-type #all set-names are strings and so are all set-items
      • changed Command: /se.v.e string <string-name> <new value> #changed from /se.v.e <string-name> <new value>
      • changed Command: /se.v.e int <int-name> <new value> #changed from /se.v.e <int-name> <new value>
      • added Command: /se.v.e set <set-name> onlinePlayers #will clear the set and add all online players names to it
      • added Command: /se.v.e set <set-name> add <item-string> #will add the item to the passed set
      • added Command: /se.v.e set <set-name> remove <item-string> #will remove the item from the passed set
      • added Command: /se.v.c set <set-name> #will create a blank set-variable
      • added Action: doForItems(<set-name>) <action> #the action will be executed for every item in the passed set. the respective item can be used with <item>
      • added Predefined Variable: <item> #use in doForItems(<set-name>)
      • added Condition: contains(<set>,<item>) #checks if a set contains the passed item
      • added getFunction: getSize(<set>) #gets resolved to the size of the passed set
    • Version 1.5
      • added Action: changeBlockData(<world>,<Location>,<new Data>)
      • added Action: playerCommand(<player-name>) <command>
      • added Action: executeScript(<script-name>)
      • added Variable: time(<world>)
      • added Variable: isInBed(<player>)
      • added Variable: playerLocation(<player>)
      • added Variable: blockID(<world>,<location>)
      • added Variable: blockData(<world>,<location>)
      • added Support: Permissions
      • whitespaces at the begining or the end of actions will be ignored
    • Version 1.4
      • changed the read- and write-method so files don't need ids and line-numbers
      • playEffect(<player>,<effect>)
      • do #will execute every following action that begins with "| " as one action. use to execute mutiple lines in then() and else()
      • changed the variables <health> and <itemInHand> to the functions "heath(<player-name>)" and "itemInHand(<player-name>)"
    • Version 1.3.5
      • added Action: cancelEvent() #can be used to cancel an interact()-Event
      • added Condition: hasItem(<player>,<itemID>,<requiredAmount>) #requiredAmount is optional. '1' is default
      • added Action: removeItem(<player>,<itemID>,<amountToRemove>) #amountToRemove is optional. '1' is default
      • added Action: loop(<cycles>) #NEEDS TO BE ADDED AS THE LAST LINE
      • added Action: while(<condition>) #NEEDS TO BE ADDED AS THE LAST LINE
      • added Action: setRandomRange(<range>) OR setRandomRange(<min>,<max>) #it will set the range for <randomInt>
      • added Variable: <randomInt> #will be dissolved to a random integer
    • Version 1.3
      • added Variable: <health>
      • added Action: setHealth(<player>, <new value>)
      • added Variable: <arg<i>> #arguments of custom commands get resolved. use <arg1> for the first and so on
      • added Action: doForCuboidBlocks(<cuboid-ID>) <action> #use with changeBlockType() and <blockLocation>
      • added Variable: <blockLocation>
    • Version 1.2
      • added command: /SE.edit.condition
      • added command: /SE.refresh
      • made the plugin catch some exceptions caused by wrong usage
    • Version 1.1
      • added multiworld-support
      • changed the event "InteractAt()" to "Interact()"
      • added variable to Interact-Event: <clickedLocation> #contains <x>;<y>;<z>
      • added variable to Interact-Event: <rightClick> #contains <true|false>
      • changed the variable <triggerItem> to <itemInHand> #contains <itemID>
      • added custom function removeItemInHand(<player-name>)
      • added custom function changeBlockType(<world-name>,<block-location>,<new Type-ID>)
      • made it impossible to create two variables (int and string) with the same name
      • added teleportation and portal-usage to the check if a player is inside a cuboid
      • got rid of the "counts" in all files
      • added the possibility to use if-then-else in scripts
    • Version 1.0
      • create/delete/edit conditions ingame
      • create/delete/edit string and integer variables ingame
      • resolve variables in scripts and in Edit-Mode
      • resolve calculations inserted as a value for an integer-variable
    • Version 0.4.9
      • conditions get loaded into the plugin
      • before a trigger executes a script it will check if it's conditions are fulfilled
      • added condition equals()
      • added condition bigger()
      • added condition and()
      • added condition or()
    • Version 0.4.5
      • scripts get loaded into the plugin
      • scripts can be created
      • actions can be added to scripts via Edit-Mode
    • Version 0.4
      • added Edit-Mode
      • reworked parts of the code
    • Version 0.3.5
      • Exceptions caused by incomplete .yml or missing .script files fixed
      • added custom function delay()
      • added custom function trigger()
      • added custom function <triggeringCuboid>
      • added custom function <triggeringItem>
      • added the ability to release more than one trigger on an event
      • added the event onInteractAt()
      • added the event onCommand()
      • added the ability to include no cuboid in onEnter() and onLeave() to get triggered by all cuboids
    • Version 0.3
      • Release as a work in progress
     
    iPeace, p3king, JustinGuy and 2 others like this.
  2. Looks good, I'll see what I can do with this/need it for!
     
  3. Offline

    m5k

    Wow great, this is like an extended version of rTriggers.
     
  4. Offline

    Kalemar

    Trying to follow your example to get an idea on how this works and having not working.

    Scripted Events 1.1 , minecraft_server 1.6.6, bukkitcraft 860, when I type "/SE.cuboid.create myNewCuboid" it causes the following error;


    2011-06-17 23:29:44 [SEVERE] null
    org.bukkit.command.CommandException: Unhandled exception executing command 'se.cuboid.create' in plugin ScriptedEvents v1.1
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:37)
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:128)
    at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:287)
    at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.java:712)
    at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:678)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:671)
    at net.minecraft.server.Packet3Chat.a(Packet3Chat.java:32)
    at net.minecraft.server.NetworkManager.b(NetworkManager.java:226)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:75)
    at net.minecraft.server.NetworkListenThread.a(SourceFile:105)
    at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:399)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:309)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:422)
    Caused by: java.lang.NullPointerException
    at me.nopants.ScriptedEvents.SEcuboid.toString(SEcuboid.java:49)
    at me.nopants.ScriptedEvents.SEcommander.cuboidCreate(SEcommander.java:533)
    at me.nopants.ScriptedEvents.ScriptedEvents.onCommand(ScriptedEvents.java:123)
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:35)
    ... 12 more
     
  5. Offline

    Nopants

    Fixed that. You have to select two vertexes with the selection-tool first. The default item is a feather. You can change it in the config.yml. Use right and left click to select two vertexes.

    EDIT#1: I would also recommend to delete your cuboid.yml-file because inserting cuboids without selecting vertexes messed up the file.

    EDIT#2: Please redownload all files and delete or change existing files. Changes have been made to the jar without a version-change. Also all yml, script and condition-files don't need a "Count" anymore.
     
  6. Offline

    Nopants

    I changed alot in the main-post. Some more examples and hopefully a more understandable description of how to use the plugin. Here is the changelog for the versions 1.1 and 1.2.

    • Version 1.2
      • added command: /SE.edit.condition
      • added command: /SE.refresh
      • made the plugin catch some exceptions caused by wrong usage
    • Version 1.1
      • added multiworld-support
      • changed the event "InteractAt()" to "Interact()"
      • added variable to Interact-Event: <clickedLocation> #contains <x>;<y>;<z>
      • added variable to Interact-Event: <rightClick> #contains <true|false>
      • changed the variable <triggerItem> to <itemInHand> #contains <itemID>
      • added custom function removeItemInHand(<player-name>)
      • added custom function changeBlockType(<world-name>,<block-location>,<new Type-ID>)
      • made it impossible to create two variables (int and string) with the same name
      • added teleportation and portal-usage to the check if a player is inside a cuboid
      • got rid of the "counts" in all files
      • added the possibility to use if-then-else in scripts
     
  7. Bumping for potential awesomes.
     
  8. Offline

    Nopants

    @fullwall thanks :D

    Version 1.3
    • added Variable: <health>
    • added Action: setHealth(<player>, <new value>)
    • added Variable: <arg<i>> #arguments of custom commands get resolved. use <arg1> for the first and so on
    • added Action: doForCuboidBlocks(<cuboid-ID>) <action> #use with changeBlockType() and <blockLocation>
    • added Variable: <blockLocation>

    Version 1.3.5
    • added Action: cancelEvent() #can be used to cancel an interact()-Event
    • added Condition: hasItem(<player>,<itemID>,<requiredAmount>) #requiredAmount is optional. '1' is default
    • added Action: removeItem(<player>,<itemID>,<amountToRemove>) #amountToRemove is optional. '1' is default
    • added Action: loop(<cycles>) #NEEDS TO BE ADDED AS THE LAST LINE
    • added Action: while(<condition>) #NEEDS TO BE ADDED AS THE LAST LINE
    • added Action: setRandomRange(<range>) OR setRandomRange(<min>,<max>) #it will set the range for <randomInt>
    • added Variable: <randomInt> #will be dissolved to a random integer

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

    Connor Griffin

    You and wraithguard (CommandHelper) should work together or something.
     
  10. Offline

    Nopants

    @Connor Griffin You can already use CommandHelper and ScriptedEvents in Combination. As the two plugins provide different functionality i don't see the need to work together. Maybe you can point out that you were imagining?

    New Version is released. File-Structure changed. Backup your files, delete the ones in the plugin-folder, let the plugin create new ones, open the new and the old files in a text-editor and transfer your old content into the new file-format.

    Version 1.4
    • added Permissions-Support
    • changed the read- and write-method so files don't need ids and line-numbers
    • playEffect(<player>,<effect>)
    • do #will execute every following action that begins with "| " as one action. use to execute mutiple lines in then() and else()
    • changed the variables <health> and <itemInHand> to the functions "heath(<player-name>)" and "itemInHand(<player-name>)"
     
  11. Offline

    IEclipseII

    Well, you told me to post what I would need here so:
    All I think I would need is for conditions to be able to go within groups only, so I can check lets say, that atleast 6 people are on within group "Default" for example. Then the trigger would check that, then a script would put each player in a drawing and pick randomly. Not sure what would be needed to be added for that, but I think thats the basics of it.
     
  12. Offline

    Nopants

    @Connor Griffin My bad: CommandHelper and ScriptedEvents cannot be used in combination, yet. Maybe I will look into that.

    @IEclipseII I'm working on list-variables. There will be a function to collect all online players into a list, a condition to check if a player is online, and methods to add and remove items from a list.

    Version 1.5
    • added Action: changeBlockData(<world>,<Location>,<new Data>)
    • added Action: playerCommand(<player-name>) <command>
    • added Action: executeScript(<script-name>)
    • added Variable: time(<world>)
    • added Variable: isInBed(<player>)
    • added Variable: playerLocation(<player>)
    • added Variable: blockID(<world>,<location>)
    • added Variable: blockData(<world>,<location>)
    • added Support: Permissions
    • whitespaces at the begining or the end of actions will be ignored
     
  13. Offline

    Kalemar

    fantastic... again :) I will put those commands to good use and post some scripts.
     
  14. Offline

    tha d0ctor

    wow I can't wait to mess around with this!
     
  15. Offline

    Nopants

    I changed the plan to make a list-type and implemented a set-type. There is a problem with checking groups in Permissions. Otherwise the condition inGroup() would have already been implemented too.

    Version 1.5.3
    • added set-variable-type #all set-names are strings and so are all set-items. Sets are stored in "ScriptedEvents/variables/sets" as .dat-files. They can be created/edited ingame and with a texteditor
      • added Command: /se.v.e set <set-name> onlinePlayers #will clear the set and add all online players names to it
      • added Command: /se.v.e set <set-name> add <item-string> #will add the item to the passed set
      • added Command: /se.v.e set <set-name> remove <item-string> #will remove the item from the passed set
      • added Command: /se.v.c set <set-name> #will create a blank set-variable
      • added Action: doForItems(<set-name>) <action> #the action will be executed for every item in the passed set. the respective item can be used with <item>
      • added Predefined Variable: <item> #use in doForItems(<set-name>)
      • added Condition: contains(<set>,<item>) #checks if a set contains the passed item
      • added getFunction: getSize(<set>) #gets resolved to the size of the passed set
    • changed Command: /se.v.e string <string-name> <new value> #changed from /se.v.e <string-name> <new value>
    • changed Command: /se.v.e int <int-name> <new value> #changed from /se.v.e <int-name> <new value>
     
  16. Offline

    Nopants

    I added a new interpreter that contains a syntax checker. That should make debugging scripts and conditions way easier. As a side-effect all condition checks and script executions are run in seperate threads. This could get handy when it comes to performance issues.

    Version 1.5.9
    • added Interpreter
    • added comments #begin with '#'
    • empty lines are okay from now on
    • changed the way server commands have to appear in scripts. they MUST begin with the typical '/' now
    • added action: removeItemAt(<player>,<slot>[,<amount>]) #amount is optional. '1' is default
    • added action: giveItem(<player>,<itemID>[,<amount>]) #amount is optional. '1' is default
    • added action: giveItemAt(<player>,<slot>[,<amount>]) #amount is optional. '1' is default
    • changed action: messageTo(<player-name>,<message>) #sends a message to a player without the
    • changed action: playerCommand(<player-name>,<command>) #let a player execute a server command
    • changed action: doForCuboidBlocks(<cuboid-name>,<action>)
    • changed action: doForSetItems(<set-name>,<action>)
    • added function: itemAtSlot(<player>,<slot>) #will be dissolved to the itemID of the item at <slot>
    • added function: searchItem(<player>,<itemID>[,<amount>]) #will be dissolved to a slot holding the searched item. amount is optional. '1' is default
    • added function: slotInHand(<player>) #will be dissolved to the slot wich is in hand
    • added function: isSneaking
    • added function: calc(<mathematic expression>) #will be dissolved to a simple integer
    • added function: size(<set-name>) #will be dissolved to the number of items in the given set
    • changed function: arg(<argument-position>) #/mycommand nopants test => arg(0) = mycommand; arg(1) = nopants; arg(2) = test
    • changed premade variable: <item> to <setItem>
    • changed premade variable: <blockLocation> to <cuboidBlockLocation>
     
  17. Offline

    repeat

    bug:
    messageTo(<triggeringPlayer>,If you have the plugin WorldGuard installed, you will get healed in 5 seconds!)

    when i remove second comma all ok

    maybe no separate condition and script. make all in one file?
     
  18. Offline

    Nopants

    @repeat Thanks for the bugreport. I fixed that in 1.6. I don't really understand why conditions and scripts should be stored in the same file? Seperating them makes a more dynamic use possible. Maybe you can go more into detail with your idea?

    Version 1.6
    • added the possibility to mask strings with " #messageTo(<player>,"This is a masked string, that may contain a comma!")
    • added event: onRespawn
    • added event: onBlockPlace
    • added variable: <placedBlockLocation>
    • added variable: <placedBlockID>
    • added variable: <placedBlockData>
    • added event: onBlockBreak
    • added variable: <brokenBlockLocation>
    • added variable: <brokenBlockID>
    • added variable: <brokenBlockData>
     
  19. Offline

    Guniv

    Kinda confusing read, but would it be possible for a registration like-system? Like, player hits a button, it adds them to a usergroup (in this case maybe executes the /manuadd command for groupmanager) and teleports them somewhere? If it does, you are a life saver.
     
  20. Offline

    Nopants

    I don't know any reason why this shouldn't be possible. Eventually I will add a changeLocation(<player>) function but until then you only need a teleport command, like the one provided by CommandBook.
     
  21. Offline

    Guniv

    In this case we have a plugin that sets that group's spawnpoint, so doing a /kill on them would work. Thanks for clearing that up though!
     
  22. Offline

    repeat

    for something like this:

    if (a == 1) {
    printf("exp1");
    }
    elseif (a ==2) {
    printf("exp2");
    }

    need me make two script files for exp1 and exp2 with one condition file?

    p.s. Do you make name functions, actions and so on as similar as internal names of bukkit (and args too)? It will be great.
     
  23. Offline

    Nopants

    @repeat
    I don't know exactly what you mean. As scripts may contain if-then-else statements and single conditions (not condition-files that contain multiple conditions, I know it's a bit puzzling), you could put your example into one script file, without the need to make a condition file.

    it could look like this:
    Code:
    if(equals(a,1))
    then(messageTo(<triggeringPlayer>,"exp1"))
    if(equals(a,2))
    then(messageTo(<triggeringPlayer>,"exp2"))
    If you want an elseif you could combine an "else" with an "if" by using "do":
    Code:
    if(equals(a,1))
    then(<action 1>)
    else(do)
    | if(equals(a,2))
    | then(<action 2>)
    I want the names of functions and actions to be as intuitive as possible. As java is object-oriented bukkits internal methods are different in use and therefore in names. My function "time(<world>)" for example returns the result of bukkits method "server.getWorld(<world>).getTime()". As you can see, there are some differences and some similarities.
     
  24. Offline

    Guniv

    how would i set it up so when a player hits a button it executes a command, and automatically adds their name to the command?
     
  25. Offline

    repeat

    missed "teleport" at documentation

    for some commands need good documentation
    playEffect(<triggeringPlayer>,DOOR_TOGGLE)

    Effects:
    BOW_FIRE
    CLICK1
    CLICK2
    DOOR_TOGGLE
    EXTINGUISH
    RECORD_PLAY
    SMOKE
    STEP_SOUND

    BUG1:
    Code:
    trigger:
    name:test,event:onInteract,condition:none,script:test
    
    script:
    /se.v.c string qwe <triggeringPlayer>
    messageTo(<triggeringPlayer>,<qwe>)
    /se.v.d qwe
    
    qwe always null. qwe is valid if remove last line and to second time do onInteract
     
  26. Offline

    Nopants

    @Guniv
    trigger.dat:
    Code:
    name:register,event:onInteract,condition:button,script:register
    button.condition:
    Code:
    equals(<clickedLocation>,<x>;<y>;<z>) #x,y,z have to be the coordinates of the button you want to use
    register.script:
    Code:
    /yourCommand <triggeringPlayer>
    @repeat
    I will try to fix that bug. Also temporary variables are on the to-do-list. They will replace this method of creating and deleting the same variables in one script. Teleport will be added to the main-post within the next release.
     
  27. Offline

    Guniv

    so i just make those all files, link them w/ each other ingame and it should work?
     
  28. Offline

    Nopants

    @Guniv
    All triggers that are in trigger.dat are relevant if the plugin is enabled. The plugin will hook into the events happening on the server and search for triggers with the same event. This means: yes.
    Simply watch where to put the files and do a /se.refresh to load your stuff into the plugin.
     
  29. Offline

    Guniv

    Okay, I added the trigger to trigger.dat, made a condition called redbut.condition (yes, i edited properly in triggers) and since i can't fuck with the scripts folder for some reason I made that one ingame, doing the edit /se.e.e manuadd <triggeringPlayer> red, saving it, doing a refresh to get all the files loaded. Now this error pops up in server.log
    Code:
    2011-07-12 15:23:12 [WARNING] SE: Too many Expressions in line: 1 (redscr.script)
    any idea why?
     
  30. Offline

    Nopants

    Um ... first of all "/se.e.e" is the shortcut for "/se.edit.event".Using "/se.e.e manuadd" makes no sense, as "manuadd" is a command of GroupManager and not a valid event. I assume you used "onInteract" instead, and already set up the script (/se.e.scr) and maybe the condition (/se.e.co) of the trigger as well, because you get an error that is only sent if a script gets executed.

    If you added the line "manuadd <triggeringPlayer> red" (with /se.e.a) to your script, that would explain the error, as you have to begin the line with "/" for server commands. Try deleting the script (or the line) and replacing it with the correct one. That should work.

    Anyway, I think editing scripts ingame is still pretty annoying, isn't it? A command to list all lines of a file and one to add new stuff at certain lines are on the to-do-list.
     

Share This Page