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
rtatum
Novice


Joined: 19 Sep 2004
Posts: 45
Location: Houston

PostPosted: Sun Sep 19, 2004 9:27 pm   

Help on a script
 
I would like to create an alias called phone that does a few things with a few different paramenters... I'll be detailed here so no questions are left out...

phone - Simply sends the "phone" command to the mud
phone store <name> <number> - Stores <number> and associates it with <name>
phone delete <name> - Deletes the name and associated number
phone call <name> - Sends the command "phone call <number>" where <number> is the number associated with the name
phone list - Displays a list of names with the numbers across from them in a list

I've written a similar script in the past, but I'm just getting back into mudding and I've forgotten nearly everything involved with zMud scripting, so any help would be greatly appreciated, and thank you.
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Mon Sep 20, 2004 1:02 am   
 
Tested and Works
Store and Delete messages are just a dumb process no checking to make sure it stored correctly.
All Names stored will be converted to lowercase automaticly, and displayed with propercase due to case-sensitive values.


#ALIAS phone {
#IF (%null("%1")) {~phone}
#IF ("%1"="store") {#ADDKEY phone {%lower("%2")} {"%3"};#SAY %proper("%2") Stored}
#IF ("%1"="delete") {#DELKEY phone %lower("%2");#SAY %proper("%2") Erased}
#IF ("%1"="call") {~phone call %db(@phone,%lower("%2"))}
#IF ("%1"="list") {#LOOPDB @phone {#SHOW %proper(%key) = %val}}
}
Reply with quote
rtatum
Novice


Joined: 19 Sep 2004
Posts: 45
Location: Houston

PostPosted: Mon Sep 20, 2004 2:06 am   
 
Thanks, just one more question, is there any way to make zMud display a blank line?
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Mon Sep 20, 2004 2:24 am   
 
#SHOW
with no argument
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
rtatum
Novice


Joined: 19 Sep 2004
Posts: 45
Location: Houston

PostPosted: Mon Sep 20, 2004 3:04 am   
 
Okay, I'm sorry... I lied... THIS is the last question: last time I made this sort of script I used LOOPDB just like you did, but I was able to do it in a way where everything lined up all nice and neat, even with names unequal in length by putting space in between the name and number using a certain function that I cannot recall that counted the number of characters in the name... meaning... I'd specify a TOTAL length, and it would count the characters in the name, and fill the rest in with spaces to match the TOTAL I specified... any idea?
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Mon Sep 20, 2004 12:51 pm   
 
Ok lemme think now.......

#LOOPDB @phone {#SAY %proper( %key) %format( &%eval( 20-%len( %key)+%len( %val)).0f, %val)}

Adjust the number 20 to your desired length between key and value

And here is a version with alternating colors:
#LOOPDB @phone {#SAY %if( %mod( %iskey( @phone, %key), 2), %ansi( 7) , %ansi( 15))%proper( %key) %format( &%eval( 20-%len( %key)+%len( %val)).0f, %val)%ansi( default)}

adjust the numbers 7 and 15 to whatever colors you want.
I can get fancier if need be...
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
rtatum
Novice


Joined: 19 Sep 2004
Posts: 45
Location: Houston

PostPosted: Mon Sep 20, 2004 2:41 pm   
 
Thanks for the great help nexela, it is much appreciated, I think that's all I need now
Reply with quote
n30b1u3dr4g0n
Beginner


Joined: 14 Sep 2004
Posts: 18
Location: USA

PostPosted: Mon Sep 20, 2004 8:19 pm   
 
what mud is this for?
_________________
On wings of death, I swoop down and devour the souls of my enemies, laying waste to all I see, turning stone to ashe, and ashe to death.
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Tue Sep 21, 2004 1:07 am   
 
Looks like any mud that uses the command phone call ######
_________________
Zmud Support Library
Zmud Knowledge Base
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