Currently Online

Latest Posts

Topic: call program

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

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

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

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

Edited: 2018-08-24, 07:38

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

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
Posts: 2433
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2018-08-24, 09:27

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.


Fight simulator for Widelands:
https://wide-fighter.netlify.app/

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

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
Posts: 327
Ranking
Tribe Member
Posted at: 2018-08-24, 10:32

@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
Posts: 2646
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2018-08-24, 10:55

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
Posts: 327
Ranking
Tribe Member
Posted at: 2018-09-04, 00:08

This worked:

"call=ship on failure fail",

Thanks.


Top Quote