Talk:Ceil

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search

Buggy? (A: No)[edit source]

seems like this function doesn't like parentheses and expressions that contain other functions.

set dummy to player.getav sneak 
set result to ceil dummy / 25

works fine

set result to ceil player.getav sneak / 25

returns "Unknown variable getav"

set result to ceil ( player.getav sneak / 25 )

returns "Missing parameter float"

--JOG 06:45, 21 August 2006 (EDT)

afaik, all functions behave like that. It's not something specific to ceil.
--Timeslip 08:13, 21 August 2006 (EDT)


--JOG 09:35, 21 August 2006 (EDT): Uhm... Yes of course, forget this ;)


JOG 14:18, 21 August 2006 (EDT): No, actually it still doesn't do what I want:

set floatvar to 0.55
set shortvar to ceil 11 * floatvar - 5

returns 1 instead of 2 so it's most likely compiled to ceil(11)* floatvar - 5

set floatvar to 0.55
set shortvar to ceil ( 11 * floatvar - 5 )

won't compile ("Missing parameter float"). This makes the function a bit useless for me, because I don't want to use a second dummy-float, just to set the ceiled variable into a short. I'd rather use:

set floatvar to 0.55
set shortvar to 11 * floatvar - 4.01


Another example:

short x ; = 3
short y ; = 2 

set x to y * x / 1.9           

Will set x to 3:

2 * 3 / 1.9 = 3.16 => truncated to 3
set x to y * ceil ( x / 1.9 )

Would set x to 4:

3 / 1.9 = 1.58 => ceiled to 2
2 * 2 = 4
Dragoon Wraith TALK 15:07, 21 August 2006 (EDT): No function (to my knowledge) in Oblivion will take a mathematical expression as an argument, and these mathematical functions, unfortunately, are no different. In order to do this:
set shortvar to ceil ( 11 * floatvar - 5 )
You would need to do this:
set tempvar to ( 11 * floatvar - 5 )
set shortvar to ceil ( tempvar )
I don't believe there's any way around that.
JOG 16:02, 21 August 2006 (EDT) : Yep, again those functions fooled me...
This makes ceil and floor pointless though, because set short to expression + 0.99999 is a one-line ceil and set short to expression is a one-line floor.

Point? (A: No)[edit source]

Isn't there already a way of rounding a number to the next highest integer? The Imperial Dragon 20:16, 21 August 2006 (EDT)

Ceiling and Floor


I think it would be more ethical (I think that's the word I was looking for, whatever it is, I meant more preserving, etc...) to use that method instead if you plan on using only this function from the OBSE? Because using the OBSE limits your mods to non-Direct 2 Drive/non-localized version users... The Imperial Dragon 20:21, 21 August 2006 (EDT)


--JOG 22:01, 21 August 2006 (EDT): I know very well how to round stuff as you can read above. If you show me an ethical way to emulate GetObjectValue, GetEquippedObject, IsKeyPressed2, Con SetGameSetting and TapKey I have no problems with not using OBSE, Ceil is useles for me anyway... ;-)
Ah, but I said if that is the only function out of the pack you use. ;]
No, I didn't read the stuff above. Though, I don't really see much use for this function however... As much as I may appreciate the package of functions. The Imperial Dragon 23:32, 21 August 2006 (EDT)
Dragoon Wraith TALK 11:29, 23 August 2006 (EDT): To be perfectly honest, I don't really understand the point of ceil and floor to begin with anyway. They're perfectly simple to duplicate quite easily with normal code.