|
dazed-n-confused Novice
Joined: 14 Jan 2004 Posts: 31
|
Posted: Tue Jan 20, 2004 10:33 am
getting multiple lines into variables |
You take stock of your demonic entourage.
Pestilence10137 Health: 970 out of 970. Mind: Nobody.
Imp35316 Health: 2170 out of 2170. Mind: Nobody.
Balrog43420 Health: 9420 out of 9420. Mind: Nobody.
Slime47958 Health: 1270 out of 1270. Mind: Nobody.
Slime47987 Health: 1270 out of 1270. Mind: Nobody.
Balrog49994 Health: 9420 out of 9420. Mind: Nobody.
Slime50183 Health: 1270 out of 1270. Mind: Nobody.
Slime50300 Health: 1270 out of 1270. Mind: Nobody.
Slime57745 Health: 1270 out of 1270. Mind: Nobody.
Parasite58281 Health: 2020 out of 2020. Mind: Nobody.
Parasite60919 Health: 2020 out of 2020. Mind: Nobody.
Seeker37831 Health: 3220 out of 3220. Mind: Nobody.
Storm60232 Health: 770 out of 770. Mind: Nobody.
Leech34508 Health: 670 out of 670. Mind: Nobody.
Possession58906 Health: 3270 out of 3270. Mind: Nobody.
Pestilence6456 Health: 970 out of 970. Mind: Nobody.
Haunt33455 Health: 500 out of 500. Mind: Nobody.
Possession34364 Health: 3270 out of 3270. Mind: Nobody.
Haunt33452 Health: 500 out of 500. Mind: Nobody.
Haunt33459 Health: 500 out of 500. Mind: Nobody.
Somehow I need to get zmud to count each type of demon when the mud shows "You take stock of your demonic entourage.". I would like to place each individual type in its own variable and display the individual ammounts in the status bar next to the demons name. Someone throw me a bone. [8D] |
|
|
|
Danlo Magician
Joined: 28 Nov 2003 Posts: 313 Location: Australia
|
Posted: Tue Jan 20, 2004 11:47 am |
I can't see how you could even try to fit each demon's status on the status bar, given you have some 20 demons. But the following would set their stats to variables and put them on the status bar:
#trigger {You take stock of your demonic entourage.} {#var Demonlist %null;#T+ demonstock;#ALARM +2 {#st %expandlist(@demonlist,"; ");#T- demonstock}}
#trigger {(%a) Health: (%d) out of (%d). Mind: (%w).} {#var %1 {Demon: %1 Health: %2%3 MindState: %4};#additem DemonList {"@%1"}} demonstock |
|
|
|
dazed-n-confused Novice
Joined: 14 Jan 2004 Posts: 31
|
Posted: Tue Jan 20, 2004 12:31 pm |
Let me add to this, Im not interested in all the stuff that follows each demon. eg. if there are 5 haunts in the list i would like the status bar to look something like HAUNT: 5, and likewise for some of the others. I seem to have a nack for not saying exactly what I intend.[:o)]
|
|
|
|
Danlo Magician
Joined: 28 Nov 2003 Posts: 313 Location: Australia
|
Posted: Tue Jan 20, 2004 1:27 pm |
Ah, that's better.
#trigger {You take stock of your demonic entourage.} {#Forall @demonlist {#var %i 0}}
#trigger {(%w)%d Health: %d out of %d. Mind: %w.} {#add %1 1;#additem demonlist %1} |
|
|
|
user0101 Apprentice
Joined: 01 Aug 2003 Posts: 100 Location: USA
|
Posted: Tue Jan 20, 2004 5:42 pm |
May I ask what MUD you play on dazed?
|
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Tue Jan 20, 2004 7:32 pm |
I prefer to assign my own variable names so I can ensure there are no conflicts. Allowing the script to choose variable names always leaves the possibility of getting a name that's already in use. By using a record-variable, only one variable, and one name, is required to track all the demon-types. This also simplifies the #STATUS command so it doesn't need to be rewritten whenever a new type of demon is added. However, I have used a second, list-variable, so that additional demon-types can easily be added without rewriting the variable-initialization in the first trigger. I've demonstrated by adding Possession and Haunt with the #ADDITEM command.
#VAR demonlist {Pestilence|Imp|Balrog|Slime|Parasite|Seeker|Storm|Leech}
#ADDITEM demonlist Possession
#ADDI demonlist Haunt
#TR {You take stock of your demonic entourage} {#ADDKEY demons @demonlist 0}
#TR {(%w)%d %s Health: %d out of %d. Mind:} {#ADD demons.%1 1;#ADDI demonlist %1}
#ST {%expanddb( {@demons}, " ", "=")} |
|
|
|
dazed-n-confused Novice
Joined: 14 Jan 2004 Posts: 31
|
Posted: Tue Jan 20, 2004 7:43 pm |
avalon is the name of the mud.
|
|
|
|
Danlo Magician
Joined: 28 Nov 2003 Posts: 313 Location: Australia
|
Posted: Tue Jan 20, 2004 10:37 pm |
A question lightbulb. How does the #addkey in the first trigger work? Doesn't it just make the value of @demonlist, Pestilence|Imp|..., the key with a value of 0, or does it make a record for each member in @demonlist?
|
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Tue Jan 20, 2004 10:58 pm |
No, as per the help file:
quote:
To set multiple fields to the same value, you can also use: #ADDKEY dbrec {field1|field2|...} Value
it will treat each member in the stringlist as a key and will assign each key the value of 0. |
|
|
|
Danlo Magician
Joined: 28 Nov 2003 Posts: 313 Location: Australia
|
Posted: Tue Jan 20, 2004 11:11 pm |
Ah, thanks Kjata. I didn't see that in the helpfile anywhere.
|
|
|
|
dazed-n-confused Novice
Joined: 14 Jan 2004 Posts: 31
|
Posted: Wed Jan 21, 2004 3:54 am |
Wow lightbulb that works excellent, thanks a lot.
|
|
|
|
dazed-n-confused Novice
Joined: 14 Jan 2004 Posts: 31
|
Posted: Fri Feb 06, 2004 6:33 am |
Hope someone is reading old topics.:) I was hoping lightbulb or someone could ammend this a tad. Because there are so many different types of demons the status bar becomes jammed up. Is there a way to get the status bar to only show a few of the more important demon types?
|
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Fri Feb 06, 2004 7:33 pm |
Yes. Pick the ones you consider important. For the sake of illustration, I've chosen Balrog and Storm.
#STATUS {Balrog=%db( @demons, Balrog) Storm=%db( @demons, Storm)} |
|
|
|
dazed-n-confused Novice
Joined: 14 Jan 2004 Posts: 31
|
Posted: Sat Feb 07, 2004 9:14 pm |
Now its just how I want it. Thanks again.
|
|
|
|
|
|