Newb question about character control

Place to get help with not working mods / modding interface.
regoarrarr
Manual Inserter
Manual Inserter
Posts: 2
Joined: Fri May 07, 2021 11:50 am
Contact:

Newb question about character control

Post by regoarrarr »

I am exploring creating a mod to control the character and possibly TAS / speedrun. I am aware of

https://github.com/gotyoke/Factorio-AnyPct-TAS

Which did this for version 0.18. I am looking through that mod to see how it works, and running into an issue

it has a section


script.on_event(defines.events.on_tick, function(event)
local p = game.players[1]
....
p.begin_crafting(...)

On my 1.1 copy, this fails with an error

Error while running event tas-speedrun::on_tick (ID 0)
No manual crafter.

After reading a bit, I believe that this is because it starts when the cutscene is running (see viewtopic.php?f=25&t=87938&p=507525 ), so the player is not necessarily a character. I looked to check the controller_type of the player but when I print it out, it's just nil

Can anyone point me to a simple mod that does something like this, or help me know what to check?
regoarrarr
Manual Inserter
Manual Inserter
Posts: 2
Joined: Fri May 07, 2021 11:50 am
Contact:

Re: Newb question about character control

Post by regoarrarr »

Okay - I figured out one way to do it - I set up a cutscene_cancelled variable and In the method listening to on_tick, I return out of it if that variable is set to 0. Then I listen to on_cutscene_cancelled and set that variable to 1
Post Reply

Return to “Modding help”