How exactly would I got about making this script

Posted by Nick Cash on Wed 10 Dec 2003 05:47 AM — 4 posts, 12,843 views.

USA #0
Alright, well, I had an idea. I was recently going through creating new rooms, in this case vnums 9400 - 9599. I figured I'd write a script to automatically goto each one individually for me, and was activated by a trigger, such as:

You say 'make rooms * *'

So in this example:
You say 'make rooms 9400 9599'

Then the trigger would read 9400 and 9599, then go through a loop and return the vnum that needed to be created. Next, I wanted some kind of trigger or something to goto the vnum, thus, leaving me absolutly no work in creating any of the rooms, and finally go all the way back to 9400.

Now, I am familair with Perl and have used it a few times for things on my web site, but I haven't the faintest clue on how to do this. The script from trigger seams simple enough, but then what about the goto part of it? Is there a way to send mud commands from a script? Or do I need a seperate trigger for it?

Any example I could build off of for this (or working example) would be much appreciated!

Thanks in advance!
Australia Forum Administrator #1
Er, do you mean to create 200 rooms and then go to each one?
That would be simple enough in any language, say in VBscript you might do something like:

for i = cint (wildcards (1)) to cint (wildcards (2))
world.send "make room " & i ' or whatever syntax
next

However I'm not sure what you mean by goto the room. Each one individually?
USA #2
When I say goto I genearlly mean the command goto, which, in this case, is being used to create each room individually.
Australia Forum Administrator #3
Oh well, then do something like this:

for i = cint (wildcards (1)) to cint (wildcards (2))
world.send "goto " & cstr (i)
next


However that is VBscript. Just do the equivalent thing in Perl. There is an example perlscript file in the MUSHclient download. Look at that for how to pull out arguments from an alias.

BTW - you really want an alias rather than a trigger. An alias is something *you* type, which is probably what you want. Then rather than matching on "say makerooms", just make an alias that matches:

makerooms * *