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


Joined: 19 Jun 2007
Posts: 23

PostPosted: Sun May 17, 2009 8:12 pm   

Function... not working....?
 
I'm trying to get some functions to work in Acropolis for Achaea, but things are acting weird. This is the original function: %if(%iskey(@afflictions,asleep) or %iskey(@afflictions,unconscious) or %iskey(@afflictions,stunned) or %iskey(@flags,paused),0,1)

But that always returns false, even though each of those calls returns false also. I change the original function "able_scan" to this:
#RETURN 1

And then tested it like this:
#IF (@able_scan) {#say "Yes"} {#say "No"}

...and it shows me "No". Any ideas?
~~~~~~~~~
Addendum, the page for "%if" in reference shows "#ALIAS ccc {cast %if("%1"="darker",sanct,fireball) %1} ". But that should change "%1" to %1, right?
Reply with quote
kopf1988
Beginner


Joined: 19 Jun 2007
Posts: 23

PostPosted: Sun May 17, 2009 8:38 pm   
 
Function able_scan:
%if(%iskey(@afflictions,asleep) or %iskey(@afflictions,unconscious) or %iskey(@afflictions,stunned) or %iskey(@flags,paused),0,1)
Does nothing:
#IF (1==1) {#IF (@able_scan) {#say "hi"}}
Returns 0:
#IF (1==1) { %if(@able_scan,1,0) }
Returns 1:
#IF (1==1) { %if(%if(%iskey(@afflictions,asleep) or %iskey(@afflictions,unconscious) or %iskey(@afflictions,stunned) or %iskey(@flags,paused),0,1),1,0) }

I also tried adding #RETURN to the start of able_scan, which did nothing also.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun May 17, 2009 8:51 pm   
 
Quote:

#IF (@able_scan) {#say "Yes"} {#say "No"}


If you are calling a function, aren't you supposed to include the parentheses? As in, #IF (@able_scan())...? If CMud is looking at @able_scan as a variable and it's not finding it, it might be completing the equation as though @able_scan = 0/False instead of trying to evaluate @able_scan().
_________________
EDIT: I didn't like my old signature
Reply with quote
kopf1988
Beginner


Joined: 19 Jun 2007
Posts: 23

PostPosted: Sun May 17, 2009 9:00 pm   
 
YES!!!!!!!!!!!!!!!!!!!!!!!!!!!!! :)
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