Debugging moveto events
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.
Debugging moveto events
Is there an easy way to fire/trigger moveto events to test them?
I am debugging a scenario and having to start a scenario over and play through until making the event fire is very time consuming.
I tried :debug fire unit.x=XX to try to move it to the location but nothing happened.
Is there any other way to debug the wml? Or create unit tests of them?
Cheers
I am debugging a scenario and having to start a scenario over and play through until making the event fire is very time consuming.
I tried :debug fire unit.x=XX to try to move it to the location but nothing happened.
Is there any other way to debug the wml? Or create unit tests of them?
Cheers
Re: Debugging moveto events
https://wiki.wesnoth.org/InternalAction ... e_event.5D
https://wiki.wesnoth.org/Eventwml#moveto
or you could just comment out the dialogue for the scenario and it wouldn't take so long if I'm understanding
idk if there is any WML unit testing
https://wiki.wesnoth.org/Eventwml#moveto
or you could just comment out the dialogue for the scenario and it wouldn't take so long if I'm understanding
idk if there is any WML unit testing
- Pentarctagon
- Project Manager
- Posts: 5590
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: Debugging moveto events
There are in fact WML unit tests. The mainline tests are here for example, and can be run by launching wesnoth as
wesnoth -u <unit_test_name>
.99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
take one down, patch it around
-2,147,483,648 little bugs in the code
Re: Debugging moveto events
Thanks, will check out the unit tests.
I guess adding a debug event to fire the moveto events could work. Was hoping to not have debug code in the scenario, but I guess I can keep it as a separate macro and just include when testing.
I guess adding a debug event to fire the moveto events could work. Was hoping to not have debug code in the scenario, but I guess I can keep it as a separate macro and just include when testing.
Re: Debugging moveto events
Various debug-mode tools:
- Shift+c will create a unit at the hex under the cursor, it spawns able to do a full move and attack in the current turn
- For moveto events that need a specific unit, hover over it and
:unit moves=100
- Shift+k kills the unit under the cursor, handy for clearing another unit's path
- Shift+u changes which team the unit under the cursor is on, which can be handy along with shift+c for testing generic
last_breath
ordie
events - For events that need a specific unit to die,
:unit hitpoints=1
- For events that need a specific unit to do the killing
:unit attacks_left=100
gives them extra attempts
Re: Debugging moveto events
You might find this useful. It includes exploration mode, and teleport unit.
https://github.com/virtualghetto/Heal_Harm_Unit
https://github.com/virtualghetto/Heal_Harm_Unit