|
Noodles Beginner
Joined: 03 Mar 2004 Posts: 12 Location: USA
|
Posted: Wed Mar 03, 2004 1:51 pm
boggled |
I'm just getting my feet wet in writing scripts, as this next question will show . Be sure, I've pour'd over the FAQS etc quite a bit, and tried a load of things, including peeking at other scripts(prolly just not the right places)... Anyways
#VAR potions {red|gree|blue|purple|yellow}
#if (@potions=~ a (*-potion) falls to the ground) {#noop} {pickup %1, destroy %1}
Im looking to do an autocleanup after a person has died, while ignoring the potions so my other triggers can handle them. Unless there is a way to cram it all into one trigger. I didn't think that would work however because some potions(ex black-potion, fungus-potion) are bad - don't need to be drinking those [xx(]
MUD says something like:
"A wet paper bag has been slain!"
"a blue-potion falls to the ground."
"a heavy-book falls to the ground."
In place of potions however are other things, like trash, books, bags, etc. Some do/don't have a - in them(ex. heavy-book). I'm not sure if that is what is confusing me. I just wanna snag those potions, and destroy the rest. I know, it is simple HELP!
Thanks, Noodles |
|
|
|
Noodles Beginner
Joined: 03 Mar 2004 Posts: 12 Location: USA
|
Posted: Wed Mar 03, 2004 2:00 pm |
Bad, missed a line, now what do you think?
#VAR potions {spell|force|pale|purple|pink|wit|silver|black|clear|night}
#trigger {a {(*)-potion} is falling to the ground}
#if (@potions=~ {a (*-potion) is falling to the ground)} {#noop} {get %1, con %1}
Noodles |
|
|
|
Larkin Wizard
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Wed Mar 03, 2004 3:12 pm |
Not sure if I have this correct or not, but I'd say you need to do something like this:
#VAR potions {spell|force|pale|purple|pink|wit|silver|black|clear|night}
#TRIGGER {a (*)-potion falls to the ground} {#if (%ismember(%1,@potions)) {get %1;con %1}}
Use the %ismember() function to see if the potion is on your list. Use the semi-colon to separate commands. No need to use #noop in this command; just reverse your #if logic and get rid of the 'else' condition. |
|
|
|
Noodles Beginner
Joined: 03 Mar 2004 Posts: 12 Location: USA
|
Posted: Wed Mar 03, 2004 9:01 pm |
I did some toy'n with your suggestion larkin, however it does more then mine did :) it's not quite doing what i need :( It doesn't appear to be checking the potions list (which I now filled out with full names) OR, well, i just can't figure it out. I've a feeling { } or () are there/or not...
#VAR potions {spell-potion|force-potion|pale-potion|purple-potion|pink-potion|wit-potion|silver-potion|black-potion|clear-potion|night-potion}
#TRIGGER {a %1 is falling} {#if (%ismember(%1,@potions)) {get %1; drink %1}} {get %1;destroy %1}
Any other ideas? Tryin to get it to get/drink potions if there is a match to the list, anything not matching, need it to get/destroy.
Noodles |
|
|
|
user0101 Apprentice
Joined: 01 Aug 2003 Posts: 100 Location: USA
|
Posted: Wed Mar 03, 2004 10:02 pm |
#VAR potions {spell-potion|force-potion|pale-potion|purple-potion|pink-potion|wit-potion|silver-potion|black-potion|clear-potion|night-potion}
#TRIGGER {a (*) is falling} {#if (%ismember(%1,@potions)) {get %1; drink %1} {get %1;destroy %1}} |
|
|
|
Septe Novice
Joined: 12 Oct 2000 Posts: 38 Location: USA
|
Posted: Wed Mar 03, 2004 10:38 pm |
Ok...fix the trigger so it looks like this:
#TRIGGER {a (*) falls to the ground.} {#if(%ismember....
The rest seems to be okay...that should work.
Septe |
|
|
|
Noodles Beginner
Joined: 03 Mar 2004 Posts: 12 Location: USA
|
Posted: Thu Mar 04, 2004 12:37 pm |
Wee, got it working. Many thanks :)
After beating my head against the wall, I decided to spell the potion names exactly as they were.. with capital letters and viola~
Now, are string lists case-sensitive all the time?
Thanks again :)
Noodles |
|
|
|
|
|