Help with fuel script please
Posted: Wed Feb 12, 2020 2:35 pm
I am trying to script an even that refuels all of the neutral fishing boats once each day for a multi-day scenario.
Tried the script below but it only changed the first entry, dhow "Nitram Krim"
local u = ScenEdit_SetUnit({name='Nitram Krim', guid='mj68dm-0hltfr138ctdj', name='Nazrim Krim', guid='mj68dm-0hltfr138ctd7', name='Abdulllah', guid='mj68dm-0hltfr138ctd1', name='Jag Rhadna', guid='mj68dm-0hltfr138ct7g', name='Aperradee Narrhee', guid='mj68dm-0hltfr138ctdd'})
local fuel = u.fuel
fuel[3001].current = 200
u.fuel = fuel
Tried to enclose all entries in curly brackets as below but got an error message that I cannot make sense of:
local u = ScenEdit_SetUnit({name='Nitram Krim', guid='mj68dm-0hltfr138ctdj'}, {name='Nazrim Krim', guid='mj68dm-0hltfr138ctd7'}, {name='Abdulllah', guid='mj68dm-0hltfr138ctd1'}, {name='Jag Rhadna', guid='mj68dm-0hltfr138ct7g'}, (name='Aperradee Narrhee', guid='mj68dm-0hltfr138ctdd'})
local fuel = u.fuel
fuel[3001].current = 200
u.fuel = fuel
ERROR: [string "Console"]:1: ')' expected near '='
and
local u = ScenEdit_SetUnit({{name='Nitram Krim', guid='mj68dm-0hltfr138ctdj'}, {name='Nazrim Krim', guid='mj68dm-0hltfr138ctd7'}, {name='Abdulllah', guid='mj68dm-0hltfr138ctd1'}, {name='Jag Rhadna', guid='mj68dm-0hltfr138ct7g'}, (name='Aperradee Narrhee', guid='mj68dm-0hltfr138ctdd'}})
local fuel = u.fuel
fuel[3001].current = 200
u.fuel = fuel
ERROR: [string "Console"]:1: ')' expected near '='
I could script each vessel individually but that's clunky and does not solve for the other requirement of the script; that should any vessel be destroyed, the script will still fire for the remainder without delivering an error message. I think I may be close but am more likely just deluded.
Thanks in advance for any help. I would rather not post the scenario here as it is not yet ready for its public debut but will send it via PM if it helps with the assistance process.
-C
Tried the script below but it only changed the first entry, dhow "Nitram Krim"
local u = ScenEdit_SetUnit({name='Nitram Krim', guid='mj68dm-0hltfr138ctdj', name='Nazrim Krim', guid='mj68dm-0hltfr138ctd7', name='Abdulllah', guid='mj68dm-0hltfr138ctd1', name='Jag Rhadna', guid='mj68dm-0hltfr138ct7g', name='Aperradee Narrhee', guid='mj68dm-0hltfr138ctdd'})
local fuel = u.fuel
fuel[3001].current = 200
u.fuel = fuel
Tried to enclose all entries in curly brackets as below but got an error message that I cannot make sense of:
local u = ScenEdit_SetUnit({name='Nitram Krim', guid='mj68dm-0hltfr138ctdj'}, {name='Nazrim Krim', guid='mj68dm-0hltfr138ctd7'}, {name='Abdulllah', guid='mj68dm-0hltfr138ctd1'}, {name='Jag Rhadna', guid='mj68dm-0hltfr138ct7g'}, (name='Aperradee Narrhee', guid='mj68dm-0hltfr138ctdd'})
local fuel = u.fuel
fuel[3001].current = 200
u.fuel = fuel
ERROR: [string "Console"]:1: ')' expected near '='
and
local u = ScenEdit_SetUnit({{name='Nitram Krim', guid='mj68dm-0hltfr138ctdj'}, {name='Nazrim Krim', guid='mj68dm-0hltfr138ctd7'}, {name='Abdulllah', guid='mj68dm-0hltfr138ctd1'}, {name='Jag Rhadna', guid='mj68dm-0hltfr138ct7g'}, (name='Aperradee Narrhee', guid='mj68dm-0hltfr138ctdd'}})
local fuel = u.fuel
fuel[3001].current = 200
u.fuel = fuel
ERROR: [string "Console"]:1: ')' expected near '='
I could script each vessel individually but that's clunky and does not solve for the other requirement of the script; that should any vessel be destroyed, the script will still fire for the remainder without delivering an error message. I think I may be close but am more likely just deluded.
Thanks in advance for any help. I would rather not post the scenario here as it is not yet ready for its public debut but will send it via PM if it helps with the assistance process.
-C
