Topic: call program

stonerl
Avatar
Topic Opener
Joined: 2018-07-30, 00:03 UTC+2.0
Posts: 327
Ranking
Tribe Member
Posted at: 2018-08-24, 02:40 UTC+2.0

How does this work when I want to specify the failure handling?

https://wl.widelands.org/documentation/productionsite_program/#call

"call = some_program on failure Fail"

crashes Wideland.

Edited: 2018-08-24, 08:41 UTC+2.0

Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 23:16 UTC+1.0
Posts: 2845
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2018-08-24, 07:38 UTC+2.0

Have you tried on failure Fail as described in the documentation?

Edited: 2018-08-24, 07:38 UTC+2.0

Top Quote
stonerl
Avatar
Topic Opener
Joined: 2018-07-30, 00:03 UTC+2.0
Posts: 327
Ranking
Tribe Member
Posted at: 2018-08-24, 08:41 UTC+2.0

hessenfarmer wrote:

Have you tried on failure Fail as described in the documentation?

Typo in the first post, sorry. Yes, as described in the documentation; this is the output:

Could not read tribes information: [/Users/toni/Launchpad/widelands-repo/working_tree/src/scripting/lua_errors.cc:22] [/Users/toni/Launchpad/widelands-repo/working_tree/src/scripting/lua_errors.cc:22] [/Users/toni/Launchpad/widelands-repo/working_tree/src/logic/map_objects/tribes/productionsite.cc:206] program work: unknown command type " ship on failure Fail" in production program "work" for building "barbarians_shipyard"
stack traceback:
    [string "tribes/buildings/productionsites/barbarians/s..."]:3: in main chunk
    [C]: in global 'include'
    [string "tribes/init.lua"]:433: in local 'func'
    [string "scripting/mapobjects.lLoading the tribes took 9116ms
Fatal exception: [/Users/toni/Launchpad/widelands-repo/working_tree/src/scripting/lua_errors.cc:22] [/Users/toni/Launchpad/widelands-repo/working_tree/src/scripting/lua_errors.cc:22] [/Users/toni/Launchpad/widelands-repo/working_tree/src/logic/map_objects/tribes/productionsite.cc:206] program work: unknown command type " ship on failure Fail" in production program "work" for building "barbarians_shipyard"
stack traceback:
    [string "tribes/buildings/productionsites/barbarians/s..."]:3: in main chunk
    [C]: in global 'include'
    [string "tribes/init.lua"]:433: in local 'func'
    [string "scripting/mapobjects.l
FATAL ERROR - game crashed. Attempting emergency save.
libc++abi.dylib: terminating with uncaught exception of type LuaError: [/Users/toni/Launchpad/widelands-repo/working_tree/src/scripting/lua_errors.cc:22] [/Users/toni/Launchpad/widelands-repo/working_tree/src/scripting/lua_errors.cc:22] [/Users/toni/Launchpad/widelands-repo/working_tree/src/logic/map_objects/tribes/productionsite.cc:206] program work: unknown command type " ship on failure Fail" in production program "work" for building "barbarians_shipyard"
stack traceback:
    [string "tribes/buildings/productionsites/barbarians/s..."]:3: in main chunk
    [C]: in global 'include'
    [string "tribes/init.lua"]:433: in local 'func'
    [string "scripting/mapobjects.l
Abort trap: 6

Top Quote
kaputtnik
Avatar
Joined: 2013-02-18, 20:48 UTC+1.0
Posts: 2683
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2018-08-24, 09:27 UTC+2.0

This part of the documentation is rather old (Year 2012). I guess this part of the documentation wasn't updated when changes to the code were made.

FYI: Some parts of the source code documentation does not live in the source code itself, instead it could be found in the subfolder doc/sphinx/source/, like the productionsite_program reference.


Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 23:16 UTC+1.0
Posts: 2845
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2018-08-24, 09:45 UTC+2.0

Please Post the complete lua file. From the error messages it seems you might have an syntax error


Top Quote
stonerl
Avatar
Topic Opener
Joined: 2018-07-30, 00:03 UTC+2.0
Posts: 327
Ranking
Tribe Member
Posted at: 2018-08-24, 10:32 UTC+2.0

@hessenfarmer

It's the barbarians shipyard init.lua

I just a added "on failure Fail" to the call.

"call = ship"

"call = ship on failure Fail"

nothing else changed.


Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 23:16 UTC+1.0
Posts: 2845
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2018-08-24, 10:55 UTC+2.0

Try fail instead of Fail. Futhermore I am not sure whether any spaces around the = are allowed.


Top Quote
stonerl
Avatar
Topic Opener
Joined: 2018-07-30, 00:03 UTC+2.0
Posts: 327
Ranking
Tribe Member
Posted at: 2018-09-04, 00:08 UTC+2.0

This worked:

"call=ship on failure fail",

Thanks.


Top Quote