command creation and other global questions

Posted by Daniel P on Fri 20 Feb 2009 05:13 PM — 4 posts, 23,945 views.

USA #0
Alright..this is the first time I've actually tried to admin my own MUSH and it's working fairly well, as far as room and object creation goes. However, I'm having a hard time understanding the global "Master Room," custom command creation and other things.

What does it mean when a user-defined command is global (created in the Master Room)? Does this mean that the command will work wherever you are? Or does it mean that it will work for anyone?

Speaking of custom commands, what is the proper, non-hack (I don't want to bother with compilers, if I can help it because I don't have time to learn C) technique for creating new commands that will apply to all players? I tried the one from the other post <http://www.gammon.com.au/forum/?id=1707>; and created a successful WAVE * function for One (MasterWizard). Now how do I push the wave command to all created players without logging into every single one and "&DO_WAVE me ...?" Would it be a simple "replace 'me' with 'Global Commands' as shown in <http://www.gammon.com.au/forum/?id=1073>;?

Quick question: is the "DO_WAVE" an important programatic term, or is it just a programmatic mnemonic that "everyone uses" and actually could be anything?

On another similar, only different note, I tried the @command examples detailed in HELP @COMMAND3 and received the error that 'That command has not been implemented.'

Okay, I'll quit now, because I think that a lot of these quesions are tied together and may have a single explanation that will fix everything for me.

Thanks.
-Daniel
Australia Forum Administrator #1
I haven't played with PennMUSH for a while, and the PennMUSH site may well give better-informed answers.

However my understanding is that commands put in the "master" room are checked for, if the command cannot be found locally, for all players in all rooms.

So for example, you might make a command "north" which replies "you cannot go that way", to catch rooms that haven't implemented a north direction.

Quote:

Quick question: is the "DO_WAVE" an important programatic term, or is it just a programmatic mnemonic that "everyone uses" and actually could be anything?


No, I just made an object to implement the wave command and decided to call it that.
USA #2
Thanks a ton for a quick answer. I didn't find much on the PennMUSH website but I'll keep checking. I suppose trial and error would be the best teacher of them all..

-Daniel
USA #3
Okay..so just wrapping this up since it got left hanging. And since I managed to figure it out, maybe it'll be useful to someone else who might prefer Penn over...SMAUG?

Custom 'soft-code' commands exist on objects created within the game (like the Bundle of Hay that Nick created in his tutorial or even a room object!)

Every soft-code command is generally called an attribute along with other things like functions, stored text and things called 'listeners.'

The DO_WAVE mentioned earlier is just the name of the attribute. It could be anything like "CMD_WAVE" or "WAVE_YOUR_HANDS_IN_DA_AIR".

The bit before the first ":" and after the "$" in the attribute text is the command that you would type into the game. The bit AFTER the first colon will be the script that is executed as a result of that command.

So to write a custom command, an example would be:
@CREATE Commands
&DO_WAVE Commands = $wave:@pemit %# = You wave.;@oemit %# = %N waves.

"@CREATE Commands" will create a new thing named Commands (a THING is one of the four types of objects, the other three being PLAYER, ROOM and EXIT).

"&DO_WAVE Commands = " is the declaration of a new attribute called DO_WAVE set on the Commands object. The contents of this attribute will be everything after the "=" sign.

"$wave:" says that the command WAVE will execute the following script which is "@pemit %# = You wave;@oemit %# = %N waves." This script basically sends two messages. The first sends "You wave." to the player who called the command and the second sends "<person> waves." to everyone else in the same location as the person.

As for the Master Room (default room #2), any object with a bunch of these commands placed in this room will listen for calls to those commands from anywhere, where-as if that object were anywhere else, only people in its location could execute its commands.

In short:

@create Commands

&DO_WAVE Commands = $wave:@pemit %# = You wave.;@oemit %# = %N waves.

wave

You see -> You wave.
Everyone else sees -> Daniel waves.


Okay. There it is. Finally wrapped up this subject now that I've figured out the initial question.

-Daniel