|
Vorax Apprentice
Joined: 29 Jun 2001 Posts: 198 Location: USA
|
Posted: 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?
|
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: 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.
|
|
|
|
Vorax Apprentice
Joined: 29 Jun 2001 Posts: 198 Location: USA
|
Posted: 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?
|
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Mon Apr 05, 2004 2:44 pm |
Use %getglobal and %setglobal.
|
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: 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. |
|
|
|
Vorax Apprentice
Joined: 29 Jun 2001 Posts: 198 Location: USA
|
Posted: 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?
|
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: 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 @) |
|
|
|
Vorax Apprentice
Joined: 29 Jun 2001 Posts: 198 Location: USA
|
Posted: Mon Apr 05, 2004 11:58 pm |
That seems to work. Thanks! :)
|
|
|
|
|
|