nexela Wizard

Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Mon Sep 27, 2004 4:58 am
[HOW-TO] Using Inherited and Primary files. |
Quote: |
From the Zmud Help:
Each character can have two Settings Files: Primary and Inherited. When zMUD loads your character, it first loads any settings in the DEFAULT.MUD file. This is used to initialize many zMUD settings and cannot be disabled. Next, settings in your Inherited Settings file are loaded. Most people do not use this feature, but it allows you to set up common settings that you want to share between several characters. Inherited settings files can be in the current directory or folder, or can also be stored in the directory containing the ZMUD.EXE file. After loading your Inherited Settings file, then your Primary Settings file is loaded. It contains settings specific for this character. |
Now that we know the order that settings files are loaded lets examine a few further things that are missing from that chapter. Inherited files can be edited but it requires CLOSEING and REOPENING your char for the changes to take effect maybe in a future version of Zmud there will be a command to reload it but until then this is the only way. Also you CAN NOT use the same layout file between char icons. Also Inherited settings show up BLUE to edit these properly you need to open your settings editor and click on open inherited.
Now for a real life example, we have two chars on our favorite mud that we want to share the common triggers between. So on the char selection screen right click on your mud icon and select edit, browse to the CHAR tab and enter your Charname and password then browse to the FILES tab and set it up like this subfolder=mymudsname inherited=mymudinh.mud primary=mycharname.mud layout=mymudsname\mycharname.lay and in the MUD tab Title=Mymudsname caption=(should be autofilled)MyCharname on mymudname. After that is done create a NEW char and fill in the details for your other char (Don't just copy and paste chars as this has given me hell in the past much easier to start from scratch) and fill in the blanks as above.
Now that we have our files and folders set up lets connect to char1 and create a trigger for both chars to use. well what are you waiting for connect to char1 already :P. Then click the Settings Icon. when the settings window opens up click file->open inherited and a new settings window will open (You will know if your editing inherited settings as the value box will be a grayish color). Now lets make a simple bank trigger NEW->Trigger (adjust patterns accordingly)
Code: |
PATTERN:
^You have a balance of (%n) gold coins.
VALUE:
balance=%1
#SAY Balance is now %1
#NOOP the say is for testing purposes visual cue
|
Save the trigger and File->Save Settings and close your settings windows
Now if you try and get a balance you won't get the #Say testing line thats because you need to close your char and reopen it for changes to the inherited file to be applied. After you do that get a balance and you should get the testing line. and if you click the Settings Icon you will notice a new variable called balance in your primary file. And if you have View->show inherited checked you will have a blue balance trigger. Now that we know the trigger works we want to get rid of the testing line. If we try and edit the blue balance trigger in the primary settings we will be asked if we wan't to override our inherted setting. This isn't what we wan't so click no and goto file->open inherited and edit it there. Just remember for changes to take affect we need to close and reopen our char.
Things to remember:
Inherited settings need to be reloaded to work primary settings don't.
You should not create any variables in your inherited file unless they are static (non changing) or functions.
I wrote this up quickly and is prone to errors if you need more help post here. |
|