Page 1 of 1

[0.15.28] Noob with scripting.

Posted: Fri Apr 10, 2020 9:30 pm
by Ertuit
Hello,
A very long time ago (I know the 0.15.28 is a old experimental version of the game hidden in the internet), I started my map.
Today I want to make a timelapse of this map with the replay founction.
So I found the 0.15.28 version and download it because the game say me that "You need 0.15.28 version to replay this world". (on a russian website because it not longuer exist on the official website...)

I make the test screenshot and the format of the screenshot that have to be made every minutes.
I watch this video : https://www.youtube.com/watch?v=LIQ4arZlaYI
The result of the test was very good.
But I have many problem with the script because the fonction "script.on_nth_tick" did not exist at this time.
So I manage to have this script who have a problem, the screenshot name.

----------

Code: Select all

script.on_event(defines.events.on_tick, function(event)
   if event.tick % 3600 == 0 then --every 60 seconds
	local counter = event.tick / 3600

        game.surfaces[1].daytime = 0
	game.take_screenshot{
  	  surface = game.surfaces[1],
  	  position = {150,-150},
  	  resolution = {16000,13000},
 	  zoom = 0.5,
 	  path = "timelapse/" .. string.format("%06d" , event.tick/on_nth_tick) .. ".png",
	  show_entitiy_info = true,
 	 }
   end
end)
----------
Victory, I can enter the game with the timelapse script ( I've manage to replace the on_nth_tick on the begining of the script ).... But it instantly returns to the menu and say that the string format is invalid (normal) because the "on_nth_tick " event did not exist.

(I've put the script in a copy of the save file and add the script at the top in the control.lua file, always in the zip of the save.)

I'm stuck here. In a ideal world I would like to have my screenshot named from 0 to (the infinity) or anything else like that.

This is a old experimental version of the game and I know it's not longer supported.

Thank you for your time and your help. :)
Ertuit.

Re: [0.15.28] Noob with scripting.

Posted: Sat Apr 11, 2020 12:48 pm
by Ertuit
Oh...
Nevermind. I found the solution. I've just replace the string format by

Code: Select all

path = "timelapse/" .. string.format("%06d" , game.tick) .. ".png",
And done the complete code is that (for people who need a script like that:) )

Code: Select all

script.on_event(defines.events.on_tick, function(event)
   if event.tick % 25000 == 0 then --every factorio day to have sunlight without desync
	local counter = event.tick / 3600
	
	game.take_screenshot{
    surface = game.surfaces[1],
    position = {150,-150},
    resolution = {16000,13000},
    zoom = 0.5,
    path = "timelapse/" .. string.format("%06d" , game.tick) .. ".png",
    show_entitiy_info = true,
  }

   end
end)
I also change the interval to match the cycle of day in factorio and delete the line of "set sunlight" and always have sunlight at maximum on the screenshot.
Thanks anyway :).
Ertuit