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: Wed Sep 22, 2004 1:27 am   

Two keys to a variable possible?
 
With a data record variable, I know you can store a key and a value, but is it possible to store two keys to a value...?

For example... I've got a script, thanks to a helpful member of this forum, that lets me store a name and associate a number with it... would it be possible to do something similar, only with two numbers per name?
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Wed Sep 22, 2004 1:33 am   
 
No but you can store a stringlist

#ADDITEM recname.valname {addthis}
#VARIABLE recname.valname {one|two|three}
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
rtatum
Novice


Joined: 19 Sep 2004
Posts: 45
Location: Houston

PostPosted: Wed Sep 22, 2004 1:41 am   
 
Ah, well... nevermind, sorry... I figured out that I can store both numbers in one value, but thank you for the answer
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Wed Sep 22, 2004 2:19 am   
 
Ok I had a version that worked but I lost it I will rewrite it when I get back from work
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Wed Sep 22, 2004 1:21 pm   
 
Heavily Modified Phone Command *This is me Bored*

#ALIAS phone {
#IF (%null( "%1")) {~phone}
#IF ("%1"="store") {
#IF (%isnumber( %3)) {
#IF (!%iskey( @phone, %lower( "%2"))) {
#ADDKEY phone {%lower( "%2")} {"%3"}
#SAY Number %3 Stored to %proper( "%2").
} {
#ADDITEM phone.%2 {%3}
#SAY Number %3 Added to %proper( "%2").
}
} {#SAY %3 is not a number}
}
#IF ("%1"="edit") {
#IF (%iskey( @phone, %lower( "%2"))) {
#ADDKEY phone {%lower( "%2")} {"%3"}
#SAY %proper( "%2") Changed to %3
} {#SAY %proper( "%2") Is not a valid record.}
}
#IF ("%1"="delete") {
#DELKEY phone %lower( "%2")
#SAY Deleting %proper( "%2") From Phone Record.
}
#IF ("%1"="call") {~phone call %item( %db( @phone, %lower( "%2")), %if( %null( %3), 1, %3))}
#IF ("%1"="qcall") {~phone call %2}
#IF ("%1"="list") {
#SAY
#LOOPDB @phone {#SAY %if( %mod( %iskey( @phone, %lower( %key)), 2), %ansi( 7) , %ansi( 15))%proper( %key) %repeat( " ", %eval( 20-%len( %key)))%replace( %val, "|", %cr%repeat( " ", 21))%ansi( default)}
}
}

Used Pretty Print
Syntax Colourizer

"Phone Store Name #####" automaticly adds the second(or more) number if the name is already in the Record.
"Phone Edit Name #####" Allows you to change the number(s) to the new number
"Phone Call Name" Calls the first number for name
"Phone Call Name 2" Calls Number the 2nd number from the record. replace 2 with position in list of number to call.
"Phone Qcall ######" Quickley calls a number without adding it. (Plain phone call mud command)
The Phone alias has some simple error checking but in NO way is complete.
The Phone alias uses a DUMB notification system It doesn't check to make sure it worked.
If you need anymore help ask on the forums or PM me.

EDIT: Added in change from post below and also colorized it.
_________________
Zmud Support Library
Zmud Knowledge Base

Last edited by nexela on Tue Oct 05, 2004 6:57 am; edited 1 time in total
Reply with quote
rtatum
Novice


Joined: 19 Sep 2004
Posts: 45
Location: Houston

PostPosted: Wed Sep 22, 2004 10:46 pm   
 
Ahh, very nice... just one visual tweak to phone list I would like to try...
If you have multiple numbers stored to a name, you have it set to display like:

Name-----------numberone - numbertwo
Name2----------numberone

Would it be possible to instead display it like this?

Name-----------numberone
---------------numbertwo
---------------etc......
Name2----------numberone

I like like to have things orderly like that

edit: Well I can't get it to align, but you get the idea... and the dashes are there just because I can't use repeated spaces.... but like it is now, only the new number on the next line instead of the same line
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Thu Sep 23, 2004 1:34 am   
 
#LOOPDB @phone {#SAY %if( %mod( %iskey( @phone, %lower( %key)), 2), %ansi( 7) , %ansi( 15))%proper( %key) %repeat( " ", %eval( 20-%len( %key)))%replace( %val, "|", %cr%repeat(" ",21))%ansi( default)}
_________________
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