PDA

View Full Version : Issue with the Control Key, Targeting and the Modifier Stack...



Blackfoot
February 23rd, 2015, 23:10
I'm not sure where or when this problem began... I've not worked on my ruleset in a few months... but now whenever I try and make a roll it gives me this error:

Script Error: [string "desktop/scripts/modifierstack.lua"]:241: attempt to index global 'control' (a nil value)
I tracked this back and it seems to have something to do with holding the control key while targeting. This is something built into CoreRPG and CoreRPG rolls seem to be working ok... so I'm not sure what I broke that is tweaking it... I removed the modifierstack from my ruleset a long time ago... so it might be somehow connected to that. (since that seems to be the file that's having the issue) but it's been working just fine up until today. As I said.. I probably haven't made any rolls in the ruleset since the last update went through.. so the issue is probably something in there. I looked though the patch notes and nothing jumped out at me as being a related 'fix' that would break my stuff. I KNOW my rolls were working correctly on Dec. 28th 2014.

Anyone have any ideas as to what might be going on there... where I might look to fix it?

Blackfoot
February 23rd, 2015, 23:44
Hrm. I wonder if this has something to do with that 'targeting toggle' thing. Since I removed the modifier box.. that obviously does not exist either.

Trenloe
February 23rd, 2015, 23:53
I'm assuming your ruleset is layered on top of CoreRPG?

If so, you need to override the ModifierStack.getTargeting() function.

If you don't have modifierstack.lua in your ruleset, have some code in your ruleset that makes this function do nothing. Such as:


ModifierStack.getTargeting = myOverride;

function myOverride()
return true;
end

The above will replace the ModifierStack.getTargeting function with a function (myOverride) that does nothing, so this will replace the normal code that looks for the targeting control and gives the error because it isn't there.

Blackfoot
February 23rd, 2015, 23:59
This is attached to a new CoreRPG feature? I don't see the reference in the update notes... unless it's :

[CoreRPG+] Added targeting toggle to desktop for all rolls.I'm guessing that I can just put that code into the base.xml file?

Trenloe
February 24th, 2015, 00:18
This is attached to a new CoreRPG feature? I don't see the reference in the update notes... unless it's :
Yep, that's what it is.

I'm guessing that I can just put that code into the base.xml file?
Yep, but it's better in a .lua file, in case you get errors around it, as it will tell you the LUA file and the line number.

Also, if you don't want rolls dropped into the chat window to use targeting as default then change the return true; in the myOverride function to return false; Essentially this function is emulating what state the new toggle is in.

Blackfoot
February 24th, 2015, 05:53
Hmm.. tried putting it into data_common.lua ... that didn't fly... Hrm.
Script Error: [string "scripts/data_common.lua"]:810: attempt to index global 'ModifierStack' (a nil value)
Script Error: [string "desktop/scripts/modifierstack.lua"]:241: attempt to index global 'control' (a nil value)

Trenloe
February 24th, 2015, 06:16
Which data_common.lua file? The one in your ruleset or Core RPG?

Blackfoot
February 24th, 2015, 06:18
The one for the ruleset... obviously I can't mess with the CoreRPG one since I can only modify my ruleset. Is there a better place to put it? I get the impression that data_common.lua is getting loaded too soon for it to work properly.

Trenloe
February 24th, 2015, 06:25
Put it in it's own LUA file - so you know where your override functions are. Or call it modifierstack_override.lua so you know what it's actually doing. Put the ModifierStack.getTargeting = myOverride; code in an onInit() function so that it is called when the LUA file is loaded.


function onInit()
ModifierStack.getTargeting = myOverride;
end

function myOverride()
return true;
end

Blackfoot
February 24th, 2015, 08:18
Cool. Putting the first line into the onInit() kicked the problem. Thanks Trenloe.

Moon Wizard
February 26th, 2015, 03:16
It was caused by a bug in CoreRPG related to the new targeting toggle button on the modifier box, but only in local mode (i.e. Manage Characters). There is a fix in v3.0.11 in the Test channel.

Cheers,
JPG

Blackfoot
February 26th, 2015, 05:45
Awesome. Thanks...
I'll remove my tweak from my ruleset after 3.0.11 goes live.

Wait.. local mode? This was happening in the active version of my CoreRPG based ruleset. (I'm not sure I even have a local mode set up.. hmm maybe I should look into that...)

Trenloe
February 26th, 2015, 06:05
You'll still need the tweet as he targeting control doesn't exit in your ruleset.