Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Perlscript ➜ How exactly would I got about making this script

How exactly would I got about making this script

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Nick Cash   USA  (626 posts)  Bio
Date Wed 10 Dec 2003 05:47 AM (UTC)
Message
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!

~Nick Cash
http://www.nick-cash.com
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #1 on Wed 10 Dec 2003 10:11 AM (UTC)
Message
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?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Cash   USA  (626 posts)  Bio
Date Reply #2 on Wed 10 Dec 2003 09:12 PM (UTC)
Message
When I say goto I genearlly mean the command goto, which, in this case, is being used to create each room individually.

~Nick Cash
http://www.nick-cash.com
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #3 on Wed 10 Dec 2003 09:29 PM (UTC)
Message
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 * *

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


9,822 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.