Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[Arcturus] MyCommands Plugin ~ Make your own commands!

Experienced Elementalist
Joined
Nov 11, 2015
Messages
238
Reaction score
89
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

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/arct...own-commands-1140372-post8833782/#post8833782

Loves,:blushing:
Keiz
 
Last edited:
Joined
Aug 10, 2011
Messages
7,398
Reaction score
3,301
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:
Junior Spellweaver
Joined
Jun 29, 2012
Messages
143
Reaction score
187
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.
 
Skilled Illusionist
Joined
Mar 26, 2013
Messages
371
Reaction score
280
Nice plugin !

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.
 
Experienced Elementalist
Joined
Nov 11, 2015
Messages
238
Reaction score
89
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.
 
Elite Diviner
Joined
Aug 4, 2013
Messages
466
Reaction score
169
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.
 
Skilled Illusionist
Joined
Dec 24, 2015
Messages
336
Reaction score
31
Glad you continued this!
Nice end result, keep it up.
 
Experienced Elementalist
Joined
Nov 11, 2015
Messages
238
Reaction score
89
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:
[COLOR=#000000]if $argcount < 1;whisper Please provide an argument;stop;endif;whisper Your argument was $1[/COLOR]
[COLOR=#000000]if $1 == yes;whisper Your first argument was "yes";endif[/COLOR]
[COLOR=#000000]if yes == Yes;whisper This is true;endif[/COLOR]
[COLOR=#000000]if yes === Yes;whisper This is false, the "===" operator is case-sensitive.;endif[/COLOR]
[COLOR=#000000]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...[/COLOR]
Different operators
There are some different logical relational operators.
Code:
[COLOR=#000000]== / is  -> Equals without case sensitivity[/COLOR]
[COLOR=#000000]===   -> Equals with case sensitivity[/COLOR]
[COLOR=#000000]!= / not  -> Equals not (without case sensitivity)[/COLOR]
[COLOR=#000000]!==   -> Equals not (with case sensitivity)[/COLOR]
[COLOR=#000000]>    -> Greater than[/COLOR]
[COLOR=#000000]>=    -> Greater than or equal to[/COLOR]
[COLOR=#000000]<    -> Less than[/COLOR]
[COLOR=#000000]<=    -> Less than or equal to[/COLOR]

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:
[COLOR=#000000]if $user($1).id == $null;[/COLOR]
[COLOR=#000000] whisper Couldn't find user '$1';[/COLOR]
[COLOR=#000000] stop;[/COLOR]
[COLOR=#000000]endif;[/COLOR]
[COLOR=#000000]if $1 == $player;[/COLOR]
[COLOR=#000000] whisper Can't make yourself do something..;[/COLOR]
[COLOR=#000000] stop;[/COLOR]
[COLOR=#000000]endif;[/COLOR]
[COLOR=#000000]if $user($1).room != $user($player).room;[/COLOR]
[COLOR=#000000] whisper You are not in the same room as $1;[/COLOR]
[COLOR=#000000] stop;[/COLOR]
[COLOR=#000000]endif;[/COLOR]
[COLOR=#000000]if $user($1).rank > $user($player).rank;[/COLOR]
[COLOR=#000000] whisper Can't run this on people with higher ranks than yours.;[/COLOR]
[COLOR=#000000] stop;[/COLOR]
[COLOR=#000000]endif;[/COLOR]
[COLOR=#000000]make $1 say I'm stupid[/COLOR]

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

Nested if/else & runnable delay snippet

Code:
[COLOR=#000000] @Override[/COLOR]
[COLOR=#000000] public void run() [/COLOR]
[COLOR=#000000] {[/COLOR]
[COLOR=#000000]  for(; this.index < this.actions.length; this.index++)[/COLOR]
[COLOR=#000000]  {[/COLOR]
[COLOR=#000000]   CustomAction action = this.actions[this.index];[/COLOR]
[COLOR=#000000]   if(this.currentIfs.size() > 0)[/COLOR]
[COLOR=#000000]   {[/COLOR]
[COLOR=#000000]    if(!this.currentIfs.get(this.currentIfs.size() - 1).booleanValue())[/COLOR]
[COLOR=#000000]    {[/COLOR]
[COLOR=#000000]     if(action.type == ActionType.IF_STATEMENT)[/COLOR]
[COLOR=#000000]     {[/COLOR]
[COLOR=#000000]      this.currentIfs.add(false);[/COLOR]
[COLOR=#000000]     }[/COLOR]
[COLOR=#000000]     else if(action.type == ActionType.ENDIF_STATEMENT)[/COLOR]
[COLOR=#000000]     {[/COLOR]
[COLOR=#000000]      this.currentIfs.remove(this.currentIfs.size() - 1);[/COLOR]
[COLOR=#000000]     }[/COLOR]
[COLOR=#000000]     continue;[/COLOR]
[COLOR=#000000]    }[/COLOR]
[COLOR=#000000]   }[/COLOR]
[COLOR=#000000]   [/COLOR]
[COLOR=#000000]   if(action.type == ActionType.STOP)[/COLOR]
[COLOR=#000000]    break;[/COLOR]

[COLOR=#000000]   if(client != null)[/COLOR]
[COLOR=#000000]   {[/COLOR]
[COLOR=#000000]    if(client.getHabbo() != null)[/COLOR]
[COLOR=#000000]    {[/COLOR]
[COLOR=#000000]     if(client.getHabbo().getRoomUnit() != null)[/COLOR]
[COLOR=#000000]     {[/COLOR]
[COLOR=#000000]      ActionState state = action.handle(client, args);[/COLOR]
[COLOR=#000000]      [/COLOR]
[COLOR=#000000]      if(state == ActionState.IF_PASS || state == ActionState.IF_BLOCK)[/COLOR]
[COLOR=#000000]      {[/COLOR]
[COLOR=#000000]       this.currentIfs.add(state == ActionState.IF_PASS);[/COLOR]
[COLOR=#000000]       continue;[/COLOR]
[COLOR=#000000]      }[/COLOR]
[COLOR=#000000]      else if(state.getValue() >= 10000)[/COLOR]
[COLOR=#000000]      {[/COLOR]
[COLOR=#000000]       int ms = state.getValue() - 10000;[/COLOR]
[COLOR=#000000]       [/COLOR]
[COLOR=#000000]       this.index++;[/COLOR]
[COLOR=#000000]       Emulator.getThreading().run(this, ms);[/COLOR]
[COLOR=#000000]       [/COLOR]
[COLOR=#000000]       return;[/COLOR]
[COLOR=#000000]      }[/COLOR]
[COLOR=#000000]       [/COLOR]
[COLOR=#000000]     }[/COLOR]
[COLOR=#000000]    }[/COLOR]
[COLOR=#000000]   }[/COLOR]
[COLOR=#000000]  }[/COLOR]
[COLOR=#000000]  this.profile.inCommand = false;[/COLOR]
[COLOR=#000000] }[/COLOR]

Download v1.1.1
Update query
Code:
[COLOR=#000000]ALTER TABLE `mycommands` ADD `cooldown` INT(4) NOT NULL DEFAULT '3' AFTER `enabled`;[/COLOR]
Link

 
Newbie Spellweaver
Joined
Aug 12, 2019
Messages
9
Reaction score
0
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
 
Back
Top