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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Rainsforth
Newbie


Joined: 17 Sep 2008
Posts: 4

PostPosted: Wed Sep 17, 2008 10:16 pm   

@variables
 
In Zmud, I've assigned variables triggered from my hp bar into bunch of info like this:

@HP = %1
@HPMAX = %2

then:

#MATH hpdamage (@HPMAX-@HP)

This worked in Zmud however, I downloaded CMUD and tried importing.. the same thing does not seem to work. I played around with it and tried searching help files and so on, I still do not see anything that even remotely helps.. hoping someone can answer soon.
Reply with quote
Progonoi
Magician


Joined: 28 Jan 2007
Posts: 430

PostPosted: Wed Sep 17, 2008 10:22 pm   
 
Basically you don't need #math here. When hpdamage is a variable, then it's sufficent to do

hpdamage=@hpmax-@hp

EDIT: Hah. I was going to write that I haven't used #Math at all myself, nor under CMud nor under ZMud, but I figured
I can just as well do a little test in untitled session in CMud.

CMud is a lot more strict in its syntax than ZMud ever was, hence you have to remove ()'s and your #math will work the way
its intended.
_________________
The Proud new owner of CMud.

--------------------------------
Intel Core i5-650 3,2GHz
4 DD3 RAM
GTX 460 768MB
Win 7 Home Premium 64x
--------------------------------
Reply with quote
forren
Novice


Joined: 26 Apr 2007
Posts: 44

PostPosted: Wed Sep 17, 2008 10:33 pm   
 
Don't assign vars with @var=blah.

#VAR var blah or var=blah

@ is for referencing a variable, not setting it.
Reply with quote
Rainsforth
Newbie


Joined: 17 Sep 2008
Posts: 4

PostPosted: Wed Sep 17, 2008 10:34 pm   
 
I've already setted all variables with @HP, @HPMAX as I use them in other triggers

I now have:

HP[380(98)/380] SP[294(98)/294] NP[730/730|1c] E[none]
ERROR: Trigger "HP~[(%d)~((%d)~)/(%d)~] SP~[(%d)~((%d)~)/(%d)~] NP~[(%d)/(%d)|(%d)c~]" fired but did not compile

when checking HP. Script is:

#VAR HP=%1
#VAR HPfuse=%2
#VAR HPMAX=%3
#VAR SP=%4
#VAR SPfuse=%5
#VAR SPMAX=%6
#VAR NP=%7
#VAR NPMAX=%8
#VAR CORPSES=%9
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Wed Sep 17, 2008 11:00 pm   
 
What Forren is saying is that you should be doing this:
Code:
HP = %1
HPMAX = %2
#MATH hpdamage (@HPMAX-@HP)

or, doing it the way Progonoi mentioned:
Code:
HP = %1
HPMAX = %2
hpdamage=(@HPMAX-@HP)

setting a variable with
@HP = %1
will not work in CMUD and wasn't supposed to work in zMUD although sometimes it did.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Wed Sep 17, 2008 11:03 pm   
 
With the error message:
Quote:
ERROR: Trigger "HP~[(%d)~((%d)~)/(%d)~] SP~[(%d)~((%d)~)/(%d)~] NP~[(%d)/(%d)|(%d)c~]" fired but did not compile

that means there is some error in your trigger script or pattern. Go to the Package Editor and find the trigger then use the Check Syntax command in the Editor menu to check for errors. Also go to the Testing tab and test the trigger against a sample line from the MUD to see if it works as expected.

But nothing is wrong with #MATH. As a test I did this:
Code:
a = 5
b = 1
#MATH c (@a-@b)
#SHOW @c

and it properly displayed 4.
Reply with quote
Rainsforth
Newbie


Joined: 17 Sep 2008
Posts: 4

PostPosted: Wed Sep 17, 2008 11:29 pm   
 
Interesting enough, re-writing the HP script fixed it.. now the new problem is the second line of my hpbar: another script error

Code:
WORTH = %1
PROT = %2
VEIL = %3
REPOWER = %4
GLAMOUR = %6
UNDEADHP = %7
UNDEADCORPSES = %8
CIRCLE = %9
#IF (@CORPSES<2 & @UNDEADCORPSES >=2) {=give corpse}
#IF (@CORPSES < 1 & @UNDEADCORPSES >=1) {=give corpse}
#IF (@PROT = "OFF") {protection}
#IF (@WORTH < 125) {con}


checking compiled code says unmatching braces. I went through it slowly, and I don't see any unmatching braces
Reply with quote
Rainsforth
Newbie


Joined: 17 Sep 2008
Posts: 4

PostPosted: Wed Sep 17, 2008 11:48 pm   
 
Fixed the problem myself.. not sure why Zmud allowed me to enter a command of "=give corpse" while in Cmud I needed to "~=give corpse"

thanks for helping
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Thu Sep 18, 2008 3:02 am   
 
In Cmud you use "&&" not "&".
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Thu Sep 18, 2008 3:18 am   
 
The reason for the is the syntax compiler in CMUD is much stricter than it was in zMUD. Adding the tilde '~' tell CMUD to treat the '=' literally and that's its not part of an assignment.
_________________
Asati di tempari!
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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