|
jimbabwe Beginner
Joined: 25 Feb 2002 Posts: 18 Location: USA
|
Posted: Sun Feb 02, 2003 7:53 pm
Capture/Tally Script |
Hi, I am trying to write a script, that will keep a tally on how many times, a character has hit a certain mob. The hard part, is that there will be many characters who hit the mob. I have set up variables, for HOW they can hit the mob, and for what it will say.
Here is the trigger I have, to capture when a person is using a weapon.
#TR {^(%w)~'s~ {@dam1}~ {@dam2}~ (*)~.} {#AD %1 1}
The two variables: The first, is what weapontype, and the second, is the actual dam amount. Two Examples of possible damages, are here:
Players's pierce barely scratches the Executioner.
Players's pound scuffs the Executioner.
Player, naturally, is the character, pierce + pound, is the weapontype, and barely scratches + scuffs, is the dam amount.
Now, the trigger I have keeps a tab of how many times the player (Or Multiple players, it will make a new variable for each) hit's said mob. What I want to know, is if there is a way to record the players name, into like a list, and still keep track of how many times they have hit it. And also a way to use an alias, to call up a list (Via #EC), of the players names, and how many times they have hit the mob. Is this possible? And any help that could be given, would be much appreciated.
M |
|
|
|
Emit Magician
Joined: 24 Feb 2001 Posts: 342 Location: USA
|
Posted: Sun Feb 02, 2003 8:43 pm |
sure, i think i have the solution. besides more complicated solutions involving parallel string lists, arrays, or databases, i think what you'll want to do is use a string list containing the names of each person/variable.
#TR {^(%w)~'s~ {@dam1}~ {@dam2}~ (*)~.} {#AD %1 1;#additem people %1}
then when you want to access the list, try this:
#forall @people {#show %i @{%i}}
--------
moon.icebound.net:9000 |
|
|
|
jimbabwe Beginner
Joined: 25 Feb 2002 Posts: 18 Location: USA
|
Posted: Mon Feb 03, 2003 12:10 am |
Hrm.. One last thing.. is there a way to remove all of the created variables easily? or do I just delete them by hand?
|
|
|
|
Emit Magician
Joined: 24 Feb 2001 Posts: 342 Location: USA
|
Posted: Mon Feb 03, 2003 12:23 am |
sure,
#unvar people
and then when you start again it'll be reset
--------
moon.icebound.net:9000 |
|
|
|
jimbabwe Beginner
Joined: 25 Feb 2002 Posts: 18 Location: USA
|
Posted: Mon Feb 03, 2003 1:06 am |
No.. that just removes the people variable.. every person who hit, becomes a variable.
So their value's still stay the same, if you just remove the people variable. |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Mon Feb 03, 2003 1:44 am |
#FORALL @people {#UNVAR @{%i}}
Of course, you run the risk of someone having a name that matches some other variable you use. That's why "more complicated solutions involving parallel string lists, arrays, or databases" are preferred (because, in the long run they're simpler). Assuming your pattern works
#TR {^(%w)~'s~ {@dam1}~ {@dam2}~ (*)~.} {#AD people.%1 1}
To view the list:
#LOOPDB @people {#SHOW %key %val}
And to clear the list, you can just remove ONE variable (or set it to "" if you prefer):
#UNVAR people
LightBulb
Advanced Member |
|
|
|
jimbabwe Beginner
Joined: 25 Feb 2002 Posts: 18 Location: USA
|
Posted: Mon Feb 03, 2003 1:50 am |
Thanks to both of you :) As for the person having the same name.. I am very careful with things like that, every variable I have, has at least a letter and a number usually, to prevent such accidents. :)
|
|
|
|
Emit Magician
Joined: 24 Feb 2001 Posts: 342 Location: USA
|
Posted: Mon Feb 03, 2003 1:52 am |
quote: No.. that just removes the people variable.. every person who hit, becomes a variable.
So their value's still stay the same, if you just remove the people variable.
whoops, i knew that (think comeon you can do it).
--------
moon.icebound.net:9000 |
|
|
|
|
|
|
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
|
|