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 » zMUD General Discussion
Vorax
Apprentice


Joined: 29 Jun 2001
Posts: 198
Location: USA

PostPosted: Mon Apr 05, 2004 1:04 am   

Global variables & aliases
 
If I already have variables and aliaes defined and in use, how would I go about making them into global variables and global aliases?
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Apr 05, 2004 3:04 am   
 
Use the same names and values with the #GALIAS and #GVARIABLE command. Delete the existing ones if desired.
Reply with quote
Vorax
Apprentice


Joined: 29 Jun 2001
Posts: 198
Location: USA

PostPosted: Mon Apr 05, 2004 6:12 am   
 
Ok, so what do I need to do to be able to use these global variables/aliases with other character settings?
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Mon Apr 05, 2004 2:44 pm   
 
Use %getglobal and %setglobal.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Apr 05, 2004 3:27 pm   
 
The only thing you need to do to use these global variables/aliases with other character settings is:
Delete all local variables/aliases with the same name as the global variables/aliases.

This is clearly stated in the Help for Global Settings, #GALIAS, and #GVARIABLE:
zMUD will first look for a local variable/alias with the given name. If no matching variable/alias is found within the current MUD character, then zMUD searches the global variable/alias list.

In other words, LOCAL settings override GLOBAL settings. If you want to use GLOBAL settings, don't make LOCAL settings with the same name.
Reply with quote
Vorax
Apprentice


Joined: 29 Jun 2001
Posts: 198
Location: USA

PostPosted: Mon Apr 05, 2004 8:56 pm   
 
I did that. The thing is, the global variable I created is a string-list and whenever I add a new item to the list, it creates the variable as a local variable. This isn't the effect I want. How do I add new items to the global variable without it becoming a local variable?
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Mon Apr 05, 2004 10:50 pm   
 
Hmmm untested but try this as a workaround
#GVAR variablename %additem("items to add",@variablename)

EDIT: Fixed a typo (missing @)
Reply with quote
Vorax
Apprentice


Joined: 29 Jun 2001
Posts: 198
Location: USA

PostPosted: Mon Apr 05, 2004 11:58 pm   
 
That seems to work. Thanks! :)
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