Debugging moveto events

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
rogul
Posts: 34
Joined: May 25th, 2015, 12:48 am

Debugging moveto events

Post by rogul »

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
Bobit
Posts: 33
Joined: February 10th, 2015, 2:42 pm

Re: Debugging moveto events

Post by Bobit »

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
User avatar
Pentarctagon
Project Manager
Posts: 5590
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Debugging moveto events

Post by Pentarctagon »

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
rogul
Posts: 34
Joined: May 25th, 2015, 12:48 am

Re: Debugging moveto events

Post by rogul »

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.
User avatar
octalot
General Code Maintainer
Posts: 791
Joined: July 17th, 2010, 7:40 pm
Location: Austria

Re: Debugging moveto events

Post by octalot »

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 or die 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
vghetto
Posts: 755
Joined: November 2nd, 2019, 5:12 pm

Re: Debugging moveto events

Post by vghetto »

You might find this useful. It includes exploration mode, and teleport unit.
https://github.com/virtualghetto/Heal_Harm_Unit
Post Reply