Grab the latest ranged_attacks.lua from the scripts folder on GitHub (it's not updated in the in the INSTALL VERSIONS folder), it looks to have this issue fixed. Alternatively, you can do what I did and edit the file; within the if block on lines 413-449, move the "Spell Action version 1" block to before the "Weapon version 1" block.
The result ends up looking something like this:
Code:
-- Spell action version 1
-- this exception is needed as some modules have a slightly different range entries
-- where spell entries on NPCs are put under actions, and only one range is available
-- string input ex. 'Ranged Spell Attack: +5 to hit, range 150 ft., one target. Hit: 10 (3d6) fire damage. ...'
rangeText = string.match(description, "ranged?%s%d+");
if rangeText ~= nil then
medRange = string.sub(rangeText, 7, string.len(rangeText));
maxRange = medRange;
end
-- Weapon version 1
-- search for 'range * ft', return range as substring, split substring in two (medium/max range)
-- string input ex. 'Thrown (range 30/120)'' and 'range 30/120 ft.''
rangeText = string.match(description, "ranged?%s%d+/%d+");
if rangeText ~= nil then
-- find '/' index
-- medRange = start of numbers to before index
-- maxRange = after index to end
local index = string.find(rangeText, '/');
medRange = string.sub(rangeText, 7, index - 1);
maxRange = string.sub(rangeText, index + 1, string.len(rangeText));
end
-- Weapon version 2
-- this exception is needed as some modules have a slightly different range entries
-- string input ex. 'Thrown (range 30 ft./120)'' and 'range 30 ft./120 ft.''
rangeText = string.match(description, "ranged?%s%d+%s?[a-zA-Z]+\.?/%d+");
if rangeText ~= nil then
local index = string.find(rangeText, '/');
medRange = string.match(string.sub(rangeText, 7, index), "%d+");
maxRange = string.sub(rangeText, index + 1, string.len(rangeText));
end
In that snippet also corrected the regex from * to + (match one or more digits rather than match zero or more), and made it more forgiving towards the effect wording. Any combination of the following variations will work with it:
ranged 150/600 (ranged instead of range)
range 150ft./600 (no space between 150 and ft.)
range 150 ft/600 (no period in ft.)
range 150 m/600 (any unit of any character length)
Open up ranged_attacks.lua from Token Helper. Go to around line 516 and change:
local rangeText = string.match(description, "%d*");
to:
local rangeText = string.match(description, "%d+");
Then just edit the spell in FG (may need to add it to the character's sheet first), and add the range. For Produce Flame I've got Self, 30ft; Radiant Sun Bolt is the same just without Self. The code change for this part ensures that it won't match an empty string and get a range of "" from "Self, 30"
This gets me the correct output of "The ranged attack is OUT OF RANGE and misses. Produce Flame (30) from 540 feet."