event crashes Wesnoth
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.
- Darker_Dreams
- Posts: 608
- Joined: February 1st, 2008, 5:26 pm
Re: event crashes Wesnoth
you posted while I was putting my thoughts together and checking some last stuff... so, double-post
edit; column 4 has 3 villages (y= 1, 4 and 7), and column 12 has 2 (y= 3 and 7).
That's between you and the descent into darkness maintainer. I do find it amusing however.Mist wrote:After some testing I can safely tell you it spits out crapload of garbage. And don't tell me it works, because it doesn't, I'm quite sure that event would not survive a stress-test of capturig/recapturing of a cluster of nine villages. My careful guess at the moment is that it checks x coord only and nobody noticed because the villlages are on different x axis each.
edit; column 4 has 3 villages (y= 1, 4 and 7), and column 12 has 2 (y= 3 and 7).
I will check this in a moment.Mist wrote:If you want to see for yourself what's happening place an
{DEBUG_MSG $village_$x1,$y1|_cleared} inside the if block
Place
{VARIABLE foo $village_$x1,$y1|_cleared}
{DEBUG_MSG $foo}
as well, if village_$x1,$y1|_cleared was a proper variable name effect should spit out yes|no
I already tried that exact form, and still got the crash. if you're sure it'll be more stable and reliable I'll stick with it. but the fencer thing (above) is making me a little skittish.Mist wrote: My advice for now is to replace the comma with an underscorewill be much more predictable if you really need such form.Code: Select all
village_$x1|_$y1|_cleared
honestly, I've got no idea how to use the debug stuff. this is all trial and error with standard output. I'll be trying it by copy-pasting your suggested method into my wml, and then figuring out what the change did when I see what happens.Mist wrote:EDIT
If you checked with {DEBUG_MSG village_$x1,$y1|_cleared} you got misleading output, since it throws out a proper string but not proper variable name. Not all strings can be used as a variable name
Re: event crashes Wesnoth
In my own experience, changing a unit's type is generally a bad idea, as it tends to keep (some) old animations (any that aren't overwritten). I've had cavalrymen that looked like blood bats (cos the animation was constantly playing) and other strange things.
You probably want to kill the peasant and drop in a fresh Fencer w/ same name instead. You'll lose the traits though, as I haven't found a way to reliably copy those.
You probably want to kill the peasant and drop in a fresh Fencer w/ same name instead. You'll lose the traits though, as I haven't found a way to reliably copy those.
- Darker_Dreams
- Posts: 608
- Joined: February 1st, 2008, 5:26 pm
Re: event crashes Wesnoth
That's generally aggravating.AI wrote:In my own experience, changing a unit's type is generally a bad idea, as it tends to keep (some) old animations (any that aren't overwritten). I've had cavalrymen that looked like blood bats (cos the animation was constantly playing) and other strange things.
You probably want to kill the peasant and drop in a fresh Fencer w/ same name instead. You'll lose the traits though, as I haven't found a way to reliably copy those.
I don't know how to go about accessing the various pieces of a stored unit, but the wiki says that [modifications] are readable... so, I would imagine that you could get all the data... but how is beyond me.
anyone want to point out where I can find what the parts of a stored-unit-variable mean?
Re: event crashes Wesnoth
Replace your event with this :
And tell me what you get. If everything works you'll get three popups with content as in {DEBUG_MSG}. If not tell me which popups displayed properly
Code: Select all
[event]
name=capture
first_time_only=no
[if]
[variable]
name=village_$x1|_$y1|_cleared
equals=no
[/variable]
[variable]
name=unit.type
equals=Peasant
[/variable]
[then]
{DEBUG_MSG "Passed check"}
{LOYAL_UNIT 2 (Master at Arms) 10 7 (Morwin) (_ "Morwin")}
{VARIABLE village_$x1|_$y1|_cleared yes}
{DEBUG_MSG "Set flag"}
[message]
description=Morwin
message=_ "I'm too old now to get involved with such craziness. My friends and I came to this quiet valley to retire. I'll tell you what; I can give you some training which will help you be able to deal with it."
[option]
message=_ "Sure!"
[command]
{MODIFY_UNIT $unit.id type Fencer}
[/command]
[/option]
[option]
message=_ "We don't have time for that!"
[/option]
{DEBUG_MSG "Changed type"}
[/message]
[kill]
description=Morwin
animate=no
fire_event=no
[/kill]
[/then]
[/if]
[/event]
Somewhere, between the sacred silence and sleep.
Disorder.
Disorder.
- Darker_Dreams
- Posts: 608
- Joined: February 1st, 2008, 5:26 pm
Re: event crashes Wesnoth
I get an error from the line {MODIFY_UNIT $unit.id type Fencer}Mist wrote:Replace your event with this :And tell me what you get. If everything works you'll get three popups with content as in {DEBUG_MSG}. If not tell me which popups displayed properlyCode: Select all
changing that out for the x,y= I was using and it just doesn't do anything.
My assumption is unit.type isn't doing the trick for some reason.
I put the other debug message at the end of the event and it still shows up if that's what you're looking for.
Re: event crashes Wesnoth
Argh, sorry, there was a syntax change in 1.5 and still get confused at times. Replace $unit.id with $unit.description.
Somewhere, between the sacred silence and sleep.
Disorder.
Disorder.
- Darker_Dreams
- Posts: 608
- Joined: February 1st, 2008, 5:26 pm
Re: event crashes Wesnoth
1.5? :-p showoff.
reverted to what you sent and made that change- it still errors on that line.
reverted to what you sent and made that change- it still errors on that line.
Re: event crashes Wesnoth
Eh? Did I tell you that I hate macros? I hate macros
The hard way then
That needs to replace {MODIFY_UNIT ... }
The hard way then
Code: Select all
[store_unit]
[filter]
description=$unit.description
[/filter]
kill=yes
fire_event=no
variable=tmp_var
[/store_unit]
{VARIABLE tmp_var.type Fencer}
[unstore_unit]
variable=tmp_var
[/unstore_unit]
{CLEAR_VARIABLE tmp_var}
Somewhere, between the sacred silence and sleep.
Disorder.
Disorder.
Re: event crashes Wesnoth
the macro in 1.4:
In other words, what you just posted (that is, before the last un-macro'd version) could never have worked anyway. (where is $unit even defined?)
so, how about this:
unfortunately, "modifications=$temp.modifications" does NOT work...
Code: Select all
#define MODIFY_UNIT FILTER VAR VALUE
# Alters a unit variable (such as unit.x, unit.type,
# unit.side), handling all the storing and unstoring.
#
# Example that flips all spearmen to side 2:
#! {MODIFY_UNIT type=Spearman side 2}
so, how about this:
Code: Select all
[store_unit]
[filter]
x,y=10,7
[/filter]
variable=temp
kill=no
animate=no
[/store_unit]
[kill]
x,y=10,7
[/kill]
[unit]
side=$temp.side
type=Fencer
description=$temp.description
user_description=$temp.user_description
canrecruit=$temp.canrecruit
facing=$temp.facing
x=10
y=7
moves=$temp.moves
[/unit]
{CLEAR_VARIABLE temp}
Re: event crashes Wesnoth
Automaticaly when firing capture event As with any other event triggering on an unit related stuffAI wrote:
In other words, what you just posted (that is, before the last un-macro'd version) could never have worked anyway. (where is $unit even defined?)
Anyway, true, it should be {MODIFY_UNIT (description=$unit.description) type Fencer} but I usualy do such stuff explicitely for clarity of code.
Somewhere, between the sacred silence and sleep.
Disorder.
Disorder.
- Darker_Dreams
- Posts: 608
- Joined: February 1st, 2008, 5:26 pm
Re: event crashes Wesnoth
macros make things cleaner for me, and provide convenient snippits of code for me to crib the way things are used from.Mist wrote:Eh? Did I tell you that I hate macros? I hate macros
The hard way thenThat needs to replace {MODIFY_UNIT ... }Code: Select all
...
regardless;
it runs now, but the peasant captures the village without any event or message.
I'll try AI's in a moment...
you gent's do realize that I posted a copy of the stripped out scenario I'm testing this in on the first page- so you could try this out yourself...
edit; AI's didn't do anything either. Somehow the filter that's being used isn't triggering the if statement.
Re: event crashes Wesnoth
Well comment them out one by one and see which one fails, but my guess is that village_$x1|_$y1|_cleared is not set before the event, so it can't be equal to 'no'. Either do {VARIABLE village_10_7_cleared no} at the start event or replace first [variable] clause with
And no, I can't test stuff, I'm at work
Code: Select all
[variable]
name=village_$x1|_$y1|_cleared
not_equals=yes
[/variable]
Somewhere, between the sacred silence and sleep.
Disorder.
Disorder.
- Darker_Dreams
- Posts: 608
- Joined: February 1st, 2008, 5:26 pm
Re: event crashes Wesnoth
ok, I went back to my own code. I plugged the {debug...foo} macro Mist was talking about earlier in, and it's output seems to show up regardless of where I put it (including right before [/event]} I tried both Mist and AI's expanded replacements for the {modify_unit...}, and both crashed as soon as the debug message was cleared from the screen.
Re: event crashes Wesnoth
in other words, wesnoth can't handle unit-changes in capture events? we encountered it before in attacks....
- Darker_Dreams
- Posts: 608
- Joined: February 1st, 2008, 5:26 pm
Re: event crashes Wesnoth
hah.
apparently it works just fine as a moveto.
apparently it works just fine as a moveto.