PDA

View Full Version : An old extension I made is being resurrected



MyGivinOpinion
September 1st, 2021, 03:34
BUT... there is one problem! My extension no longer appears in my extension list at the campaign selection. Below is my extension.xml code:


<?xml version="1.0" encoding="iso-8859-1"?>
<root version="3.0" >
<properties>
<name>*5E - Complete Offensive Package* </name>
<version>0.04</version>
<author>Lord Taser</author>
<ruleset>
<name>5E</name>
</ruleset>
</properties>

<announcement text="Complete Offensive Package v0.04 for FGU V3.3.6A 5E ruleset." font="emotefont" icon="LT" />

<base>

<!-- Modified Files -->
<includefile source="campaign/record_char_weapon.xml"/>
<includefile source="campaign/campaign_chars.xml"/>

<!-- Define Managers -->
<script name="cop" file="scripts/effects.lua"/>

<!-- Define Images -->
<icon name="LT" file="graphics/icons/Lord Taser.png"/>

</base>

</root>
Any help is greatly appreciated.

Moon Wizard
September 1st, 2021, 04:21
We will need to see the complete extension in order to figure out what is wrong (i.e. .ext file or folder zipped up)

Regards,
JPG

MyGivinOpinion
September 1st, 2021, 04:29
edited

Moon Wizard
September 1st, 2021, 06:09
That file is a renamed RAR file; not a renamed ZIP file. FG does not read RAR format.

Make sure to create it using the ZIP format. (The Windows "Send To -> Compressed File" right click option will do that, and that's what I use.)

Regards,
JPG

MyGivinOpinion
September 1st, 2021, 20:44
I've uninstalled WinRAR. That fixed the issue.

The original issue that caused me to stop was an OOB error, and I'm guessing that is still what is causing my issues. The extension works as intended for the GM only, and only half works for the player. When the extension goes to clear a threat range indicator, it gives the following error for the player to the console:
48977
Compared to the GM side:
48978
and for the code:

function onInit()
user = User.getUsername(); --assigns user login name currently useless
OOBManager.registerOOBMsgHandler(OOB_MSGTYPE_MELEE , onMelee);
OOBManager.registerOOBMsgHandler(OOB_MSGTYPE_REACH , onReach);
OOBManager.registerOOBMsgHandler(OOB_MSGTYPE_CLEAR , clearReach);
end

function customOOBHandler(msgOOB, funct)
Comm.deliverOOBMessage(msgOOB, funct);
end

function getCharID(CharID)
charNode = CharID; --assigns charsheet.id-#####
PCName = DB.getValue(charNode,"name"); --assigns the PC Name
end

--sorts weapon properties and handles property triggers.
function propertySorter(aWeaponProps)
Debug.console("userName:: ", user); --userName
Debug.console("charNode:: ", charNode); --charsheet.id-*****
Debug.console("PCName:: ", PCName); --PCName
Debug.console("aWeaponProps:: ", aWeaponProps); --{ #1 = s'*******', #2 = s'*******', etc... } weapon properties returned from record_char_weapon.xml
for index, value in ipairs(aWeaponProps) do
--Debug.console(value); --prints the individual properties listed in aWeaponProps
if value == "reach" then
CTVerification(); --grab CT info and assign variables
msgOOB.type = OOB_MSGTYPE_REACH;
customOOBHandler(msgOOB, "");
onReach(); --function that applies changes to threat range indicator
else
CTVerification();
msgOOB.type = OOB_MSGTYPE_MELEE;
customOOBHandler(msgOOB, "");
onMelee();
end
end

end



--Tracks down the Token by comparing charsheet.id-##### in both the combattracker and charsheet DB's
function CTVerification()
local idNodes = CombatManager.getCombatantNodes(); --{ s'id-*****' = databasenode = {combattracker.list.id-***** }, s'id-*****' = databasenode = {combattracker.list.id-***** }}
Debug.console(idNodes);
for i, v in pairs(idNodes) do --for-loop to break up the idNodes into single scannable tables
local CTName = DB.getValue(v, "name");

if PCName == CTName then
Debug.console("CTName:: ", CTName);
CTLID = v; --assigns CTLID the list id-##### if the Names on the list and character sheet match
Debug.console("CTLID:: ", CTLID);
msgOOB.tokenpath = CTLID;

else

end
end

end

--Applies COP Threat Range Effect to normal melee attack(currently handles ranged attacks by default)
function onMelee()
local nDU = GameSystem.getDistanceUnitsPerGrid();
local nSpace = math.ceil(DB.getValue(CTLID, "space", nDU) / nDU);
local nHalfSpace = nSpace / 2;
local nReach = math.ceil(DB.getValue(CTLID, "reach", nDU) / nDU) + nHalfSpace;
local tokenpath = msgOOB.tokenpath;
tokenCT = CombatManager.getTokenFromCT(tokenpath);
Debug.console("tokenCT:: ", tokenCT); --displays tokeninstance data
tokenCT.removeAllUnderlays();
tokenCT.addUnderlay(nReach, "4fB22222", "");
end

Moon Wizard
September 1st, 2021, 21:06
Your best bet is to work backwards through each function and output the parameters being passed in. It seems like somewhere that your variables aren't set the way you expect.

For example, you are using "nodeWin" in your getCharID function, but that variable is not defined anywhere so will always be nil.

Regards,
JPG

MyGivinOpinion
September 1st, 2021, 21:23
*deleted*

MyGivinOpinion
September 1st, 2021, 21:39
Thanks for pointing that out, something I forgot to delete before posting the code. It's not meant for this code. Do I need a User.isHost() check? And if so, how and/or where would I implement it? It also seems that the players can't access info from the CT such as token instance information. I believe this is mainly where my OOB statement should go, but I am not sure as to how it is used. I've reviewed the ref doc, and talked to others more familiar with it.

MyGivinOpinion
September 3rd, 2021, 13:23
So I have had tremendous success with programming my extension, but in my haste I forgot to change my map grid back to square. Coding wise this makes little difference for the underlay, but is there a way to alter the shape of a square underlay so that it is rounded like on the hex grid? I only discovered this feature yesterday and really hope to make full use of it.

MyGivinOpinion
September 4th, 2021, 15:11
So i went forward and broke my program, had to rewind to a previous version. Discovery of problem relating to FGU not detecting current User's token. No error messages are being thrown so I know the code itself is solid. I just need to figure out a way to keep track of who is mousing over what character sheet and tell the appropriate token to update. Anyone have any ideas on where to start looking? Attached is my current code. (Please use Hex grid as this is the unintended best grid setting for the extension.)

49002

MyGivinOpinion
September 7th, 2021, 00:10
Okay, so last night I finally got my extension working properly both on the GM side and player side. I went to sleep and woke up to find my code no longer processes on the player side. The Debug.console() arguments that are being passed when prompted by a player are coming out on the GM console. I don't understand what happened. Any insight?