Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
avidal
Beginner


Joined: 04 Jun 2002
Posts: 23

PostPosted: Tue Jun 04, 2002 6:43 pm   

Porting script help[clearing/creating aliases]
 
I play WoTMUD (wotmud.org:2222), and the magic user's on this mud (called 'channelers') are able to port (called 'travel') to different places, depending on a certain portcode. These codes change everytime the MUD month changes, and there is 1 of 3 global messages displayed everytime the month changes. Most channelers set MUD aliases with a descriptive name for each port code that they have (travelling to caemlyn will be done with an alias called, for instance, portcaem), but if the MUD month changes, and you try to travel with an old code, you'll randomly travel somewhere, which is usually a bad thing :D

Everytime the mud month changes, one of the following 3 global messages are displayed:

The Wheel turns slightly to the Dark.
The Wheel turns slightly to the Light.
The Wheel turns slowly.

If you're offline during the month change, you can check the current month using the "time" command, and the time is displayed in the following format:

It is 1 o'clock am, on the 6th day of the month of Saban, year 454.

I'm looking for a script that will:

-create individual aliases for all new port codes, perhaps a port alias that will take the first param as the travel alias name, and the second as the code (i.e. port portcaem thisisthecaemportcode would make an alias in zMUD called portcaem, that, when entered, will execute the command "channel 'travel' thisisthecaemportcode")

-on each new month, make all the travel aliases unusable (reset/delete them, i suppose), as well as update the @month variable to the current month (in case the mud month changes while you're offline, since you won't get the month change messages)

-everytime you logon, check the current mud month and if it's not the same as the @month var, reset all the travel aliases as well as the @month var to reflect the new month.

I believe this is enough information, if not, please tell me and I'll tell you what you may need to know. Thanks in advance, Alex.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Tue Jun 04, 2002 10:02 pm   
 
#CLASS AutoPort
#AL port {#CLASS Ports;#AL %1 %2;#CLASS 0}
#TR {^The Wheel turns} {#SEND time}
#TR {^It is %d o'clock %x, on the %x day of the month of (%w), year %d.$} {#IF ("%1"!=@month) {#DELCLASS Ports;month="%1";#ECHO Time to update port codes.}
#CLASS 0

You will have to issue the time command yourself after you connect, or put it in a trigger on some message that occurs shortly after you connect.
Reply with quote
avidal
Beginner


Joined: 04 Jun 2002
Posts: 23

PostPosted: Wed Jun 05, 2002 4:42 pm   
 
Thanks :D

Haven't tested it, but it looks good.

One question though:

#AL port {#CLASS Ports;#AL %1 %2;#CLASS 0}

As I understand, with the port alias, if I type in "port caem thisisthecaemcode" it'll create an alias called caem, with the value thisisthecaemcode. That won't work to port, since the syntax is "channel 'travel' thisisthecaemcode". What I'm wonder is, would this work:

#AL port {#CLASS Ports;#AL %1 channel 'travel' %2;#CLASS 0}

Or would I need something to enclose the "channel 'travel' %2" part?
Reply with quote
dacheeba
Adept


Joined: 29 Oct 2001
Posts: 250

PostPosted: Wed Jun 05, 2002 4:56 pm   
 
#AL port {#CLASS Ports;#AL %1 {channel 'travel' %2};#CLASS 0}
Reply with quote
avidal
Beginner


Joined: 04 Jun 2002
Posts: 23

PostPosted: Wed Jun 05, 2002 5:00 pm   
 
Yeah, I figured that part out myself.

Testing the script now, only problem I'm getting is with the #IF statement. It doesn't seem to want to work in ver. 6.16

For some reason, the #IF statement goes from:

{#IF ("%1"!=@month) {#DELCLASS Ports;month="%1";#ECHO Time to update port codes.}

To this:

{{#IF}
Reply with quote
dacheeba
Adept


Joined: 29 Oct 2001
Posts: 250

PostPosted: Wed Jun 05, 2002 5:09 pm   
 
#TR {^It is %d o'clock %x, on the %x day of the month of (%w), year %d.$} {#IF ("%1"!=@month) {#DELCLASS Ports;month="%1";#ECHO Time to update port codes.}}

He left out a curley brace. Try that :)
Reply with quote
avidal
Beginner


Joined: 04 Jun 2002
Posts: 23

PostPosted: Wed Jun 05, 2002 5:11 pm   
 
Nvm, figured that one out as well. Took me a second, but I noticed that there was no closing bracket on the IF statement.

Complete script, if anyone cares, is this:

#CLASS AutoPort
#AL port {#CLASS Ports;#AL %1 {channel 'travel' %2};#CLASS 0}
#TR {^The Wheel turns} {#SEND time}
#TR {You could not afford your rent!} {#SEND time}
#TR {You receive your change from rent.} {#SEND time}
#TR {^It is %d o'clock %x, on the %x day of the month of (%w), year %d.$} {#IF ("%1"!=@month) {#DELCLASS Ports;month="%1";#ECHO Time to update port codes.}}
#CLASS 0
Reply with quote
NiteTrip
Novice


Joined: 21 May 2002
Posts: 40
Location: Canada

PostPosted: Wed Jun 05, 2002 10:31 pm   
 
i play on apoc, and the port system is similar, only the the codes never change.

how it works is that you cast a spell in a room, and it reveals the "room name" which is basically random letters, like asdfghj. I believe this is how yours works, tho I could be wrong. you cast a spell in a room, it returns a room name, then you can travel to the room name, with the correct spell.

soooo, I created this little script to capture these room names automatically.

Here it is:

#alias {bind} {cast 'locate shadow plane';#var roomname {%1}}
#trigger {'(*)' briefly appears as you see shadows twirl into a portal out of the corner of your eyes} {#var @roomname {%1}}
#alias {port} {cast 'shadow walk' @%1}

So basically this is how to use it:

I type

bind fountain

This calls my bind alias, and with it it casts 'Locate shadow plane'
Which is my spell to find the room name. then the following message appears:
'Fgjbfei' briefly appears as you see shadows twirl into a portal out of the corner of your eyes.
SO what the script then does is trigger off this message, and stores Fgjbfei into the variable name i type after bind, in this case it's fountain.

In order for me to travel there i type this line:

port fountain

This calls the port alias and casts my travel spell, which is "shadow walk" to the value of the variable after the port command, in this case it's fountain. So it casts 'shadow walk' @fountain and @fountain expands to Fgjbfei, so in essence i am casting 'shadow walk' Fgjbfei

Get it?

Hope it helps.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Wed Jun 05, 2002 11:20 pm   
 
Sorry about all the typos, I was a bit blind that day since my glasses got dropped off a roof. Glad someone was around to pick up the slack, and that you had enough knowledge to fix the YTPOs.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net