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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Wed Dec 12, 2007 8:14 am   

[2.16] Functions (converted from zMUD)
 
I've been converting more scripts from zMUD to CMUD, and within it, there are functions. The functions (as they were written in zMUD) are as follows:

Code:
#FUNC TimeFormat {%concat( %if( %1=0, "", %concat( "@W", %1, "@cd", %if( %1>1, " ", " "))), %if( %2=0, "", %concat( "@W", %2, "@ch", %if( %2>1, " ", " "))), %if( %3=0, "", %concat( "@W", %3, "@cm", %if( %3>1, " ", " "))), %if( %4=0, "", %concat( "@W", %4, "@cs", %if( %4>1, "", ""))))}


Thus, the output for @TimeFormat(1,2,3,4) would display

Code:
1d 2h 3m 4s


For the longest time, I had trouble getting this to work the same way in CMUD. The variable remained the same, but instead of showing the above output, it'd show:

Code:
%concat( %if( %1=0, "", %concat( "@W", %1, "@cd", %if( %1>1, " ", " "))), %if( %2=0, "", %concat( "@W", %2, "@ch", %if( %2>1, " ", " "))), %if( %3=0, "", %concat( "@W", %3, "@cm", %if( %3>1, " ", " "))), %if( %4=0, "", %concat( "@W", %4, "@cs", %if( %4>1, "", ""))))


Then, by some chance, I placed a space in front of the first %concat, and it displayed it correctly. Not sure if this is a bug or not, but I'm pointing this out to anyone who has similar troubles.

Charneus
Reply with quote
ralgith
Sorcerer


Joined: 13 Jan 2006
Posts: 715

PostPosted: Wed Dec 12, 2007 2:09 pm   
 
This is probably the same thing that was going on with the stutter script darmir and I worked up and converted.
Or something similar.
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate
Reply with quote
Zugg
MASTER


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

PostPosted: Wed Dec 12, 2007 5:30 pm   
 
We need to see your CMUD code to really help with this. The #FUNC command was changed to #VARFUNC in CMUD. You probably want to convert this to a normal #FUNCTION in CMUD to make it more readable. Perhaps one of the others on this forum can help you convert it properly.
Reply with quote
Seb
Wizard


Joined: 14 Aug 2004
Posts: 1269

PostPosted: Fri Dec 14, 2007 2:18 am   
 
I experienced a similar problem that I already posted about (a bit vaguely). Basically var-functions were not compiling and therefore not working. Changing the variable type would fix them randomly. No code changes were required in mine.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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