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
Latent
Apprentice


Joined: 19 Aug 2002
Posts: 120
Location: USA

PostPosted: Fri Jan 31, 2003 2:33 am   

scirpt problem
 
Ok, on this mud you can smith your own weapons from certain materials... the better the material the harder, and the only way to raise your blacksmithing skill is to use it. So I created a script to blacksmith automatically, and when I cant gain any more skill from the current weapon/material, it switches to the next one... but one part of the trigger isnt working... here is that part:
Pattern:
You attempt to forge
Value:
#IF (blacksmith = 0) {smith rust dagger}
#IF (blacksmith = 1) {smith rust sword}
#IF (blacksmith = 2) {smith rust flail}
#IF (blacksmith = 3) {smith rust mace}
#IF (blacksmith = 4) {smith rust polearm}
#IF (blacksmith = 5) {smith rust claw}
#IF (blacksmith = 6) {smith rust axe}
#IF (blacksmith = 7) {smith iron dagger}
#IF (blacksmith = 8) {smith iron sword}
#IF (blacksmith = 9) {smith iron flail}
#IF (blacksmith = 10) {smith iron mace}
#IF (blacksmith = 11) {smith iron polearm}
#IF (blacksmith = 12) {smith iron claw}
#IF (blacksmith = 13) {smith iron axe}

So basically, every time the mud tells me I cant gain any more skill from smithing say, a rusty dagger, I have a trigger to add one to a variable, blacksmith, and whenever the pattern "You attempt to forge a" appears, it will check to see if the "blacksmith" variable is a certain value, it will forge the proper item to increase my skill, but the trigger I pasted above will not fire
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Fri Jan 31, 2003 3:00 am   
 
#IF (@blacksmith == 0) {smith rust dagger}

When you want to refer to the value of a variable put a @ in front of it.
Should use == for equals for correct syntax.

Also you could use a #CASE statement if you factor in the 0 to 1 issue.



Ton Diening
Reply with quote
Latent
Apprentice


Joined: 19 Aug 2002
Posts: 120
Location: USA

PostPosted: Fri Jan 31, 2003 3:09 am   
 
doh, always making those little mistakes, thanks
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Jan 31, 2003 4:09 am   
 
quote:
Should use == for equals for correct syntax.


Based on what? While that syntax is supported, it's not listed anywhere in the helpfiles that I can find. It is definitely not listed in the helpfiles for "expressions" and "#IF", which would seem to be the definitive word on "correct" syntax.

LightBulb
Senior Member
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Fri Jan 31, 2003 4:48 am   
 
Yup, the correct syntax is a single =. I missed when Zugg added support for == (since it used to not work), but my guess is that it is just there for C/C++ programmers that are used to using ==. However, even taking that into consideration, I see no reason for allowing putting == in since zMUD does not allow variable asignment inside a logical expression.

Kjata
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Fri Jan 31, 2003 4:54 am   
 
Doh made that comment bashed on a faulty flashback.

Preferences->Script Parser->General Parsing
has an option for a=b in command line and I took that
for #IF statements.

Expressions duly show:
v1 = v2 true if value1 is the same as value2

As the correct syntax. My appologies!

Ton Diening
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