PDA

View Full Version : One-Half Rounded Down



GoOrange
August 25th, 2007, 19:13
I'm modifying the basic D20 ruleset to create a Star Wars Saga Edition ruleset.

I don't really know anything about XML, scripts and such, but given time I can figure it out (usually).

I've already defined the total character level (classes.totallevel.level)

What I want to do is fill in a certain box on the skill tab of the character sheet with one-half of that total character level, rounded down.

What is the syntax for that operation? Is there a round or truncate function?

Thanks,
Jeff

Hamish
August 25th, 2007, 21:03
You can find the Lua reference at:
https://www.lua.org/manual/5.1/

The function you need is math.floor, I think:
https://www.lua.org/manual/5.1/manual.html#pdf-math.floor

GoOrange
August 25th, 2007, 21:58
Hey - exactly what I was looking for - thanks for the info!

Now for some reason I can't get it to call up the variable I created on the main page and integrate it into the skill list...

Hamish
August 26th, 2007, 09:18
Hmmm, I hope for our sake Joshuha is going to read this. He'll be able to tell you if I'm right.

I think you can't directly reference a value on another page of the character sheet. The proper way to go is to get the value from the databse. I'm struggling to come to grips with things like this myself, so I can't really help you any more than that I'm afraid.