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
AlienBoy
Newbie


Joined: 17 Nov 2001
Posts: 2

PostPosted: Sat Nov 17, 2001 9:03 pm   

Simple Triggers
 
This one is pretty basic, I'm just trying to get to know the scripting language a little better.

Someone Disarms you and sends your weapon flying.
Triggers: Get All
You get some weapon
Triggers: Wield some weapon

The problem at first is that I only need the second trigger to occur IF I get disarmed. I don't want my character to try to wield everything he picks up. Is there away to make a trigger run exlusively inside another trigger?

This got me to thinking, though, and another problem would occur if there were multiple items in the room. If the weapon weren't the first item I picked up, I'd have problems as well. So I was thinking it might be better to create a variable that would hold the name of whatever weapon I am wearing. Then the first disarm line could just trigger Get all; wear Variable. I would probably set the variable manually before I went out killing stuff so I don't really want to bother with a trigger to set it. The variable idea seems best, but I know less about variables than I do about triggers. Any help?
Reply with quote
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: Sat Nov 17, 2001 10:19 pm   
 
I prefer use of the variable myself, but you can write a trigger to automatically update it when you change weapons. In all these triggers I'm going to assume that the weapon's keyword is the last word of its name.


#TR {You wield (*)} {#VAR myWeapon %word(%1,%numwords(%1))}
#TR {Disarms you and sends your weapon flying.} {#T+ rewield; get @myWeapon}
#TR {You get * {@myWeapon}} {#T- rewield; wield @myWeapon} rewield


The last trigger should go into the class rewield.


Troubadour
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sun Nov 18, 2001 1:09 pm   
 
Does your MUD not allow command stacking? Or is there some way that you can fail to get the weapon? I say this because I don't see why you can't just send both commands to the MUD at once (get @weapon;wield @weapon) when you recieve the disarmed message.

Kjata
Reply with quote
AlienBoy
Newbie


Joined: 17 Nov 2001
Posts: 2

PostPosted: Tue Nov 20, 2001 5:10 am   
 
get @weapon; wield @weapon works perfectly, My problem before was not making the variable for my weapon. I was still stuck in another scripting language doing the old:
get all
You get *
Wield *
kind of thing. Then if there was a bread roll in the room where I was disarmed, there was a chance to get the bread roll and then try to beat my enemy to death with it. Making the variable solved that perfectly, I was just a little shakey on how to use variables. I understand Troubadour's suggestion pretty well. Someone tell me if this understanding is correct:
The Trigger for You wield * is active at all times and is there just to update the myWeapon variable whenever you wield something new.
The next trigger turns on the rewield class and gets myWeapon
The last trigger (which is the only trigger in the rewield class?) turns off the rewield class (that way if you pick up a myWeapon later it doesn't try to wield it) and then wields myWeapon.

Does that sound about right?
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