AssassinT90's questions

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

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
AssassinT90
Posts: 39
Joined: December 20th, 2007, 9:47 am

AssassinT90's questions

Post by AssassinT90 » January 13th, 2010, 7:37 pm

Could someone post an example on how to use the "[show_if]" subtag of "[set_menu_item]" tag?

I was wondering how I set the menu item to be showed only if the variable "Z" is equal to "1".




Edited:

P1RECRUIT=1
P2RECRUIT=1
How to use those values like this: $P"$side_number"Recruit = $P1RECRUIT in side 1's turn?

$P$side_number|RECRUIT doesn't work.


Edited 2:
With thye help of a friend, I could do it.
I'll keep this post open to post all my next questions. Thank ya.

AssassinT90
Posts: 39
Joined: December 20th, 2007, 9:47 am

Re: AssassinT90's questions

Post by AssassinT90 » January 17th, 2010, 7:28 pm

I'm in trouble, people. Who could help me???
Spoiler:
Ok, ok, there's the code. Now, the problem:

The first message is right, "4=4".
However, the second one is wrong. It appears: "4=0"

Even if I use the following code it is still "4=0".
Spoiler:


______________________________________________________________________________

Second problem:
Spoiler:
Supposing that I want make the number greater than 0.6, and less than 0.8, to be 10, is this right?
Spoiler:

User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Re: AssassinT90's questions

Post by Sapient » January 18th, 2010, 9:19 am

First of all, stop using numbers as variable names... that's just confusing.
Second, you forgot to tell what version you are using.
Third, if you read the documentation of [set_variable] ( http://wiki.wesnoth.org/InternalActions ... ariable.5D ), then you will see where it says "If both variables are integers, Integer division is used."
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."

AssassinT90
Posts: 39
Joined: December 20th, 2007, 9:47 am

Re: AssassinT90's questions

Post by AssassinT90 » January 18th, 2010, 1:53 pm

Sapient wrote:First of all, stop using numbers as variable names... that's just confusing.
Second, you forgot to tell what version you are using.
Third, if you read the documentation of [set_variable] ( http://wiki.wesnoth.org/InternalActions ... ariable.5D ), then you will see where it says "If both variables are integers, Integer division is used."
First: Ok, I'll try.
Second: 1.6.5
Third: For accuracy I just gave up using divisions, now I'm multiplying instead of dividing, works great when its a fix value, but when I get a variable...

Another question:
Is there any way of rounding non-intenger numbers to intenger numbers?
I generally use {IF_VAR} macro when I can predict the possible results, but that's kinda stressful, gives me giant codes, and I can't predict the possible resulsts always.

User avatar
Ken_Oh
Moderator Emeritus
Posts: 2176
Joined: February 6th, 2006, 4:03 am
Location: Baltimore, Maryland, USA

Re: AssassinT90's questions

Post by Ken_Oh » January 18th, 2010, 3:05 pm

AssassinT90 wrote: Another question:
Is there any way of rounding non-intenger numbers to intenger numbers?
Sapient wrote:read the documentation of [set_variable] ( http://wiki.wesnoth.org/InternalActions ... ariable.5D )

AssassinT90
Posts: 39
Joined: December 20th, 2007, 9:47 am

Re: AssassinT90's questions

Post by AssassinT90 » January 19th, 2010, 6:25 am

Ken_Oh wrote:
AssassinT90 wrote: Another question:
Is there any way of rounding non-intenger numbers to intenger numbers?
Sapient wrote:read the documentation of [set_variable] ( http://wiki.wesnoth.org/InternalActions ... ariable.5D )
Yeah, I was about to edit that question =D

Post Reply