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
jed
Adept


Joined: 18 Dec 2005
Posts: 246

PostPosted: Wed Dec 27, 2006 12:49 am   

expansion of %1 in #math command
 
I have the following bit of code that is fed from a trigger :
it has an armor class bonus of (*)
For this example (*)=-0.1 and actemp is an autotype variable
Code:
#math actemp 10*%1
#math item.ac @actemp+@item.ac
#show %1
#show @actemp
#show @item.ac
#cw @idddcol

I used this in zmud except with brackets around each of the expressions, and the #math would have yielded -1 for @actemp as it should, however right now, it is equal to 0... I've played with the variable typ for actemp, trying floating, and initializing it as 0.0, but that didn't help. If I try it with brackets as I had it set up in zmud it yields something like 10 * -0.1 + 0 where it doesn't evaluate the expression... I've also tried to enclose the expressions within the %eval function... no luck... Any help would be nice!
Reply with quote
crycry
Apprentice


Joined: 24 Jun 2006
Posts: 169
Location: UK - South Coast

PostPosted: Wed Dec 27, 2006 3:23 pm   
 
okies, took me a while to figure this out, it looks like you needed to declare the %1 input as a float.

I cMudded your script too, removing the math command, as you dont need it now

Code:
#var actemp (10 * %float(%1))
#var item.ac (@actemp + @item.ac)
#show %1
#show @actemp
#show @item.ac
#cw @idddcol


or, compressed a bit

Code:

#var item,ac (@item.ac + (10 * %float(%1)))
#show  %1
#show @item.ac
#cw @idddcol


this works nicely
_________________
'Life is what happens, when your too busy doing something else'

_________________

XP Pro SP2
cMud 1.24
_________________
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Wed Dec 27, 2006 4:58 pm   
 
If your wildcard (assuming it's a trigger capture) is a floating-point match, CMUD should convert %1 into a floating-point value for you.
Reply with quote
crycry
Apprentice


Joined: 24 Jun 2006
Posts: 169
Location: UK - South Coast

PostPosted: Wed Dec 27, 2006 5:06 pm   
 
hms, i tested this as an alias.. so youll have to check Jed that it works ok as a trigger.

whatever it was though, it really didnt like it until you told it it was coming in as a floating point number.. bug?
_________________
'Life is what happens, when your too busy doing something else'

_________________

XP Pro SP2
cMud 1.24
_________________
Reply with quote
Zugg
MASTER


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

PostPosted: Wed Jan 17, 2007 10:13 pm   
 
Added to bug list. CMUD should be auto-typing %1, so this is supposed to work without the explicit %float call.
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