Creating Custom AIs

The place to post your WML questions and answers.

Moderator: Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Post Reply
vghetto
Posts: 755
Joined: November 2nd, 2019, 5:12 pm

Creating Custom AIs

Post by vghetto »

Hi,

The example shown on the wiki is throwing lua errors.
https://wiki.wesnoth.org/Creating_Custom_AIs

I think the passed cfg argument is null.

Code: Select all

20220118 21:19:25 error scripting/lua: ~add-ons/Bug_Tester/lua/return_guardian.lua:42: bad argument #1 to 'find_vacant_tile' (location expected, got nil)
stack traceback:
        [C]: in field 'find_vacant_tile'
        ~add-ons/Bug_Tester/lua/return_guardian.lua:42: in field 'execution'
        [string "local self, params, data = ......"]:2: in main chunk
Edit:
Commenting out [args] and using eval_parms= and exec_parms= seems to fix it.

Edit2:
This is confusing af.
[args] works by I had to make cfg the first argument :/
Just make that the default shown in the example.
User avatar
Celtic_Minstrel
Developer
Posts: 2166
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Creating Custom AIs

Post by Celtic_Minstrel »

Yeah, it looks like the example is wrong, so feel free to update it with what actually works.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
Post Reply