|
DustyShouri Novice
Joined: 29 Oct 2004 Posts: 34
|
Posted: Fri Nov 12, 2004 2:56 am
#additem/string lists |
Well, I was working on a system for lighting and smoking pipes in Achaea.
And, Achaea doesn't tell you what pipes you're lighting/smoking in the output. So, I wanted to make a system where it keeps tracks of what pipes you light in the order you light them.
Problem:
Lighting more then one pipe, results in the string carrying more then one item. BUT, it doesn't add the items in the order they're added.
Which results me lighting an already lit pipe. Any way to fix this? |
|
|
|
mortie Wanderer
Joined: 26 Sep 2002 Posts: 73 Location: United Kingdom
|
Posted: Fri Nov 12, 2004 2:00 pm |
Can you post the code you already have?
If you dont want to light an already lite pipe. You could use the %ismember function which you can use to check your stringlist of pipes already lite. |
|
|
|
DustyShouri Novice
Joined: 29 Oct 2004 Posts: 34
|
Posted: Fri Nov 12, 2004 2:43 pm |
Code: |
#CLASS {Dsys|Pipes}
#ALIAS setelm {#var elmpipe %1}
#ALIAS setskull {#var skullpipe %1}
#ALIAS setval {#var valpipe %1}
#ALIAS lightelm {#if (!%ismember( @elmpipe, @pipestobelit)) {#additem pipestobelit @elmpipe;checkpipes}}
#ALIAS smokeelm {#additem pipestobesmoked @elmpipe;checkpipes}
#ALIAS lightskull {#if (!%ismember( @skullpipe, @pipestobelit)) {#additem pipestobelit @skullpipe;checkpipes}}
#ALIAS smokeskull {#additem pipestobesmoked @skullpipe;checkpipes}
#ALIAS lightval {#if (!%ismember( @valpipe, @pipestobelit)) {#additem pipestobelit @valpipe;checkpipes}}
#ALIAS smokeval {#additem pipestobesmoked @valpipe;checkpipes}
#ALIAS checkpipes {#if (!%ismember( stunned, @afflictions) & !%ismember( asleep, @afflictions) & @pause!=1) {#if (@balance!=1 & @EQ!=1) {#if (%numwords( @pipestobelit, |)>0) {light %word( @pipestobelit, 1)}};#if (%numwords( @pipestobesmoked, |)>0) {#if (%ismember( %word( @pipestobesmoked, 1), @pipeslit)) {smoke %word( @pipestobesmoked, 1);#delitem pipestobesmoked %word( @pipestobesmoked, 1);#var smoking 1}}}}
#ALIAS pipesoff {#var pipestobelit {};#var pipestobesmoked {};#var pipeslit {}}
#ALIAS checkelm {#if (%ismember( @elmpipe, @pipeslit)) {smokeelm} {lightelm;smokeelm}}
#ALIAS checkval {#if (%ismember( @valpipe, @pipeslit)) {smokeval} {lightval;smokeval}}
#ALIAS checkskull {#if (%ismember( @skullpipe, @pipeslit)) {smokeskull} {lightskull;smokeskull}}
#TRIGGER {You carefully light your treasured pipe until it is smoking nicely.} {#additem pipeslit %word( @pipestobelit, 1);#delitem pipestobelit %word( @pipestobelit, 1);#var smoking 0;checkpipes}
#TRIGGER {You take a long drag off your pipe.} {#delitem pipestobesmoked %word( @pipestobesmoked, 1);cureafflict;checkpipes}
#TRIGGER {Your pipe has gone cold and dark.} {#additem pipestobelit %word( @pipeslit, 1);#delitem pipeslit %word( @pipelit, 1);checkpipes}
#TRIGGER {That pipe is already lit and burning nicely.} {#additem pipeslit %word( @pipestobelit, 1);#delitem pipestobelit %word( @pipestobelit, 1)}
#TRIGGER {That pipe isn't lit.} {#additem pipestobelit %word( @pipestobesmoked, 1);#delitem pipeslit %word( @pipestobesmoked, 1);#delitem pipestobesmoked, %word( @pipestobesmoked, 1);checkpipes}
#CLASS 0 |
|
|
|
|
DustyShouri Novice
Joined: 29 Oct 2004 Posts: 34
|
Posted: Fri Nov 12, 2004 2:49 pm |
I want it to go along like this.
These are the ID numbers of my pipes:
Code: |
elm 345252
val 747327
skull 167627 |
Say I light and smoke the elm pipe first, skull second, then val last.
Theoretically, I would hope the variable would end up like this:
{345252|167627|747327}
That way, when I get the line that says one of my pipes went dark, it would light the first one I lit before, so I don't try and light an already lit pipe. So I wish it'd smoke them in order, but it doesn't. |
|
|
|
mortie Wanderer
Joined: 26 Sep 2002 Posts: 73 Location: United Kingdom
|
Posted: Fri Nov 12, 2004 6:32 pm |
Im not sure you need the
#delitem pipestobesmoked %word( @pipestobesmoked, 1)
in the checkpipes #alias
You already have it in the #trigger watching for the taking a drag pattern. Im assuming that occurrs as soon as your run the smoke command?
Also in the #trigger
#TRIGGER {Your pipe has gone cold and dark.} {#additem pipestobelit %word( @pipeslit, 1);#delitem pipeslit %word( @pipelit, 1);checkpipes}
It should be pipeslit.
This is why its not removing the elm pipe 34525 from the pipeslit stringlist. Hopefully this should sort it. I cant test it, as i dont have access to zmud at work and
have only run the cycle through my head. I'm going to see the word pipes for the rest of the evening now ;0) |
|
|
|
|
|
|
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
|
|