[Arcturus] MyCommands Plugin ~ Make your own commands!

Results 1 to 13 of 13
  1. #1
    The **** Keiz is offline
    MemberRank
    Nov 2015 Join Date
    238Posts

    idea [Arcturus] MyCommands Plugin ~ Make your own commands!

    Hi,

    Today I'll release the first operational version of my Arcturus plugin, MyCommands. The plugin allows you to make your own commands without any knowledge of code.

    How does it work?
    Put the MyCommands.jar plugin in your \plugins\ folder, run the server and a table `mycommands` will be automatically made.
    Every row in this table is a different command, customize them however you like.

    How to make a command
    To make a command is incredibly easy. Insert a row, described as follows:

    `aliases` - Set your command keys seperated by ';'.
    Example: welcome;welc;w

    `actions` - Actions seperated by ';'.
    Example: shout Welcome to Habbo, $1! !;wave;wait 0.5;say Have a great time;thumbsup
    Lets understand what's going on here. Every action is run after the other one's finished.
    In this example the user using the command will..
    - shout "Welcome to Habbo, XXX", where XXX is the first param
    - wave
    - the command waits 0.5 seconds before proceeding
    - say Have a great time
    - the user will put their thumbs up

    `minrank` - Minimum rank to run the command
    Example: 1

    `enabled` - Is the command enabled?
    Example: 1

    This command results into
    https://i.gyazo.com/d80f68342edb715c00a66ba25374c424.gif

    How do I use params?
    Params are the given parameters by the user. If a user says ":credits Keiz 1", parameter 1 is Keiz, parameter 2 is "1"
    Your commands made with MyCommands can use those parameters however you like!
    In an action, use the dollar-sign followed by the requested parameter count.
    To use parameter one you use "$1", to use parameter two you use "$2".
    To use the user's username use "$player".
    If you require a certain parameter, (so it can't be empty), add a exclamation mark (!) after the parameter. For instance, this action: "say The word $1! was my first parameter" will check if a parameter is given. If not, the action will not execute.
    There's an option to use all the given parameters too, use "$all".

    In short:
    - $X = parameter X
    - $X! = parameter X, and is required to execute the action ( if you want just to say parameter 1, and have an exclamation mark afterwards, use $X\! )
    - $all = All parameters
    - $player = The player's username

    Different actiontypes
    Your commands can have as many actions as you like, but what actions can I use? We've seen some above, like "say", "wait", "shout".. Here's a complete list for version 1.0.0.
    All types are followed with a description and an example usage.

    - ":"    
    Make the user run a command. :stalk $1
    - "message"
    Send the user an alert.   message What's up, $player?
    - "whisper"
    Send the user a whisper.  whisper Psst..
    - "handitem"  Give the user a handitem.  handitem 1
    - "dance"  
    Dance (1-5)      dance 3
    - "enable"  
    Enable an effect    enable 13
    - "wait"  
    Wait X secs before continuing wait 2.5
    - "hotelalert" Send a hotel alert    hotelalert Make sure to check out the news daily!
    - "say"    Make the user say something  say My parameters were: $all
    - "shout"   Make the user shout something shout Hey, $1!
    - "giveitem"  Give the user items by name  giveitem throne 3 (give the user 3 thrones)
    - "wave"   Wave       wave
    - "kiss"
    Blow kiss      kiss
    - "laugh"  
    Laugh       laugh
    - "thumbsup" Thumbs up      thumbsup

    New actiontypes can be requested in the comments, for now this must be enough to play with.
    Do share your creations with us in the comments, I'll make sure to add them to the thread.

    Reloading commands
    Reloading your custom commands can be done with the :mycommands, or :myc for short, command.
    The permission necessary for this command is cmd_update_config.


    Download

    v1.1.1
    http://forum.ragezone.com/f353/arctu...2/#post8833782

    Loves,

    Keiz
    Last edited by Keiz; 06-11-17 at 11:59 PM.


  2. #2
    Check http://arcturus.pw The General is offline
    DeveloperRank
    Aug 2011 Join Date
    7,607Posts

    Re: [Arcturus] MyCommands Plugin ~ Make your own commands!

    Thats pretty cool.

    Any chance you could put the source code up on a git repo so maybe people can make pull requests to extend it even further.

    Maybe you can look into how minecraft does commandblocks. It allows for some pretty great logic and interaction with plenty of interactions.

    Also a few suggestions might be;

    Forward <roomid>
    Teleport to <x> <y>
    Walk to <x> <y>
    Look at point <x> <y>
    Rotate body <rotation>
    Rotate head <rotation>

    (I need to refactor some code so these will be functions in Acrturus that will also handle the packet updates so you dont have to do that)

    Let me know if you need more events added to Arcturus :)

    I hope your wait command does not use sleep() as it would lock the thread and if say 20 people run the command it will freeze your hotel. (Its how the Java threadpool works)
    Last edited by The General; 02-11-17 at 03:43 PM.

  3. #3
    Valued Member Harmonic is offline
    MemberRank
    Jun 2012 Join Date
    149Posts

    Re: [Arcturus] MyCommands Plugin ~ Make your own commands!

    Amazing release!
    Here's an example of the :smokeweed command I made:

    say *$player Rolls a spliff*;wait 1.0;laugh;wait 3.5;say *$player Lights The Joint*;:enable 26;wait 1.0;say *$player Smokes the Joint*;wait 10.0;:enable 53;shout *$player is very dizzy*;wait 20.0;:enable 0

    Could I suggest this for the future?

    alert $player content here
    motdalert $player content here (:commands style alert etc.)
    and perhaps a way to do if statements, for example:

    I've added :dance and it says Please add an ID to use this command.) but :dance 1 makes it activate dance instead of :dance 1 etc.

  4. #4
    Developer BurakDev is offline
    MemberRank
    Mar 2013 Join Date
    ParisLocation
    376Posts

    Re: [Arcturus] MyCommands Plugin ~ Make your own commands!

    Nice plugin !

    Quote Originally Posted by The General View Post
    I hope your wait command does not use sleep() as it would lock the thread and if say 20 people run the command it will freeze your hotel. (Its how the Java threadpool works)
    Code:
    case WAIT:         double secs = Double.parseDouble(currentAction.substring(5));        if (secs <= 0.0D)          return;        Thread.sleep((secs * 1000.0D));        return;
    He use sleep, this part need some improve.

  5. #5
    The **** Keiz is offline
    MemberRank
    Nov 2015 Join Date
    238Posts

    Re: [Arcturus] MyCommands Plugin ~ Make your own commands!

    Quote Originally Posted by BurakDev View Post
    Nice plugin !



    Code:
    case WAIT:         double secs = Double.parseDouble(currentAction.substring(5));        if (secs <= 0.0D)          return;        Thread.sleep((secs * 1000.0D));        return;
    He use sleep, this part need some improve.
    Thanks for your comment,
    will be fixed in the following version.
    v1.1.0 will also contain if statements, cooldown on commands and some other new useful features.

  6. #6
    iiiiiiiiiii Brought is offline
    MemberRank
    Aug 2013 Join Date
    469Posts

    Re: [Arcturus] MyCommands Plugin ~ Make your own commands!

    Fantastic release as always, my friend. I was surprised to see you releasing any new content. Glad to see you contributing some of your work.

  7. #7
    Alpha Member Glee is offline
    MemberRank
    Jun 2009 Join Date
    Niagara Falls,Location
    2,225Posts

    Re: [Arcturus] MyCommands Plugin ~ Make your own commands!

    Amazing Job!!

    ~

    Thank You for helping with Arcturus! :)

  8. #8
    You looking at me? Zoxq is offline
    MemberRank
    Dec 2015 Join Date
    336Posts

    Re: [Arcturus] MyCommands Plugin ~ Make your own commands!

    Glad you continued this!
    Nice end result, keep it up.

  9. #9
    The **** Keiz is offline
    MemberRank
    Nov 2015 Join Date
    238Posts

    Re: [Arcturus] MyCommands Plugin ~ Make your own commands!

    Version 1.1.1 is here
    Thanks NextGenHabbo.com for testing the plugin and reporting bugs. (Add my Skype if you're using this plugin too and request new features)

    Changelog

    v1.1.0
    Added if/endif statements
    Added "stop" action (stops the command, not the server)
    Renamed "message" action to "alertme"
    Added "alertuser [username] [message]"
    Added "rankalert [minrank] [message]" action
    Added $argcount variable in if statements
    Added "make [user] [action]" (make another user run a MyCommands action)
    Recoded "wait" action to use delayed Runnables in stead of Thread.sleep()
    Added lightweight ProfileManager to store cooldowns (can be stored more later on)
    Added cooldown per command

    v1.1.1
    Added $user([username]).[variable] variables
    Added nested if-statement functionality (if's within if's)
    If/endif statements
    The requested if functionality is now for you to test. MyCommands supports if/endif's within if/endif's.
    The "if" action requires exactly three parameters. The first parameter being your first variable, the second parameter being a relational operator, and the third one being your second variable.
    Here are some examples:
    Code:
    if $argcount < 1;whisper Please provide an argument;stop;endif;whisper Your argument was $1
    if $1 == yes;whisper Your first argument was "yes";endif
    if yes == Yes;whisper This is true;endif
    if yes === Yes;whisper This is false, the "===" operator is case-sensitive.;endif
    if $user($player).credits > 10000;if $user($player).gender == male;say I'm a rich man;stop;endif;say I'm a rich girl;stop;endif;I'm a poor $user($player).gender...
    Different operators
    There are some different logical relational operators.
    Code:
    == / is  -> Equals without case sensitivity
    ===   -> Equals with case sensitivity
    != / not  -> Equals not (without case sensitivity)
    !==   -> Equals not (with case sensitivity)
    >    -> Greater than
    >=    -> Greater than or equal to
    <    -> Less than
    <=    -> Less than or equal to
    After your if [variable1] [operator] [variable2] action, insert all actions that must be run if the if-statement passes. End your latest stated if-statement with the endif action.
    If you want to check some variables that must be true to run the command, you can use the stop action within an if/endif.
    Example (same as above):
    if $argcount < 1;whisper Please provide an argument;stop;endif;whisper Your argument was $1

    The make action
    The make action allows you to let another user than the command-executor to run a MyCommands action. Here's a complex example, let's make a user say "I'm stupid", as long as they're online, not myself, in the same room, and have the the same rank:
    if $user($1).id == $null;whisper Couldn't find user '$1';stop;endif;if $1 == $player;whisper Can't make yourself do something..;stop;endif;if $user($1).room != $user($player).room;whisper You are not in the same room as $1;stop;endif;if $user($1).rank > $user($player).rank;whisper Can't run this on people with higher ranks than yours.;stop;endif;make $1 say I'm stupid

    To clarify:
    Code:
    if $user($1).id == $null;
     whisper Couldn't find user '$1';
     stop;
    endif;
    if $1 == $player;
     whisper Can't make yourself do something..;
     stop;
    endif;
    if $user($1).room != $user($player).room;
     whisper You are not in the same room as $1;
     stop;
    endif;
    if $user($1).rank > $user($player).rank;
     whisper Can't run this on people with higher ranks than yours.;
     stop;
    endif;
    make $1 say I'm stupid

    $user([username]).[variable] variable's
    $user variables are useful for dynamic commands. Use them in if's and any other action.
    Variable list
    Code:
    $user(Keiz).id   -> User's id or $null
    $user(Keiz).username -> User's username or $null
    $user(Keiz).credits  -> User's credits or $null
    $user(Keiz).rank  -> User's rank or $null
    $user(Keiz).gender  -> User's gender (male / female) or $null
    $user(Keiz).room  -> User's current room id or $null if not online or not in room

    Nested if/else & runnable delay snippet

    Spoiler:

    Code:
     @Override
     public void run() 
     {
      for(; this.index < this.actions.length; this.index++)
      {
       CustomAction action = this.actions[this.index];
       if(this.currentIfs.size() > 0)
       {
        if(!this.currentIfs.get(this.currentIfs.size() - 1).booleanValue())
        {
         if(action.type == ActionType.IF_STATEMENT)
         {
          this.currentIfs.add(false);
         }
         else if(action.type == ActionType.ENDIF_STATEMENT)
         {
          this.currentIfs.remove(this.currentIfs.size() - 1);
         }
         continue;
        }
       }
       
       if(action.type == ActionType.STOP)
        break;
    
       if(client != null)
       {
        if(client.getHabbo() != null)
        {
         if(client.getHabbo().getRoomUnit() != null)
         {
          ActionState state = action.handle(client, args);
          
          if(state == ActionState.IF_PASS || state == ActionState.IF_BLOCK)
          {
           this.currentIfs.add(state == ActionState.IF_PASS);
           continue;
          }
          else if(state.getValue() >= 10000)
          {
           int ms = state.getValue() - 10000;
           
           this.index++;
           Emulator.getThreading().run(this, ms);
           
           return;
          }
           
         }
        }
       }
      }
      this.profile.inCommand = false;
     }


    Download v1.1.1
    Update query
    Code:
    ALTER TABLE `mycommands` ADD `cooldown` INT(4) NOT NULL DEFAULT '3' AFTER `enabled`;
    Link
    https://mega.nz/#!5mQTUYqI!Z5DyWeLH7...hwbwsDt-KxiiSg

  10. #10
    Novice HolaCMS is offline
    MemberRank
    Jul 2017 Join Date
    3Posts

    Re: [Arcturus] MyCommands Plugin ~ Make your own commands!

    will this receive any more updates?

  11. #11
    Apprentice Chromium9 is offline
    MemberRank
    Aug 2019 Join Date
    9Posts

    Re: [Arcturus] MyCommands Plugin ~ Make your own commands!

    Quote Originally Posted by HolaCMS View Post
    will this receive any more updates?
    From what i saw in Arcturus Discord for this plugin probably not, no.
    Anyone got the missing text key?
    Code:
    [TEXTS] Text key not found: myplugins.missing_params

  12. #12
    Apprentice Argutus is offline
    MemberRank
    Nov 2016 Join Date
    7Posts

    Re: [Arcturus] MyCommands Plugin ~ Make your own commands!

    The Download link is broken

  13. #13
    Proficient Member harbihotel is offline
    MemberRank
    Jul 2008 Join Date
    PortugalLocation
    194Posts

    Re: [Arcturus] MyCommands Plugin ~ Make your own commands!

    Does anyone have a backup of this?



Advertisement