[MECH] ScriptedEvents [SUBMITTED]

Discussion in 'WIP and Development Status' started by Nopants, May 27, 2011.

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

    Nopants

    ScriptedEvents:
    Version: v1.0
    This is a work in progress!




    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.
    How many different things those programms could do depends on this plugin and other plugins a server is running that provide commands.

    Features:
    • Create/delete/edit Triggers that will be released on events
    • List of events:
      • onEnter(cuboid-ID)
      • onLeave(cuboid-ID)
      • onInteractAt(location) #works with buttons, levers, everything!
      • onCommand(command)
    • Create/delete/edit Cuboids
    • Create/delete/edit Scripts
    • Execute Scripts containing server-commands and custom functions
    • List of custom functions:
      • delay(milliseconds)
      • trigger(trigger-ID)
      • <triggeringPlayer>
      • <triggeringCuboid>
      • <triggeringItem>
    • Create/delete/edit Conditions that have to be fulfilled if a script should be executed
    • List of conditions:
      • equals(<StringX>,<StringY>)
      • bigger(<biggerInteger>,<smallerInteger>)
      • and(<firstCondition>,<secondCondition>)
      • or(<firstCondition>,<secondCondition>)
    • Create/delete/edit Variables (Integer or String)
    By adding more and more events, actions, 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.

    How things work in ScriptedEvents (open)
    Triggers:
    If a trigger is released, it will check if it's conditions are fulfilled. If the are it executes all commands listed 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 not start commands with the typical '/'. There are some further 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. Conditions also have to get added to a trigger with a texteditor. 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 are 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'.

    Usage:
    Run the Plugin and it will create all necessary files.

    Code:
    # create a new cuboid with the name 'myNewCuboid'
    /SE.cuboid.create myNewCuboid
    # get into Edit-Mode for the cuboid with the ID '1'
     /SE.cuboid.edit 1
    
    # create a new blank trigger with the name 'myNewTrigger'
    /SE.trigger.create myNewTrigger
    
    # get into Edit-Mode for the trigger with the ID '1'
     /SE.trigger.edit 1
    # 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 with the ID '1'
    /SE.script.edit 1
    # 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 PlayerName Notch
    
    # create a new blank condition-file with the name 'myNewConditions'
    /SE.condition.create myNewConditions
    
    # get into Edit-Mode for the condition-file with the ID '1'
    /SE.condition.edit 1
    # 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
    
    

    Examples that can already be done:
    Code:
    Make a command-alias:
    1. Make a script that contains the command you want to have an alias of. add some more commands if you want.
    2. Make an onCommand(yourCommand)-trigger and link your script to it.
    
    Make a button that tells you the ID of an item:
    1. Make an onInteractAt()-trigger for the location of a button.
    2. link a script that does tell you, with what item you interact with the button.
    
    Define important places and send a message with their names, if a player enters or leaves them:
    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.
    

    Commands:
    Code:
    /SE.help [page]                                  or /se.h
    /SE.debug                                        or /se.d
    
    /SE.cuboid.create <cuboid-name>                  or /se.c.s
    /SE.cuboid.delete <cuboid-id>                    or /se.c.d
    /SE.cuboid.getID <cuboid-name>                   or /se.c.id
    /SE.cuboid.edit <cuboid-id>                      or /se.c.e
    
    /SE.trigger.create                               or /se.t.c
    /SE.trigger.delete <trigger-id>                  or /se.t.d
    /SE.trigger.getID <trigger-name>                 or /se.t.id
    /SE.trigger.edit <trigger-id>                    or /se.t.e
    
    /SE.script.create                                or /se.s.c
    /SE.script.delete <script-id>                    or /se.s.d
    /SE.script.getID <script-name>                   or /se.s.id
    /SE.script.edit <script-id>                      or /se.s.e
    
    /SE.variable.create <int|string> <name> <value>  or /se.v.c
    /SE.variable.delete <name>                       or /se.v.d
    /SE.variable.edit <name> <value>                 or /se.v.e
    
    /SE.edit.name <new trigger-name/new cuboid-name> or /se.e.n
    /SE.edit.script <trigger-script>                 or /se.e.scr
    /SE.edit.event <trigger-event>                   or /se.e.e
    /SE.edit.entity <location/cuboid-id/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.c
    

    Custom script-functions
    Code:
    1. <triggeringPlayer> will be dissolved to the name of the player, who releases the trigger the script is executed by.
    2. <triggeringCuboid> will be dissolved to the name of the cuboid the trigger is released by
    3. <triggeringItem> will be dissolved to Item:'Id of the triggering Item', if used on an onInteractAt()-Event.
    4. messageTo(<PlayerName>) sends a message to a player without the additional output of the /say command.
    5. delay(1000) pauses the script by '1' second.
    6. trigger(1) releases the trigger with the ID '1'
    

    READ BEFORE USING:
    This is a work in progress. That means that some features of the plugin might not work as they should and exceptions may occur while using this plugin. If you want to help out, post exceptions here and i will fix them as soon as possible.

    Download
    ScriptedEvents (JAR) HERE.
    An example script HERE.
    An example condition HERE.

    Changelog (open)

    • 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
     
  2. Offline

    MatCat

    Im going to keep my eye on this
     
  3. Offline

    EggRoll

    I like this, seems simple enough.
     
  4. Offline

    Phil3004

    I am totally going to use this !
     
  5. Offline

    Nopants

    I've fixed some bugs and added some stuff.

    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
     
  6. Offline

    Nopants

    To enhance the usability i added an Edit-Mode, in which you can edit triggers and cuboids. the good thing about it is, you can go into Edit-Mode for a specific entity, change it, save or cancel the changes, and do all that ingame. As a side-effect of that, you can now create all kinds of triggers completely ingame.

    Version 0.4
    • added Edit-Mode
    • reworked parts of the code
     
  7. Offline

    Nopants

    Scripts are now loaded into the plugin onEnable. They can now be created ingame! From now on the hole functionality of the plugin can be reached from inside the game, so there is no urgent need to change files in a separate editor. Scripts can also be edited via the Edit-Mode. However only the command to add actions to a script is available at this point.

    Version 0.4.5
    • scripts get loaded into the plugin
    • scripts can be created ingame
    • actions can be added to scripts via Edit-Mode
     
  8. Offline

    Nopants

    Introducing: Conditions!
    Conditions will be checked before a trigger will execute it's script-file. This means, that you can check if a <triggeringPlayer> equals a specific name, or a <triggeringItem> equals the item-ID of your choice. For now conditions are static, as the plugin cannot handle variables yet. However, this will get implemented after the conditions can get created ingame.

    Plus: I'm starting to loose confidence that "enough" people will use this plugin. Personally i think it is great to play arround with it's functionality, but right now i don't feel like this will be enough to keep me motivated. A few supporting words by some other forum-users would be very appreciated!

    • 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()
     
  9. Offline

    Phil3004

    Plus: I'm starting to loose confidence that "enough" people will use this plugin. Personally i think it is great to play arround with it's functionality, but right now i don't feel like this will be enough to keep me motivated. A few supporting words by some other forum-users would be very appreciated!

    NONONONONO
    if you release it alot and i mean alot of People will use this, not everyone is looking in the Wip Forum...
     
  10. Offline

    fullwall

    @Nopants - it's a pretty limited audience in the WIP section - when you want populartity, then you move to submissions :). This is a nice idea.
     
  11. Offline

    Nopants

    @fullwall
    @Phil3004

    Thanks for your support! It did make me continue developing and submitting the plugin! :)
     
Thread Status:
Not open for further replies.

Share This Page