Tricky WML (Clever people needed)
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.
Re: Tricky WML (Clever people needed)
i have noticed some odd things, maybe that helps you:
so first of all you open an IF tag, close it and then open a then tag
is this how if/then is used
?
it should be like this:
[if]
...
[then]
...
[/then]
[/if]
also you have at the bottom of your code a [/then] tag which i cant find a [then] for
perhaps look at these things and go on
btw, you wrote that you took this from another source and just edited it or something - my tip for these things: stay as close as yp can to the original unless you know what you are doing
so i would simply take the original and stick as close as possible to it. if you cant fix it.
if it works in the other SCN it will work for you.
1)Longbow wrote:I've checked all the tags as best I can, but it still doesn't work and I still don't know what's wrong...Code: Select all
#define OBJ_BOOK_STRATEGY X Y ID [...] [if] [variable] name=book_taken numerical_equals=0 [/variable] [/if] [then] [message] [...] [/message] {VARIABLE book_taken 1} [/then] [effect] [...] [/effect] [/then] [/event] #enddef
so first of all you open an IF tag, close it and then open a then tag
is this how if/then is used

it should be like this:
[if]
...
[then]
...
[/then]
[/if]
also you have at the bottom of your code a [/then] tag which i cant find a [then] for
perhaps look at these things and go on
btw, you wrote that you took this from another source and just edited it or something - my tip for these things: stay as close as yp can to the original unless you know what you are doing

so i would simply take the original and stick as close as possible to it. if you cant fix it.
if it works in the other SCN it will work for you.
The best bet is your own, good Taste.
Re: Tricky WML (Clever people needed)
They are both there, you may have missed it when you edited out the big portions of his code.Mabuse wrote:also you have at the bottom of your code a [/then] tag which i cant find a [then] for
perhaps look at these things and go on
Mainline Maintainer: AOI, DM, NR, TB and THoT.
UMC Maintainer: Forward They Cried, A Few Logs, A Few More Logs, Start of the War, and Battle Against Time
UMC Maintainer: Forward They Cried, A Few Logs, A Few More Logs, Start of the War, and Battle Against Time
Re: Tricky WML (Clever people needed)
nope. "they" are not.
and why "both" its just ONE [then] what is missing
and its terribly easy to check that either, just "search for "[then]" with a texteditor on the example and you will only find ONE [then], while there are TWO [/then]
EDIT:
(although i guess it the [/then] in the middle which is wrong though, but tbh, i didnt look at the code and see what it does, i just checked for tags - but as a matter of fact theres one [/then] too much, and this will cause problems ... and also the wrongly placed If/then thingy since then should be included inside IF)
and why "both" its just ONE [then] what is missing
and its terribly easy to check that either, just "search for "[then]" with a texteditor on the example and you will only find ONE [then], while there are TWO [/then]
EDIT:
(although i guess it the [/then] in the middle which is wrong though, but tbh, i didnt look at the code and see what it does, i just checked for tags - but as a matter of fact theres one [/then] too much, and this will cause problems ... and also the wrongly placed If/then thingy since then should be included inside IF)
Last edited by Mabuse on March 5th, 2009, 7:41 pm, edited 1 time in total.
The best bet is your own, good Taste.
Re: Tricky WML (Clever people needed)
heres the full version i am referring to:
(if this is unclear)
as said, grab a textpad, copy it in, and look for yourself - i would be surprised if you find TWO "[then]"
(if this is unclear)
as said, grab a textpad, copy it in, and look for yourself - i would be surprised if you find TWO "[then]"

Longbow wrote:I've checked all the tags as best I can, but it still doesn't work and I still don't know what's wrong...Code: Select all
#define OBJ_BOOK_STRATEGY X Y ID {PLACE_IMAGE items/book1.png ({X}) ({Y})} {VARIABLE book_taken 0} [event] name=moveto first_time_only=no [filter] side=1 x={X} y={Y} [/filter] [if] [variable] name=book_taken numerical_equals=0 [/variable] [/if] [then] [message] speaker=narrator image="items/book1.png" [object] id={ID} name= _ "Undead Strategy Guide" image=items/staff-magic.png duration=forever message= _ "This legendary staff belonged to Minister Edmond, advisor to Prince Haldric and founder of the White order of Magi. When he passed away from old age, the staff was thought to have been lost." cannot_use_message= _ "Only a powerful warrior or mage can use this staff!" [/object] [/message] [removeitem] x,y={X},{Y} [/removeitem] [message] speaker=narrator image="items/book1.png" message= _ "As you pick up the ornate staff, it starts to pulse with arcane energy. This mighty weapon will decimate magical creatures." [/message] {VARIABLE book_taken 1} [/then] [effect] [set_menu_item] id=book_strategy description= _ "Undead Strategy Guide" image=items/book1.png [while] [variable] name=quit_menu numerical_equals=0 [/variable] [do] [message] speaker=narrator side_for=$side_number caption= _ " Undead Strategy Guide " message= _ " Choose what you want to know: " image=items/book1.png [/message] [option] message=*{MENU_IMG_TXT "items/book1.png" _"Close Strategy Guide"} [command] [set_variable] name=quit_menu value=1 [/set_variable] [/command] [/option] [/do] [clear_variable] name=quit_menu [/clear_variable] [/while] [/set_menu_item] [/effect] [/then] [/event] #enddef
The best bet is your own, good Taste.
Re: Tricky WML (Clever people needed)
Ah, the third iteration of it, yes. The first two have all the then tags there, for some reason he took it out in that one. I was looking only at the first two.
Longbow! Fix yourself!
Longbow! Fix yourself!

Mainline Maintainer: AOI, DM, NR, TB and THoT.
UMC Maintainer: Forward They Cried, A Few Logs, A Few More Logs, Start of the War, and Battle Against Time
UMC Maintainer: Forward They Cried, A Few Logs, A Few More Logs, Start of the War, and Battle Against Time
Re: Tricky WML (Clever people needed)
hehe, i thought thatTuruk wrote:Ah, the third iteration of it, yes. The first two have all the then tags there, for some reason he took it out in that one. I was looking only at the first two.
Longbow! Fix yourself!

(tbh, i even didnt look at the first two :p .... um not carefully i mean - but that wasnt needed either i guess)
The best bet is your own, good Taste.
Re: Tricky WML (Clever people needed)
Thanks guys, I'll fix the then tomorrow. I did the if/then thingy and it didn't seem to work, but that may be because of the duplicate /thens.

Turuk wrote:Longbow! Fix yourself!

Re: Tricky WML (Clever people needed)
One mistake I can spot on a first glance is a error with the conditional:
Code: Select all
[if]
[then]
[/then]
[/if]
not
[if]
[/if]
[then]
[/then]
Re: Tricky WML (Clever people needed)
OK, so now it doesn't crash, but I don't get the right-click menu option, just the picking-up-item text etc.
edit: Disregard that, menu working now, no features/content yet, but at least it works!
edit: Disregard that, menu working now, no features/content yet, but at least it works!

Re: Tricky WML (Clever people needed)
By the way, that's not a "crash": it's called a "config error" due to parsing a .cfg file with malformed WML
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
Re: Tricky WML (Clever people needed)
Ok, but it is quicker to write crash
I know, people will think it is a different problem, will bear in mind in future

I know, people will think it is a different problem, will bear in mind in future