DICE PACKS BUNDLE
View RSS Feed

Minty23185Fresh

A Neophyte Tackles the FG Extension - Change Effect Visibility with One Line (Part 2)

Rate this Entry
Due to posting limits, I have had to split this session into three posts.
This is part 2 of 3.


(continued from part 1)

Now to decipher the statement in line 535 (FG v3.1.7). The statement starts with “DB.setValue”. From previous work for this blog series I know DB refers to the DB Package and setValue( ) is a function in that Package described in the XML and Scripting Reference. From the document I see that this statement writes data using the parameters to the DB and so will eventually write it to the campaign’s db.xml file.

I opened the db.xml file in Notepad++ and looked for some effects. Here is a portion of the section of values for paralyzed (note the <isgmonly> value of zero):

Code:
          <isgmonly type="number">0</isgmonly>
          <label type="string">Paralyzed</label>
More verification of my thought process: I want to see if toggling the button in the Combat Tracker is reflected in the db.xml file. Plus, I want to ensure I know what the valid values for the field are. For the paralyzed effect I clicked the VSBL button changing it to “GM”. I forced a DB write to disk using the /save command in the Chat, then refreshed the db.xml file view in Notepad++, and confirmed that the new <isgmonly> value was 1.

It is now time to put the functionality into the extension. From the work above the local value of the state button is in the variable “rNewEffect.nGMOnly“. To force the value to be “GM” whenever an effect is added to the Combat Tracker I believe I “just” need to ensure that variable’s value equals 1. To do that I will add the a single line of code just after my previously added Debug.console( ) statement.

Having dissected several published extensions, worked through the tutorials listed in previous blogs and followed numerous forum threads about extensions, I know that I must copy the manager_effect.lua file into my extension. Do I need the entire contents of the file? I don’t know, but I believe I do. I’ll explore that next time.

The 5E manager_effect.lua file resides in a scripts subfolder. To maintain consistency with the ruleset I’ll put my copy in a scripts subfolder. Then add my line of code and modify the console call as shown:

Code:
function addEffect(sUser, sIdentity, nodeCT, rNewEffect, bShowMsg, sEffectTargetNode)
  Debug.console("TWD|manager_effect.lua|addEffect()|status", "Arrived in EXT");
  rNewEffect.nGMOnly = 1;
To use the extension script file instead of the 5E lua file, I’ll change the <base> of my extension.xml file to be:

Code:
  <base>
    <!-- As of FG v3.2.0 the following should no longer be necessary -->
    <script name="EffectManager" file="./scripts/manager_effect.lua" />
  </base>
(continued in part 3)

Submit "A Neophyte Tackles the FG Extension - Change Effect Visibility with One Line (Part 2)" to Digg Submit "A Neophyte Tackles the FG Extension - Change Effect Visibility with One Line (Part 2)" to del.icio.us Submit "A Neophyte Tackles the FG Extension - Change Effect Visibility with One Line (Part 2)" to Google Submit "A Neophyte Tackles the FG Extension - Change Effect Visibility with One Line (Part 2)" to Facebook Submit "A Neophyte Tackles the FG Extension - Change Effect Visibility with One Line (Part 2)" to Twitter

Comments

FG Spreadshirt Swag

Log in

Log in