Argh! My code doesnt work!

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
robeth
Posts: 3
Joined: August 27th, 2005, 8:26 pm
Location: Lochgilphead, Scotland

Argh! My code doesnt work!

Post by robeth »

Hi folks, Im having a bit of trouble with my WML, my code is;

Code: Select all


[event]
name=die
	[filter]
	description=Flin the Hasty
	[/filter]
	[message]
	description=unit
	message= _ "Dirty Human! My master will turn you into wolf feed!"
	[/message]
	[message]
	speaker=second_unit
	message= _ "Just die you filthy goblin scum."
	[/message]
	[set_variable]
	name=kill_flin
	value=1
	[/set_variable]

[/event]
I'm trying to make it so that when Flag dies he says "Dirty human..."
followed by the successful unit who killed him saying "Just die..."

At the moment only Flag's text comes up

Not sure what Im doing wrong, any help appreciated!

Rob
User avatar
Tomsik
Posts: 1401
Joined: February 7th, 2005, 7:04 am
Location: Poland

Post by Tomsik »

try

Code: Select all

   [message]
   speaker=unit
   message= _ "Dirty Human! My master will turn you into wolf feed!"
   [/message] 
istead of

Code: Select all

  
 [message]
   description=unit
   message= _ "Dirty Human! My master will turn you into wolf feed!"
   [/message]
 
robeth
Posts: 3
Joined: August 27th, 2005, 8:26 pm
Location: Lochgilphead, Scotland

Post by robeth »

hmm... no, still having trouble, i'v tried recoding it in different ways but all with the same result, at the moment my coding is;

Code: Select all

[event]
name=die
	[filter]
	description=Flin the Hasty
	[/filter]
	[message]
	description=Flin the Hasty
	message= _ "Dirty Human! My master will turn you into wolf feed!"
	[/message]
 
	[message]
	description=General Manfell
	message= _ "Just die you filthy goblin scum"
	[/message]
	[set_variable]
	name=kill_flin
	value=1
	[/set_variable]

[/event]
General Manfell does exist and other messages from him work fine

I'm having another problem with messages in the next scenario, my code is

Code: Select all

[event]
name=die
	[filter]
	description=Flag the Butcher
	[/filter]
	[message]
	decription=Flag the Butcher
	message= _ "Grrraa! I'll have you killed..I'll... I'll..."
	[/message]
	[filter_second]
			[message]
			message= _ "Sure you will."
			[/message]
	[/filter_second]
	[set_variable]
	name=kill_flag
	value=1
	[/set_variable]
	[if]
		[variable]
		name=kill_grog
		numerical_equals=1
		[/variable]
		[then]
			[message]
			description=Lieutenant White
			message= _ "Excellent, the orcish vanguard has been destroyed."
			[/message]
			
			[message]
	description=Prince Harold
	message= _ "The fort has been evacuated, our people are safe! Lets get out of here!!"
			[/message]

			[endlevel]
			result=victory
			bonus=yes
			[/endlevel]
		[/then]

		[else]
		[/else]
	[/if]
[/event]
When playing, this event occurs with the first message "Graaa..." being spoken by a random horseman in my army-seemingly completely unrelated to the die event. Another blank message dialogue then appears from this unit and the event ends.

Im completely at a loss, anyone with any suggestions please help!

Rob
claus
Posts: 186
Joined: April 4th, 2005, 5:51 am

Post by claus »

[filter_second] is a unit filter (it makes no sense to filter messages).
Disto
Posts: 2039
Joined: November 1st, 2004, 7:40 pm
Location: Cambridge, UK

Post by Disto »

robeth wrote:hmm... no, still having trouble, i'v tried recoding it in different ways but all with the same result, at the moment my coding is;

Code: Select all

[event]
name=die
	[filter]
	description=Flin the Hasty
	[/filter]
	[message]
	description=Flin the Hasty
	message= _ "Dirty Human! My master will turn you into wolf feed!"
	[/message]
 
	[message]
	description=General Manfell
	message= _ "Just die you filthy goblin scum"
	[/message]
	[set_variable]
	name=kill_flin
	value=1
	[/set_variable]

[/event]
General Manfell does exist and other messages from him work fine

I'm having another problem with messages in the next scenario, my code is

Code: Select all

[event]
name=die
	[filter]
	description=Flag the Butcher
	[/filter]
	[message]
	decription=Flag the Butcher
	message= _ "Grrraa! I'll have you killed..I'll... I'll..."
	[/message]
	[filter_second]
			[message]
			message= _ "Sure you will."
			[/message]
	[/filter_second]
	[set_variable]
	name=kill_flag
	value=1
	[/set_variable]
	[if]
		[variable]
		name=kill_grog
		numerical_equals=1
		[/variable]
		[then]
			[message]
			description=Lieutenant White
			message= _ "Excellent, the orcish vanguard has been destroyed."
			[/message]
			
			[message]
	description=Prince Harold
	message= _ "The fort has been evacuated, our people are safe! Lets get out of here!!"
			[/message]

			[endlevel]
			result=victory
			bonus=yes
			[/endlevel]
		[/then]

		[else]
		[/else]
	[/if]
[/event]
When playing, this event occurs with the first message "Graaa..." being spoken by a random horseman in my army-seemingly completely unrelated to the die event. Another blank message dialogue then appears from this unit and the event ends.

Im completely at a loss, anyone with any suggestions please help!

Rob
You need ids for the messages....
Creator of A Seed of Evil
Creator of the Marauders
Food or Wesnoth? I'll have Wesnoth
claus
Posts: 186
Joined: April 4th, 2005, 5:51 am

Post by claus »

Disto wrote:You need ids for the messages....
:?
As far as i know you do not need ids.
Disto
Posts: 2039
Joined: November 1st, 2004, 7:40 pm
Location: Cambridge, UK

Post by Disto »

claus wrote:
Disto wrote:You need ids for the messages....
:?
As far as i know you do not need ids.
Well you used to, and if you want it translated then you will.
Creator of A Seed of Evil
Creator of the Marauders
Food or Wesnoth? I'll have Wesnoth
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

tomsik's suggestion worked fine for me:

Code: Select all

[event]
    name=die

    [filter]
      description=Flin the Hasty
    [/filter]

    [message]
        speaker=unit
        message= _ "Dirty Human! My master will turn you into wolf feed!"
    [/message]

    [message]
        speaker=second_unit
        message= _ "Just die you filthy goblin scum."
    [/message]

    [set_variable]
        name=kill_flin
        value=1
    [/set_variable]
[/event]
So just use speaker instead of description in messages.

And then to the next one:

Code: Select all

[event]
    name=die

    [filter]
        description=Flag the Butcher
    [/filter]

    [message]
        decription=Flag the Butcher
        message= _ "Grrraa! I'll have you killed..I'll... I'll..."
    [/message]

    [filter_second]
        [message]
            message= _ "Sure you will."
        [/message]
    [/filter_second] 
Replace description with speaker here as well.

If the [filter_second] here means that you want the unit killing Flag to say "Sure you will.", you just need to write:

Code: Select all

[message]
    speaker=second_unit
    message= _ "Sure you will."
[/message]
So remove [filter_second] there. You can always use "speaker=unit" and "speaker=second_unit" in event messages, no need to try and filter the messages. The [filter] and [filter_second] only determine if the event is triggered in the first place. So if you want the event to trigger when Konrad kills Flag, just put "[filter] description=Konrad[/filter]" and "[filter_second] description=Flag[/filter_second]" inside the event. Then, in messages you can refer to the units that passed the filters' criteria by using "speaker=unit" and "speaker=second_unit".

I didn't test this latter one myself, but I think it should work. Anyway, I hope this helps.
robeth
Posts: 3
Joined: August 27th, 2005, 8:26 pm
Location: Lochgilphead, Scotland

Post by robeth »

many thanks guys, ill give it a shot!
User avatar
Elvish_Pillager
Posts: 8137
Joined: May 28th, 2004, 10:21 am
Location: Everywhere you think, nowhere you can possibly imagine.
Contact:

Post by Elvish_Pillager »

ids now do nothing. They are not necessary for translation.
It's all fun and games until someone loses a lawsuit. Oh, and by the way, sending me private messages won't work. :/ If you must contact me, there's an e-mail address listed on the website in my profile.
Post Reply