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
DanaLea
Beginner


Joined: 31 Jul 2002
Posts: 19
Location: USA

PostPosted: Sat May 17, 2003 7:34 am   

Coding help (varibles and triggers)
 
I'm trying to change a variable value with a trigger. I have a variable called weapon that I want loaded with my current weapon, and I want the value updated whenever I change weapons automaticly. The mud issues a command like: "You wield Urania's Circle of Stars." the trigger I have is {^You wield &weapon} which works just fine. But here's the problem. When I dual weild, the mud message is somthin glike "You wield Dirt Claws in your off-hand." which puts "Dirt Claws in your off-hand." into my weapon variable. I want the dirt claws to be in my dual variable. Can anyone help me with this?

thanks in advance

-dana
Reply with quote
mega_
Beginner


Joined: 15 May 2003
Posts: 16
Location: Estonia

PostPosted: Sat May 17, 2003 8:23 am   
 
#TR {^You wield (%*) in your off-hand.} {#variable dualweapon %1}

If you want to just the first word then use (%w)*
Reply with quote
DanaLea
Beginner


Joined: 31 Jul 2002
Posts: 19
Location: USA

PostPosted: Sat May 17, 2003 8:52 am   
 
it's still putting it in the @weapon slot. is there a way to have both? my main weapon in the @weapon slot and my dual weapon in the @dual slot?
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sat May 17, 2003 9:02 am   
 
Don't use %*. There's no reason to.

#TR {^You wield (*).} {#IF (%ends( "%1", "in your off-hand")) {#VAR dual {%remove( "in your off-hand", "%1"}} {#VAR weapon {%1}}}

LightBulb
Advanced Member
Reply with quote
DanaLea
Beginner


Joined: 31 Jul 2002
Posts: 19
Location: USA

PostPosted: Sat May 17, 2003 9:55 am   
 
Thank you, that works perfectly. :)

-dana
Reply with quote
DanaLea
Beginner


Joined: 31 Jul 2002
Posts: 19
Location: USA

PostPosted: Wed May 21, 2003 4:10 pm   
 
ok, it's not so perfect.

it works fine while i'm logged into the game. but if i log out, even if i do not close zMud, then log back in, both varibles change to "Claws", they don't maintian their values. here's the trigger:
^You wield (*).
#IF (%ends( "%1", "in your off-hand")) {#VAR dual {%remove( "in your off-hand", "%1"}} {#VAR weapon {%1}}

and below that, in a split screnen/window, it says there is a syntax error with "^ syntax error" pointing at the first } after "in your off-hand", "%1"}}

any help?

-Dana
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed May 21, 2003 6:26 pm   
 
That means at some point you assigned those variables a default value of Claws. Remove the default value and uncheck "Use default value".

It's missing a ).
#IF (%ends( "%1", "in your off-hand")) {#VAR dual {%remove( "in your off-hand", "%1")}} {#VAR weapon {%1}}


LightBulb
Advanced Member
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