 |
Ryntrax Wanderer
Joined: 15 Mar 2004 Posts: 55 Location: USA
|
Posted: Mon Mar 15, 2004 6:01 pm
Arrays |
Could i get any reccommendations on what else to use besides dual arrays that are linked in order to track 2 variables that have to be associated with each other.
Such as a playername -- and a location.
input
[Player ] - On the road
[Player2 ] - On the path
#TRIGGER {~[%1~] ~- %2} {
What i need to do is store of of these seperately. Should i use list, or try and stick with the refrenced arrays?
Thanks for any help. |
|
|
 |
Danlo Magician

Joined: 28 Nov 2003 Posts: 313 Location: Australia
|
Posted: Mon Mar 15, 2004 6:42 pm |
Just stick with the arrays.
|
|
|
 |
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Mon Mar 15, 2004 7:44 pm |
Use a record-variable, with #ADDKEY and #DELKEY. The playername should be the key and the location should be the value. Use %db, or other database functions, to retrieve the data.
#TRIGGER {~[(*)~] ~- (*)} {#ADDKEY PlayerLocations {%1} {%2}} |
|
|
 |
Ryntrax Wanderer
Joined: 15 Mar 2004 Posts: 55 Location: USA
|
Posted: Mon Mar 15, 2004 8:51 pm |
DB is soooo laggy though but i will try.
My next problem is say i got that same input and i set all the players.
I want to recieve that input again and check to see if it is the same.
I am returning miss match errors i think i got it now though. but
So i can track changes in players. From one to another and if new ones showup. i have an old mm script as a guide
but have converted it to no avail. |
|
|
 |
Carabas GURU

Joined: 28 Sep 2000 Posts: 434 Location: USA
|
Posted: Mon Mar 15, 2004 11:07 pm |
zMUD's database variables can also be referenced just like normal variables. The only difference I've found so far is that database variables do not like nested lists.
Just because you are using database variables, does not mean you are using zMUD's database module.
#VAR Where.Ryntrax "On the road"
#VAR Where.Carabas "On another road"
I'm guessing you are writing a CPK Guard script. The simplest way to do this would be to maintain two lists and associated keys. One list for the previous where list and one for the new one. Just before you do another where, transfer the new list to the old one, nullify the new list and continue to populate it with the new where list.
#TRIGGER {Players in the general vicinity:} {#VAR Where.old @Where.new;#VAR Where.new %null}
#COND {~[(%w)%s~] - (*)} {#ADDITEM Where.new %1;#VAR Where.%1 {%2}}
Then compare the two lists to see who has (suddenly) showed up or left.
You get the idea, right? This kind of script should be fairly simple to write. There are (of course, there always is) more complicated ways of doing it. If you need help with it, you may link me (or my BL) later this evening.
EDIT: I *had* a CPKGuard script for 5.55. If I can find it, you can hack and slash your way through it if you wish. |
|
|
 |
Ryntrax Wanderer
Joined: 15 Mar 2004 Posts: 55 Location: USA
|
Posted: Wed Mar 17, 2004 5:16 pm |
Thanks Carabas I'll link you tonight. I was defenatly over thinking it.
|
|
|
 |
|
|