Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
takke
Beginner


Joined: 11 Oct 2002
Posts: 29
Location: Sweden

PostPosted: Mon Jun 02, 2003 6:04 pm   

pktrigger again
 
Hi there

Thanks for the fast response but I think I was a bit unclear about what I wanted the trigger and button to do. I don't know if you have time to help me with this problem but this time I will send you some strings from the game. Then I will try and explain what I need the trigger to do.
----------------------------------------------------------
Text from mud:
Reward for killing Celgiar, 25500 gold.
Reward for killing Jay, 30000 gold.
Reward for killing Hemuli, 37000 gold.
Reward for killing Shedi, 63000 gold.

These names I want to be put in a list (@pk)
----------------------------------------------------------
Text from mud:
Mortyr Macgyver the Drow
Juju Jeesuslapsi the Ogre Ravager
Sciurine Messias the Wraith is
Deux BERZERKER the Satyr

This is characters from the game. The people will go into another list (@char). It's just the first name that have to be saved into the list. I have a trigger, looks like this:
Pattern: %e[1;31m(%a)*
Value: #additem char %1

Now we have two lists. One with people in the in the room and one with people that have a price on their head.
This trigger works just fine.
----------------------------------------------------------
Now I want a button that when I press it it will check if there is match between the two lists. Are there any people in this room that excites on the @pk list. If there is a match i want the name of the match to be put in a variable (@pkt). Now we have one name in @pkt that is a match. Then I need a couple of commands to be executed at the @pkt. The commands is:

use devastate at @pkt
kill @pkt
srkill @pkt
remove axe
sling @pkt
wield axe

After I have killed the person I want the @pkt to be cleared so that I can press the button again if there is another match. I don't know if I can use #var pkt %null to do this. You should know.
----------------------------------------------------------
If there is multiple matches I just need to press the button again and the trigger will repeat the previous commands. Because I just have the hitpoints to kill one person at a time. I just want it to get one match even if there is multiple matches.
----------------------------------------------------------
Now it feels like I'm just rambling on and on but I have that you get the point of what I want the triggers and button to do. If you feel like you can help me but you need more info, feel free to mail and ask. If you don't can help me I would appreciate if you can send me a mail and tell me.

Thanks in advance
// Takke
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Tue Jun 03, 2003 12:50 pm   
 
Yes, this is precisely what the script in the other post did, except that it didn't save the name to a variable:
#WHILE (@char and (!%ismember(%item(@char, 1), @pk))) {#DELNITEM char 1}
#IF (@char) {kill %item(@char, 1);#DELNITEM pk %ismember(%item(@char, 1), @pk);#DELNITEM char 1}

So you change it to:
#WHILE (@char and (!%ismember(%item(@char, 1), @pk))) {#DELNITEM char 1}
#IF (@char) {#VAR pkt %item(@char, 1);use devastate at @pkt;kill @pkt;srkill @pkt;remove axe;sling @pkt;wield axe;#DELNITEM pk %ismember(%item(@char, 1), @pk);#DELNITEM char 1}

There is no built-in way to find items that appear in two list. So, what the script does is to go through all the items in the @char list until it finds one that is in the @pk list. When it does, it sets this character as the target, kills it, removes it from the @pk list and removes it from the @char. Pressing the button again will do this process once more, but this time the person you just killed is not in the @char list.

If you don't want the person that you just killed to be removed from the @pk list, then remove the part of the script that says:
#DELNITEM pk %ismember(%item(@char, 1), @pk)

Kjata
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net