About Us
Products
Purchase
Downloads
Support
Forums
Contact Us
Site
 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
harley
Apprentice


Joined: 05 Apr 2008
Posts: 121

PostPosted: Sun Jul 05, 2009 5:13 am   

Random output on trigger
 
Code:
$area = @misc.CurrentArea
gt $area will repop in %1 Mins or so.
#say $area
#alarm +%eval(%1*60) {gt $area repopping in less than 1 min.}


That is my value for a sense life trigger i have
Any idea why it would randomly(not every time, actually like 10% of the time) output a number instead of the Area name
The area in @misc.CurrentArea is correct..
ie
Quote:
**** '86000 repopping in less than 1 min.'
Reply with quote
Zugg
MASTER


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

PostPosted: Mon Jul 06, 2009 5:14 pm   
 
The problem is that the #ALARM command is creating a script that will run some time later. The value of the script is not evaluated and executed until when the alarm fires. And when that happens, the $area local variable is no longer defined. What you want is something like this:
Code:
#EXEC %concat("#alarm +%eval(%1*60) {gt ",$area," repopping in less than 1 min.}")

That will force the $area local variable to be expanded when the alarm is created instead of when the alarm fires.

Or, honestly, this is a case where you should probably just be using a normal variable and not a local variable. The speed improvement from the local variable will get negated by the use of #EXEC. You should just do:
Code:
area = @misc.CurrentArea
gt @area will repop in %1 Mins or so.
#say @area
#alarm +%eval(%1*60) {gt @area repopping in less than 1 min.}

Since this uses a session variable, then @area will always be properly defined. You can check the "Use Default" option for the @area variable if you don't want to save it across sessions to speed it up a bit.
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