What do I do when I want an integer? (resolved)

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
User avatar
Ken_Oh
Moderator Emeritus
Posts: 2176
Joined: February 6th, 2006, 4:03 am
Location: Baltimore, Maryland, USA

What do I do when I want an integer? (resolved)

Post by Ken_Oh »

Now that we're in Fractionoth, which is cool, but I'm getting weird stuff like shops with items worth 15.5 gold. So, how do I round? Also, can I truncate if I don't want to round?
Last edited by Ken_Oh on March 1st, 2009, 4:52 pm, edited 1 time in total.

User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: What do I do when I want an integer?

Post by zookeeper »

Ken_Oh wrote:Now that we're in Fractionoth, which is cool, but I'm getting weird stuff like shops with items worth 15.5 gold. So, how do I round? Also, can I truncate if I don't want to round?
Sure, you can split the string with [set_variables] [split].

User avatar
Lizard
Posts: 352
Joined: January 19th, 2008, 8:20 am
Location: Hiding in a swamp (gtm +1; DST)

Re: What do I do when I want an integer?

Post by Lizard »

Ken_Oh wrote:Now that we're in Fractionoth, which is cool, but I'm getting weird stuff like shops with items worth 15.5 gold. So, how do I round? Also, can I truncate if I don't want to round?
I don't know much about it, but if you are [set_variable]ing, wouldn't the round attribute do it?
Truncating isn't supported, you'll have to floor your value :wink:

ok, zookeeper replayed before me ... but is that actually a string?
~ I'll heal you by 4 hp if you post next to me ~
Have a look at the Era of Strife, featuring Eltireans, Eventide, Minotaurs, Saurians and Triththa

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

Re: What do I do when I want an integer?

Post by Ken_Oh »

I'm reading about [split] now in the wiki. I don't understand it, but I'm sure I can play with it and figure it out.

Liz: Does round exist? I don't see it in the wiki. Again, I'll test it out sometime, but the g/f wants the laptop now.

AI
Developer
Posts: 2394
Joined: January 31st, 2008, 8:38 pm

Re: What do I do when I want an integer?

Post by AI »

This is how it works these days, I forgot to update the wiki, will do that now.

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

Re: What do I do when I want an integer?

Post by Ken_Oh »

Cool. Thanks.

Post Reply