Commit:
e5d2bbbf9e26da22dfc206542a838655810cc2b1 but i think works with older too.
I get a crash with a scenario i made.
In line 73 i tried to use {SCENARIOPATH} and scenarioDir() (both crashed) for the staticSound and i think there must be the problem. The game somehow cuts of some letters or even lines.
In 3.9.1 the scenario works fine but if i try with git i get:
Error loading lua code: Syntax error: [string "startup"]:61: unfinished string near ''/home/tscharn/.megaglest/scenarios/famine_bugl.'
Function name [startup]
code:
function startup()
objective=0
firstCowDying=true
firstMistletree=true
firstTimeKilledBySow=true
firstTimeWon=true
firstTimeLost=true
sows={}
--Faction Numbers
em=0
ee=1
ally=4
you=3
sow=2
--Functions
function dialog (dialogname)
if dialogname=="start" then
setCameraPosition(unitPosition(VikingKing))
playStaticSound('/home/tscharn/.megaglest/scenarios/famine_bug/speak.wav')
showMessage("s1","Narrator")
showMessage("s2","Viking")
end
if dialogname=="nofood" then
setCameraPosition(unitPosition(lastCreatedUnit()))
playStaticSound('/home/tscharn/.megaglest/scenarios/famine_bug/worker.wav')
showMessage("w1","Farmer")
showMessage("w2","Viking")
showMessage("w3","Farmer")
showMessage("w4","Viking")
showMessage("w5","Ally")
end
if dialogname=="allyAttacked" then
setCameraPosition({startLocation(ally)[1]-10,startLocation(ally)[2]})
playStaticSound('/home/tscharn/.megaglest/scenarios/famine_bug/speak2.wav')
showMessage("a1","Ally")
showMessage("a2","Viking")
end
if dialogname=="allySurvived" then
setCameraPosition(startLocation(you))
playStaticSound('/home/tscharn/.megaglest/scenarios/famine_bug/speak2.wav')
showMessage("a3","Ally")
showMessage("a4","Viking")
showMessage("a5","Ally")
end
if dialogname=="ownFood" then
setCameraPosition(unitPosition(lastCreatedUnit()))
playStaticSound('/home/tscharn/.megaglest/scenarios/famine_bug/worker.wav')
showMessage("f1","Farmer")
showMessage("f2","Viking")
end
if dialogname=="sowsCanKill" then
setCameraPosition(unitPosition(lastDeadUnit()))
playStaticSound('/home/tscharn/.megaglest/scenarios/famine_bug/speak2.wav')
showMessage("sow1","Ally")
showMessage("sow2","Viking")
showMessage("sow3","Ally")
end
if dialogname=="endGame" then
setCameraPosition(unitPosition(lastDeadUnit()))
playStaticSound('/home/tscharn/.megaglest/scenarios/famine_bugl.
sowsName=unitName(lastCreatedUnit())
moveSows()
sowTimer=startEfficientTimerEvent(9)
--sowsCellEvent="registerCellAreaTriggerEvent({1,140,95,207})"
--Tech Starting Units
createUnit('castle', em, startLocation(em))
createUnit('air_ballista', em, startLocation(em))
createUnit('defense_tower', em, {132,118})
createUnit('defense_tower', ee, {144,118})
createUnit('worker', em, startLocation(em))
createUnit('worker', em, startLocation(em))
createUnit('worker', em, startLocation(em))
createUnit('barracks', em, startLocation(em))
createUnit('air_ballista', em, startLocation(em))
createUnit('blacksmith', em, startLocation(em))
createUnit('cow', em, startLocation(em))
createUnit('pig', em, startLocation(em))
createUnit('farm', em, startLocation(em))
createUnit('castle', ee, startLocation(ee))
createUnit('worker', ee, startLocation(em))
createUnit('worker', ee, startLocation(em))
createUnit('pig', ee, startLocation(ee))
giveResource('gold', ee, 500)
giveResource('stone', ee, 500)
giveResource('wood', ee, 500)
giveResource('food', ee, 50)
giveResource('gold', em, 500)
giveResource('stone', em, 500)
giveResource('wood', em, 500)
giveResource('food', em, 50)
--Norse Starting
createUnit('castle', ally, startLocation(ally))
createUnit('thrull', ally, startLocation(ally))
createUnit('thrull', ally, startLocation(ally))
createUnit('house', ally, startLocation(ally))
createUnit('med_bar', ally, startLocation(ally))
createUnit('crossbow', ally, startLocation(ally))
createUnit('archer', ally, startLocation(ally))
createUnit('archer', ally, startLocation(ally))
createUnit('bone_tent', ally, startLocation(ally))
createUnit('battleaxe', ally, startLocation(ally))
createUnit('spearman', ally, startLocation(ally))
createUnit('spearman', ally, startLocation(ally))
createUnit('swordman', ally, startLocation(ally))
createUnit('axe_thrower', ally, startLocation(ally))
giveResource('gold', ally, 500)
giveResource('stone', ally, 500)
giveResource('wood', ally, 500)
giveResource('food', ally, 50)
--YOU
disableConsume(you)
for i=1, 3 do
createUnitNoSpacing('axe_thrower', you, {194,148})
createUnitNoSpacing('archer', you, {194,148})
createUnitNoSpacing('spearman', you, {194,148})
createUnitNoSpacing('swordman', you, {194,148})
end
createUnitNoSpacing('cudgel_lady', you, {194,148})
createUnitNoSpacing('battleaxe_berzerk', you, {194,148})
highlightUnit(lastCreatedUnit(), 1, 0.2, {1,1,1,0.7})
VikingKing=lastCreatedUnit()
VikingKingKills=0
--Starting Attackers
areAllDead=9
for i=1, 3 do
createUnitNoSpacing('archer', ee, {176,202})
givePositionCommand(lastCreatedUnit(), 'attack', startLocation(ally))
createUnitNoSpacing('catapult', ee, {176,202})
givePositionCommand(lastCreatedUnit(), 'attack', startLocation(ally))
createUnitNoSpacing('guard', ee, {176,202})
givePositionCommand(lastCreatedUnit(), 'attack', startLocation(ally))
end
--Dialog
dialog("start")
changeObjective(1)
enableAiTimer=startEfficientTimerEvent(23)
end
=========================================================
*ERROR* [2014-08-10 00:53:43] In [program.cpp::setState Line: 683]
Error [Error loading lua code: Syntax error: [string "startup"]:61: unfinished string near ''/home/tscharn/.megaglest/scenarios/famine_bugl.'
Stack Trace:
./megaglest:Shared::Platform::megaglest_runtime_error::megaglest_runtime_error(std::string const&, bool)address [0xb2b578] line: 305
./megaglest:Shared::Lua::LuaScript::loadCode(std::string, std::string)address [0xab7e00] line: 550
./megaglest:Glest::Game::ScriptManager::init(Glest::Game::World*, Glest::Game::GameCamera*, Shared::Xml::XmlNode const*)address [0x620164] line: 403
./megaglest:Glest::Game::Game::init(bool)address [0x58010e] line: 1377
./megaglest:Glest::Game::Program::setState(Glest::Game::ProgramState*, bool)address [0x719cec] line: 659
./megaglest:Glest::Game::MenuStateScenario::launchGame()address [0x743367] line: 406
./megaglest:Glest::Game::MenuStateScenario::update()address [0x744be9] line: 373
./megaglest:Glest::Game::Program::loopWorker()address [0x71d81b] line: 476
./megaglest:Glest::Game::glestMain(int, char**)address [0x70ae8b] line: 5516
./megaglest:Glest::Game::glestMainSEHWrapper(int, char**)address [0x70e52a] line: 5764
/lib/x86_64-linux-gnu/libc.so.6:__libc_start_main()address [0x7f8823f5878d] line: 0
./megaglest() [0x50ca19]address [0x50ca19]
]
In [/home/tscharn/gitglest/source/glest_game/main/main.cpp::handleSIGSEGV Line: 5667] Error detected: signal 11:
Error saved to logfile [/home/tscharn/.megaglest/error.log]
*ERROR* [2014-08-10 00:53:44] In [/home/tscharn/gitglest/source/glest_game/main/main.cpp::handleRuntimeError Line: 641] [In [/home/tscharn/gitglest/source/glest_game/main/main.cpp::handleSIGSEGV Line: 5667] Error detected: signal 11:
] gameInitialized = 1, program = 0x2c2be60
*ERROR* [2014-08-10 00:53:45] In [/home/tscharn/gitglest/source/glest_game/main/main.cpp::handleRuntimeError Line: 660] [In [/home/tscharn/gitglest/source/glest_game/main/main.cpp::handleSIGSEGV Line: 5667] Error detected: signal 11:
Stack Trace:
./megaglest:Glest::Game::ExceptionHandler::handleRuntimeError(char const*, bool)address [0x700fe8] line: 651
./megaglest() [0x70126f]address [0x70126f]
/lib/x86_64-linux-gnu/libc.so.6:()address [0x7f8823f6d570] line: 0
./megaglest:Glest::Game::Game::update()address [0x595d6d] line: 2055
./megaglest:Glest::Game::Program::loopWorker()address [0x71d81b] line: 476
./megaglest:Glest::Game::glestMain(int, char**)address [0x70ae8b] line: 5516
./megaglest:Glest::Game::glestMainSEHWrapper(int, char**)address [0x70e52a] line: 5764
/lib/x86_64-linux-gnu/libc.so.6:__libc_start_main()address [0x7f8823f5878d] line: 0
./megaglest() [0x50ca19]address [0x50ca19]
]
Segmentation fault (core dumped)
Error loading lua code: Syntax error: [string "startup"]:73: unfinished string near ''/home/tscharn/.megaglest/scenariost" XD"lastCreatedUnit())'
Function name [startup]
code:
function startup()
objective=0
firstCowDying=true
firstMistletree=true
firstTimeKilledBySow=true
firstTimeWon=true
firstTimeLost=true
spawnSows=true
moreFood=false
sows={}
--Faction Numbers
em=0
ee=1
ally=4
you=3
sow=2
--Functions
function dialog (dialogname)
if dialogname=="start" then
setCameraPosition(unitPosition(VikingKing))
playStaticSound('/home/tscharn/.megaglest/scenarios/famine/speak.wav')
showMessage("s1","Narrator")
showMessage("s2","Viking")
end
if dialogname=="nofood" then
setCameraPosition(unitPosition(lastCreatedUnit()))
playStaticSound('/home/tscharn/.megaglest/scenarios/famine/worker.wav')
showMessage("w1","Farmer")
showMessage("w2","Viking")
showMessage("w3","Farmer")
showMessage("w4","Viking")
showMessage("w5","Ally")
end
if dialogname=="allyAttacked" then
setCameraPosition({startLocation(ally)[1]-10,startLocation(ally)[2]})
playStaticSound('/home/tscharn/.megaglest/scenarios/famine/speak2.wav')
showMessage("a1","Ally")
showMessage("a2","Viking")
end
if dialogname=="allySurvived" then
setCameraPosition(startLocation(you))
playStaticSound('/home/tscharn/.megaglest/scenarios/famine/speak2.wav')
showMessage("a3","Ally")
showMessage("a4","Viking")
showMessage("a5","Ally")
end
if dialogname=="ownFood" then
setCameraPosition(unitPosition(lastCreatedUnit()))
playStaticSound('/home/tscharn/.megaglest/scenarios/famine/worker.wav')
showMessage("f1","Farmer")
showMessage("f2","Viking")
end
if dialogname=="moreFood" then
playStaticSound('/home/tscharn/.megaglest/scenarios/famine/worker.wav')
showMessage("f3","Farmer")
showMessage("f4","Viking")
end
if dialogname=="endSows" then
playStaticSound('/home/tscharn/.megaglest/scenarios/famine/worker.wav')
showMessage("sow4","Farmer")
showMessage("sow5","Viking")
end
if dialogname=="sowsCanKill" then
setCameraPosition(unitPosition(lastDeadUnit()))
playStaticSound('/home/tscharn/.megaglest/scenarios/famine/speak2.wav')
showMessage("sow1","Ally")
showMessage("sow2","Viking")
showMessage("sow3","Ally")
end
if dialogname=="endGame" then
setCameraPosition(unitPosition(lastDeadUnit()))
playStaticSound('/home/tscharn/.megaglest/scenariost" XD"lastCreatedUnit())
createUnit('air_ballista', em, startLocation(em))
createUnit('defense_tower', em, {132,118})
createUnit('defense_tower', ee, {144,118})
createUnit('worker', em, startLocation(em))
createUnit('worker', em, startLocation(em))
createUnit('worker', em, startLocation(em))
createUnit('barracks', em, startLocation(em))
createUnit('air_ballista', em, startLocation(em))
createUnit('blacksmith', em, startLocation(em))
createUnit('cow', em, startLocation(em))
createUnit('pig', em, startLocation(em))
createUnit('farm', em, startLocation(em))
createUnit('castle', ee, startLocation(ee))
createUnit('worker', ee, startLocation(em))
createUnit('worker', ee, startLocation(em))
createUnit('pig', ee, startLocation(ee))
giveResource('gold', ee, 500)
giveResource('stone', ee, 500)
giveResource('wood', ee, 500)
giveResource('food', ee, 50)
giveResource('gold', em, 500)
giveResource('stone', em, 500)
giveResource('wood', em, 500)
giveResource('food', em, 50)
--Norse Starting
createUnit('castle', ally, startLocation(ally))
createUnit('thrull', ally, startLocation(ally))
createUnit('thrull', ally, startLocation(ally))
createUnit('house', ally, startLocation(ally))
createUnit('med_bar', ally, startLocation(ally))
createUnit('crossbow', ally, startLocation(ally))
createUnit('archer', ally, startLocation(ally))
createUnit('archer', ally, startLocation(ally))
createUnit('bone_tent', ally, startLocation(ally))
createUnit('battleaxe', ally, startLocation(ally))
createUnit('spearman', ally, startLocation(ally))
createUnit('spearman', ally, startLocation(ally))
createUnit('swordman', ally, startLocation(ally))
createUnit('axe_thrower', ally, startLocation(ally))
giveResource('gold', ally, 500)
giveResource('stone', ally, 500)
giveResource('wood', ally, 500)
giveResource('food', ally, 50)
--YOU
disableConsume(you)
for i=1, 30 do
createUnitNoSpacing('axe_thrower', you, {194,148})
createUnitNoSpacing('archer', you, {194,148})
createUnitNoSpacing('spearman', you, {194,148})
createUnitNoSpacing('swordman', you, {194,148})
end
createUnitNoSpacing('cudgel_lady', you, {194,148})
createUnitNoSpacing('battleaxe_berzerk', you, {194,148})
highlightUnit(lastCreatedUnit(), 1, 0.2, {1,1,1,0.7})
VikingKing=lastCreatedUnit()
VikingKingKills=0
--Starting Attackers
areAllDead=9
for i=1, 3 do
createUnitNoSpacing('archer', ee, {176,202})
givePositionCommand(lastCreatedUnit(), 'attack', startLocation(ally))
createUnitNoSpacing('catapult', ee, {176,202})
givePositionCommand(lastCreatedUnit(), 'attack', startLocation(ally))
createUnitNoSpacing('guard', ee, {176,202})
givePositionCommand(lastCreatedUnit(), 'attack', startLocation(ally))
end
--Dialog
dialog("start")
changeObjective(1)
enableAiTimer=startEfficientTimerEvent(23)
end
=========================================================
*ERROR* [2014-08-10 00:24:48] In [program.cpp::setState Line: 683]
Error [Error loading lua code: Syntax error: [string "startup"]:73: unfinished string near ''/home/tscharn/.megaglest/scenariost" XD"lastCreatedUnit())'
Stack Trace:
./megaglest:Shared::Platform::megaglest_runtime_error::megaglest_runtime_error(std::string const&, bool)address [0xb2b578] line: 305
./megaglest:Shared::Lua::LuaScript::loadCode(std::string, std::string)address [0xab7e00] line: 550
./megaglest:Glest::Game::ScriptManager::init(Glest::Game::World*, Glest::Game::GameCamera*, Shared::Xml::XmlNode const*)address [0x620164] line: 403
./megaglest:Glest::Game::Game::init(bool)address [0x58010e] line: 1377
./megaglest:Glest::Game::Program::setState(Glest::Game::ProgramState*, bool)address [0x719cec] line: 659
./megaglest:Glest::Game::MenuStateScenario::launchGame()address [0x743367] line: 406
./megaglest:Glest::Game::MenuStateScenario::mouseClick(int, int, Shared::Platform::MouseButton)address [0x745c5b] line: 240
./megaglest:Glest::Game::MainWindow::eventMouseDown(int, int, Shared::Platform::MouseButton)address [0x6e22c5] line: 886
./megaglest:Shared::Platform::Window::handleMouseDown(SDL_Event)address [0xb356a5] line: 677
./megaglest:Shared::Platform::Window::handleEvent()address [0xb365af] line: 162
./megaglest:Glest::Game::glestMain(int, char**)address [0x70ae67] line: 5429
./megaglest:Glest::Game::glestMainSEHWrapper(int, char**)address [0x70e52a] line: 5764
/lib/x86_64-linux-gnu/libc.so.6:__libc_start_main()address [0x7f714c5eb78d] line: 0
./megaglest() [0x50ca19]address [0x50ca19]
]
In [/home/tscharn/gitglest/source/glest_game/main/main.cpp::handleSIGSEGV Line: 5667] Error detected: signal 11:
Error saved to logfile [/home/tscharn/.megaglest/error.log]
*ERROR* [2014-08-10 00:24:48] In [/home/tscharn/gitglest/source/glest_game/main/main.cpp::handleRuntimeError Line: 641] [In [/home/tscharn/gitglest/source/glest_game/main/main.cpp::handleSIGSEGV Line: 5667] Error detected: signal 11:
] gameInitialized = 1, program = 0x3187e60
*ERROR* [2014-08-10 00:24:49] In [/home/tscharn/gitglest/source/glest_game/main/main.cpp::handleRuntimeError Line: 660] [In [/home/tscharn/gitglest/source/glest_game/main/main.cpp::handleSIGSEGV Line: 5667] Error detected: signal 11:
Stack Trace:
./megaglest:Glest::Game::ExceptionHandler::handleRuntimeError(char const*, bool)address [0x700fe8] line: 651
./megaglest() [0x70126f]address [0x70126f]
/lib/x86_64-linux-gnu/libc.so.6:()address [0x7f714c600570] line: 0
./megaglest:Glest::Game::Game::update()address [0x595d6d] line: 2055
./megaglest:Glest::Game::Program::loopWorker()address [0x71d81b] line: 476
./megaglest:Glest::Game::glestMain(int, char**)address [0x70ae8b] line: 5516
./megaglest:Glest::Game::glestMainSEHWrapper(int, char**)address [0x70e52a] line: 5764
/lib/x86_64-linux-gnu/libc.so.6:__libc_start_main()address [0x7f714c5eb78d] line: 0
./megaglest() [0x50ca19]address [0x50ca19]
]
Segmentation fault (core dumped)
How to reproduce:
just start this scenario (you need the map "lost river" from mod-center for this)The download contains the scenario with {SCENARIOPATH}. Change the function dialog to this to get the other crash:
EDIT: Titi tried this too and he only crashes with {SCENARIOPATH}
function dialog (dialogname)
if dialogname=="start" then
setCameraPosition(unitPosition(VikingKing))
playStaticSound(scenarioDir()..'/speak.wav')
showMessage("s1","Narrator")
showMessage("s2","Viking")
end
if dialogname=="nofood" then
setCameraPosition(unitPosition(lastCreatedUnit()))
playStaticSound(scenarioDir()..'/worker.wav')
showMessage("w1","Farmer")
showMessage("w2","Viking")
showMessage("w3","Farmer")
showMessage("w4","Viking")
showMessage("w5","Ally")
end
if dialogname=="allyAttacked" then
setCameraPosition({startLocation(ally)[1]-10,startLocation(ally)[2]})
playStaticSound(scenarioDir()..'/speak2.wav')
showMessage("a1","Ally")
showMessage("a2","Viking")
end
if dialogname=="allySurvived" then
setCameraPosition(startLocation(you))
playStaticSound(scenarioDir()..'/speak2.wav')
showMessage("a3","Ally")
showMessage("a4","Viking")
showMessage("a5","Ally")
end
if dialogname=="ownFood" then
setCameraPosition(unitPosition(lastCreatedUnit()))
playStaticSound(scenarioDir()..'/worker.wav')
showMessage("f1","Farmer")
showMessage("f2","Viking")
end
if dialogname=="sowsCanKill" then
setCameraPosition(unitPosition(lastDeadUnit()))
playStaticSound(scenarioDir()..'/speak2.wav')
showMessage("sow1","Ally")
showMessage("sow2","Viking")
showMessage("sow3","Ally")
end
if dialogname=="endGame" then
setCameraPosition(unitPosition(lastDeadUnit()))
playStaticSound(scenarioDir()..'/speak2.wav')
showMessage("end1","Ally")
showMessage("end2","Viking")
showMessage("end3","Ally")
showMessage("end4","Viking")
end
togglePauseGame(1)
end
I am using Ubuntu 12.04.