Sandbox buttons and mods
Posted: Mon Feb 23, 2015 11:42 pm
In sandbox scenario, there is two questions with two buttons, one to accept, the other to refuse ...
The main problem is that when you uses some mods that asks questions at the same time like test mode, it would consider that they have been answered since a button has been triggered.
Firstly, you can simply make theses changes :
Replace :
by
Replace :
by
Secondly, I may ask you if there is a correct way to insert a question like that after (or before) they appear ?
The main problem is that when you uses some mods that asks questions at the same time like test mode, it would consider that they have been answered since a button has been triggered.
Firstly, you can simply make theses changes :
Replace :
Code: Select all
function(event)
if event.name == defines.events.onguiclick then
local player = game.getplayer(event.playerindex)
if event.element.name == "button_use_chest" then
buildstartingchest(player)
end
player.gui.top.button_use_chest.destroy()
player.gui.top.button_no_chest.destroy()
return true
end
return false
end
Code: Select all
function(event)
if event.name == defines.events.onguiclick then
local player = game.getplayer(event.playerindex)
if event.element.name == "button_use_chest" then
buildstartingchest(player)
elseif event.element.name ~= "button_no_chest" then
return false
end
player.gui.top.button_use_chest.destroy()
player.gui.top.button_no_chest.destroy()
return true
end
return false
end
Code: Select all
function(event)
if event.name == defines.events.onguiclick then
local player = game.getplayer(event.playerindex)
if event.element.name == "button_technologies_researched" then
player.force.researchalltechnologies()
end
player.gui.top.button_technologies_researched.destroy()
player.gui.top.button_technologies_normal.destroy()
return true
end
return false
end
Code: Select all
function(event)
if event.name == defines.events.onguiclick then
local player = game.getplayer(event.playerindex)
if event.element.name == "button_technologies_researched" then
player.force.researchalltechnologies()
elseif event.element.name ~= "button_technologies_normal" then
return false
end
player.gui.top.button_technologies_researched.destroy()
player.gui.top.button_technologies_normal.destroy()
return true
end
return false
end