-
September 23rd, 2019, 23:10 #11
Ok, thank you very much for your time. Ill play around with this for the next couple of days and see if i cant work something out. Im having a hard time finding much else i need to do to my ruleset to make it even more convenient for players and gm anyway.
I have just been speculating since this morning, not actually working at the code, but I'll try adding the new ”equipped” button to the player record.
And yes, I believe the vehicle record is being saved as a new record within the player sheet, as it's not bound to the original record
Thanks again, I'll be back if I don't figure it out/give up lol
-
September 24th, 2019, 22:32 #12
alright. so instead of a list devoted entirely to all armaments in possession of the vehicles owned, i merely added the armaments list to the window of the vechicle. so now there is a windowlist within a windowlist entry. It actually looks a lot better than i was thinking originally.
so now i have another quandary. when rolling an attack with these armaments, you add your ranged combat skill, your base attribute, the armament bonus, and any modifiers.
now, i've been successful with making the thrusters from the vehicle itself add all of that to make a roll from the thrusters field in the vehicle windowlist entry on the character sheet. but when i go a step further, and try to get the armament (which is within the vehicle inventory list, which is within the vehicle within the vehicle list entry on the character sheet) to roll in a similar method, it's failing to index the stats i get it to look for.
so this is what is in the Thrusters for the windowlist entry. and i basically want the same thing (rngcomnum instead of pilotnum, though)
example.png
Code:<script> function onInit() CombatSkill = "pilotnum.slot.amount"; CombatBase = "charagilnum.slot.amount"; CombatName = "Pilot Action" nBaseTotal = window.getDatabaseNode().getChild("..." .. CombatSkill .. "").getValue() + window.getDatabaseNode().getChild("..." .. CombatBase .. "").getValue() + getValue() + ModifierStack.getSum(); nStress = window.getDatabaseNode().getChild("...stressroll.slot.amount").getValue(); end function onDragStart(button, x, y, dragdata) onInit(); local StateTime = CalendarManager.getCurrentTimeString(); local WeaponName = window.name.getValue(); local description = "" .. StateTime .. ": " .. WeaponName .. ": " .. CombatName .. ": " local nValue = getValue(); local aDice, nMod = StringManager.convertStringToDice(nTotal); local Negate = 0; local bDescNotEmpty = true; if nStress > 0 then for i=1,nStress do table.insert(aDice, "dS"); end end if nBaseTotal > 0 then for i=1,nBaseTotal do table.insert(aDice, "dB"); end else for i=1,-nBaseTotal do table.remove(aDice); end end dragdata.setType("dice"); dragdata.setDieList(aDice); dragdata.setDescription("" .. StateTime .. ": " .. WeaponName .. ": " .. CombatName .. ": "); dragdata.setStringData("" .. StateTime .. ": " .. WeaponName .. ": " .. CombatName .. ": "); return true; end function onDoubleClick(x, y) onInit(); local StateTime = CalendarManager.getCurrentTimeString(); local WeaponName = window.name.getValue(); local description = "" .. StateTime .. ": " .. WeaponName .. ": " .. CombatName .. ": " local aDice, nMod = StringManager.convertStringToDice(nTotal); local Negate = 0; if nStress > 0 then for i=1,nStress do table.insert(aDice, "dS"); end end if nBaseTotal > 0 then for i=1,nBaseTotal do table.insert(aDice, "dB"); end else for i=1,-nBaseTotal do table.remove(aDice); end end Comm.throwDice( "dice", aDice, Negate, description) end function onValueChanged() onUpdate(); end function onUpdate() end </script>
-
September 24th, 2019, 23:50 #13
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,561
Looking at your script, I don't see where "nTotal" variable is getting set. It is used in "local aDice, nMod = StringManager.convertStringToDice(nTotal);", but it looks like it's not getting initialized.
Make sure to liberally use Debug.chat commands to output all the variables for inspection when you are having trouble figuring out what's not working with a script.
Regards,
JPG
-
September 25th, 2019, 06:55 #14
i believe that's probably a remnant of a code i used as a template, but it doesn't appear to have much of an effect. I got it working so that you can doubleclick the bonus box of the armament that is in your vehicle in your inventory. and if it's not in there, it gives a message in the chat that rolls need to be made from the character sheet.
but i can't get the dragdata to go back down the pipeline. i used something similar to what you explained earlier with the equipped button in order to send a throwdice command on the character sheet with all the appropriate data. but i'm not sure how to return the dragdata, seeing as the pointer is in this twisted little windowlist-entry-windowlist-entry and we're getting dragdata/draginfo from the character sheet.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks