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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Tech
GURU


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

PostPosted: Sun Jul 28, 2002 9:31 am   

Class Database Variables
 
I have a trigger class StockMarket whose scripts generate database variables using the #ADDKEY command. How can I (programmatically) get the generated to belong to the StockMarket class as well?

Asati di tempari!
Reply with quote
Charbal
GURU


Joined: 15 Jun 2001
Posts: 654
Location: USA

PostPosted: Sun Jul 28, 2002 12:44 pm   
 
In your script, you can use:
#CLASS StockMarket {setdef}
#TRIGGER {Blah} {#ADDKEY Test Field1 123}
#CLASS 0

The setdef makes it so any variables created by the class are made within the class.

Alternatively, you can avoid using the #ADDKEY command for the initialization of the variable and use #VARIABLE instead.

#VARIABLE StockMarketVar %null _nodef "StockMarket"

will create an empty (%null) variable called StockMarketVar in the StockMarket class.

Subsequent references to the variable with #ADDKEY will not change the class it is in.



 - Charbal
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sun Jul 28, 2002 12:45 pm   
 
First create the variable using the
#VAR varName value defValue className

syntax. You may use the special value of _nodef in defValue if you don't want to specify a default.

Then you can use the #ADDKEY command, but make sure that the current class is the one you want by using the #CLASS command like this:
#CLASS StockMarket

After you finish working with this class, you can make the root class the default again by doing:
#CLASS 0

Kjata
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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