lua error - where are lua/wml-flow.lua & lua/wml-utils.lua?

Discussion of Lua and LuaWML support, development, and ideas.

Moderator: Forum Moderators

Post Reply
User avatar
chol
Posts: 49
Joined: September 9th, 2015, 11:19 am

lua error - where are lua/wml-flow.lua & lua/wml-utils.lua?

Post by chol »

Hi guys!

Im am creating a faction.
Basically, I try to recruit units next hex by in-game menu items.
I have edited and modified from source: Ageless_Era/data/EoMa_data/abilities-summon.cfg

In local game multiplayer, I got lua errors on version 1.13.7, saying:

Code: Select all

<Lua error> lua/wml-tags.lua:1126: bad argument #1 to 'tonumber' (value expected)
	stack traceback:
		[C]: in function '.tonumber'
		lua/wml-tags.lua:1126 in local 'cmd'
		lua/wml-utils.lua:137: in field 'handle_event_commands'
		lua/wml-flow.lua:38: in local 'cmd'
		lua/wml-utils.lua:137: in field 'handle_event_commands'
		lua/wml-flow.lua:20: in local 'cmd'
		lua/wml-utils.lua:137: in field 'handle_event_commands'
		lua/wml-flow.lua:6: in fuction <lua/wml-flow.lua:5>
What are this '#1', '.tonumber' (or 'tonumber')?
And where are lua/wml-flow.lua & lua/wml-utils.lua locations, can't find them in the game data directory?


Code: Select all

#define KABBALAH_MENU_LVL1
    {KABBALAHGOLEM_MENU_ITEM 6_1_1 (Clod Golem) 18 kabbalahlvl1 (IVKA_clod_golem)}
#enddef

#define ABILITY_KABBALAH_LVL1
    [dummy]
        id=kabbalahlvl1
        name= _ "kabbalah"
        description= _ "This holy unit can do practical kabbalah to animate a golem. The unit will form a golem shape out of clay or earth and will do holy practical kabbalah in spiritual repose and peace for a hole turn and animate the golem. It will then appear on a hex next to it. Due to level 1 it will create only small clay golems."
    [/dummy]
[/abilities]
[event]
    name=start
    [if]
        [have_unit]
            ability=kabbalahlvl1
        [/have_unit]
        [then]
            {KABBALAH_MENU_LVL1}
        [/then]
    [/if]
[/event]
[event]
    name=recruit
    [filter]
        ability=kabbalahlvl1
    [/filter]
    {KABBALAH_MENU_LVL1}
[/event]
[event]
    name=post_advance
    [filter]
        ability=kabbalahlvl1
    [/filter]
    {KABBALAH_MENU_LVL1}
[/event]
[+abilities]
#enddef

Code: Select all

#define KABBALAHGOLEM_MENU_ITEM ID DESCRIPTION COST ABILITY UNIT
    [event]
        name=select
        first_time_only=no
        [filter]
            type="IVKA_rav, IVKA_posek, IVKA_gaon, IVKA_navi"
            side=$side_number
        [/filter]
        [store_unit]
            [filter]
                x,y=$x1,$y1
            [/filter]
            variable=last_selected_unit
        [/store_unit]
    [/event]
    [set_menu_item]
        id=kabbalah_{ID}
        description= _ "Practically kabbalah a {DESCRIPTION} ({COST}gold)"
        [show_if]
        [/show_if]

        [filter_location]
            [filter_adjacent_location]
                [filter]
                    ability={ABILITY}
                    side=$side_number
                    [filter_wml]
                        moves=$this_unit.max_moves
                    [/filter_wml]
                    [filter_location]
			terrain="*^Vda,*^Vdt,*^Vct,*^Vea,*^Ve,*^Vh,*^Vha,*^Vhr,*^Vhc,*^Vwm,*^Vhca,*^Vhcr,*^Vhh,*^Vhha,*^Vhhr,*^Vht,*^Vd,*^Vu,*^Vud,*^Vc,*^Vca,*^Vl,*^Vla,*^Vhs,Ce,Cea,Ch,Cha,Cv,Cud,Chr,Chs,Cd,Cdr,Ke,Ket,Kea,Kh,Kha,Kv,Kud,Khr,Khs,Kd,Kdr,*^Cov,*^Kov,*^Vov"
			[not] terrain="*^Voa,*^Vo,Co,Coa,Ko,Koa"
			[/not]
                    [/filter_location]
                [/filter]
            [/filter_adjacent_location]
            [not]
                [filter]
                [/filter]
                [or] terrain="_off^_usr,Xv,*^Xo,*^Qov,Xol,Xos,Xuce,Xue,Xuc,Xu,Qxu,Qxe,Qxua,Ql,Qlf,Mv,Mm^Xm,Md^Xm,Ms^Xm,Wog,Wo,Wot"
                [/or]
            [/not]
        [/filter_location]
        [command]
            [store_gold]
                variable=actualgold
                side=$side_number
            [/store_gold]
            [if]
                [variable]
                    name=actualgold
                    greater_than_equal_to={COST}
                [/variable]
                [then]
                    [gold]
                        amount=-{COST}
                        side=$side_number
                    [/gold]
                    [unit]
                        type={UNIT}
                        side=$side_number
                        x,y=$x1,$y1
                        moves=1
                        animate=yes
                    [/unit]
                    [store_unit]
                        variable=newunit
                        [filter]
                            x,y=$x1,$y1
                        [/filter]
                    [/store_unit]
                    [set_variable]
                        name=newunit.attacks_left
                        value=1
                    [/set_variable]
                    [unstore_unit]
                        variable=newunit
                        find_vacant=no
                    [/unstore_unit]
                    [set_variable]
                        name=newunit.moves
                        value=2
                    [/set_variable]
                    [store_unit]
                        [filter]
                            ability={ABILITY}
                            side=$side_number
                            [filter_wml]
                                moves=$this_unit.max_moves
                            [/filter_wml]
                            [filter_adjacent]
                                x,y=$x1,$y1
                            [/filter_adjacent]
                        [/filter]
                        variable=abletokabbalah
                    [/store_unit]
                    [if]
                        [variable]
                            name=abletokabbalah.length
                            greater_than=1
                        [/variable]
                        [then]
                            {FOREACH abletokabbalah a}
                                [if]
                                    [variable]
                                        name=abletokabbalah[$a].id
                                        equals=$last_selected_unit.id
                                    [/variable]
                                    [then]
                                        [set_variable]
                                            name=abletokabbalah[$a].attacks_left
                                            value=0
                                        [/set_variable]
                                        [set_variable]
                                            name=abletokabbalah[$a].moves
                                            value=0
                                        [/set_variable]

                                        {VARIABLE_OP abletokabbalah[$a].experience add 8}

                                        [unstore_unit]
                                            variable=abletokabbalah[$a]
                                            find_vacant=no
                                            text= _ "+$this_unit.level exp"
                                            red,green,blue=50,50,200
                                        [/unstore_unit]
                                        {CLEAR_VARIABLE newunit}
                                        {CLEAR_VARIABLE abletokabbalah}
                                    [/then]
                                [/if]
                            {NEXT a}
                        [/then]
                        [else]
                            [store_unit]
                                variable=abletokabbalah
                                [filter]
                                    ability={ABILITY}
                                    side=$side_number
                                    [filter_wml]
                                        moves=$this_unit.max_moves
                                    [/filter_wml]
                                    [filter_adjacent]
                                        x,y=$x1,$y1
                                    [/filter_adjacent]
                                [/filter]
                            [/store_unit]
                            [set_variable]
                                name=abletokabbalah[$a].attacks_left
                                value=0
                            [/set_variable]
                            [set_variable]
                                name=abletokabbalah[$a].moves
                                value=0
                            [/set_variable]

                            {VARIABLE_OP abletokabbalah[$a].experience add 8}

                            [unstore_unit]
                                variable=abletokabbalah[$a]
                                find_vacant=no
                                text= _ "+$this_unit.level exp"
                                red,green,blue=50,50,200
                            [/unstore_unit]
                            {CLEAR_VARIABLE newunit}
                            {CLEAR_VARIABLE abletokabbalah}
                        [/else]
                    [/if]
                [/then]
                [else]
                    [message]
                        speaker=narrator
                        side_for=$side_number
                        caption=_ "Error"
                        message= _ "I have insufficient resources right now. I am unable to do practical kabbalah!"
                        image=wesnoth-icon.png
                    [/message]
                [/else]
            [/if]
            {CLEAR_VARIABLE actualgold}
        [/command]
    [/set_menu_item]
    ####
    ####
    [set_menu_item]
        id=kabbalah_help
        description= _ "Kabbalah Help"
        [show_if]
        [/show_if]
        [filter_location]
            [filter]
                type="IVKA_rav, IVKA_posek, IVKA_gaon, IVKA_navi"
                side=$side_number
            [/filter]
        [/filter_location]
        [command]
            [message]
                speaker=narrator
                side_for=$side_number
                caption=_ "Kabbalah Help"
                message= _ "To let your unit do practical kabbalah and animate a golem, right-click on adjacent hexes near a selected kabbalist.

You need all movement points (and remaining attacks) to practically kabbalah one golem. You are only able to kabbalah in villages, castles or keeps, which can deliver the resources. Orcish or undead keeps, villages and castles are too unholy to be a place for kabbalah at all. Every practical kabbalahing adds +8 to current experience.

If there are 2 or more kabbalists, a new unit will be kabbalahed by the last selected unit able to kabbalah."
                image=wesnoth-icon.png
            [/message]
        [/command]
    [/set_menu_item]
#enddef


Could you help me please?
Last edited by chol on May 2nd, 2017, 11:24 am, edited 1 time in total.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: lua error - where are lua/wml-flow.lua & lua/wml-utils.l

Post by zookeeper »

chol wrote:And where are lua/wml-flow.lua & lua/wml-utils.lua locations, can't find them in the game data directory?
Well... they are there.
User avatar
chol
Posts: 49
Joined: September 9th, 2015, 11:19 am

Re: lua error - where are lua/wml-flow.lua & lua/wml-utils.l

Post by chol »

Where? Can't find them in /usr/share/games/wesnoth/data/lua

In there are only:

wml/items.lua
wml/objectives.lua
backwards-compatibility.lua
helper.lua
location_set.lua
wml-tags.lua
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: lua error - where are lua/wml-flow.lua & lua/wml-utils.l

Post by zookeeper »

chol wrote:Where? Can't find them in /usr/share/games/wesnoth/data/lua

In there are only:

wml/items.lua
wml/objectives.lua
backwards-compatibility.lua
helper.lua
location_set.lua
wml-tags.lua
Those are the files that ship in 1.12.x, whereas 1.13.7 has a bunch of additional files in those locations. So, it sounds like your 1.13.7 files are someplace else (use the i button in the bottom left corner of the title screen to check, if necessary).
User avatar
chol
Posts: 49
Joined: September 9th, 2015, 11:19 am

Re: lua error - where are lua/wml-flow.lua & lua/wml-utils.l

Post by chol »

thank you.
i found the files - after proper upgrade to 13.7
Post Reply