Page 1 of 1

"Menu simulation" problem

Posted: Fri Oct 17, 2025 10:34 am
by Artenchink
I have a problem with menu simulations. I making my mode "Quatorio" (Never will published. I mading it only for me) and I want to made in him some menu simulations like in space exploration or in base game. I made scene in map editor but... It doesnt working. Code was maded by ChatGPT, so it doesnt work :? Can someone give me a code from his own mode or made it? :| (With paths please)

There are path of Quatorio menu-simulations (Path from space-age or base mode): Quatorio/menu-simulations/menu-simulations.lua

Thanks for help :D

Re: "Menu simulation" problem

Posted: Mon Oct 20, 2025 12:27 pm
by Artenchink
Its working now :D
Made 3 menu simulations and making others... 8-)

Re: "Menu simulation" problem

Posted: Tue Oct 21, 2025 11:15 am
by Artenchink
Who need help with menu simulations you need -
To record it:
1. Make location with your factory or what you want
2. Save as game (Not scenario!) and find it in folder "saves" :!:
3. Make in folder of your mode new folder. Rename it in menu-simulations
4. Make in menu-simulations folder menu-simulations.lua
5. Move your saved game in menu-simulations folder
Now coding:
1. Use example of this code (You can read comments it will help you):

Code: Select all

local menu_simulations = {}

menu_simulations["Yoursimulation"] = -- Simulation name
{
  checkboard = false,
  save = "__Yourmodname__/menu-simulations/Simulation.zip", -- Path of your simulation
  length = 60 * 20, -- How much it will be recording (60 * 20 = 20 seconds)
init =
[[
  game.simulation.camera_position = {-89, -28} -- Position of camera
  game.simulation.camera_zoom = 1 -- Zoom of camera
  game.tick_paused = false
  game.surfaces.nauvis.daytime = 0
]],
  update =
  [[
    local dx = 0
    local dy = 0
    if game.tick % 3000 < 1000 then
      dx = 0.01
    elseif game.tick % 3000 < 2000 then
      dx = -0.01
    end
    if (game.tick + 1500) % 3000 < 1000 then
      dy = 0.01
    elseif (game.tick + 1500) % 3000 < 2000 then
      dy = -0.01
    end
    game.simulation.camera_position = {game.simulation.camera_position.x + dx*0, game.simulation.camera_position.y + dy*0}
  ]]
}
How to make correct position of camera:
1. Press F4
2. Press on button "show detailed info"
3. Close F4 mode
4. Move your mouse to right position
5. Photo your position of mouse (Example x = -12, y = 20)
6. In menu-simulation.lua in camera position write "x" and "y"

Code: Select all

game.simulation.camera_position = {-12, 20}
Now make data-final-fixes.lua:
1. Make it in folder of your mode
2. Use this example:

Code: Select all

local menu_simulations = require("__Yourmodename__/menu-simulations/menu-simulations")

data.raw["utility-constants"]["default"].main_menu_simulations = {
  your_simulation_name = menu_simulations["Yoursimulation"]
}
Test it! :D