Talk:Set

From the Oblivion ConstructionSet Wiki
Revision as of 21:39, 23 June 2006 by imported>DragoonWraith (good stuff)
Jump to navigation Jump to search

-- Grey: Doesn't the negative factor in the given example need to be in brackets?

--JOG 03:38, 17 April 2006 (EDT) No, you just need NO space between minus and variable. You need the space when you use the minus as operator, though. ("b+a" compiles, "b-a" doesn't, you need "b - a".)

What happens to the rest of the script when you divide by 0; does it continue processing or stop completely? --Omzy 01:42, 23 June 2006 (EDT)

Just found out that if you divide by zero in any script, the game will never run that script again. So, if I had two variables, x and y, and they constantly change and I want to find the ratio x / y, if y is 0 at any point, the script stops and never runs again (even in GameMode and ScriptEffectUpdate blocks). --Omzy 01:49, 23 June 2006 (EDT)
The reason for this is that anything divided by zero is (infinite/impossible?). If you've ever tried dividing any number by zero, the calculator displays ERROR.
When you think about it, it really is a mind-boggling question. How many times can nothing go into one, or one hundred? The Imperial Dragon 12:20, 23 June 2006 (EDT)
Dragoon Wraith TALK 15:49, 23 June 2006 (EDT): It makes sense that x/y wouldn't work so long as y==0, but as soon as y!=0, it should work again. The fact that it does not is quite serious, though also fairly simple to fix, at least in this relatively simple example:
if ( y != 0 )
  set z to x/y
endif
In other situations, though, that may be more difficult to do.
I have it set up so that
if y == 0
   Set y to y + .001
endif
That makes it still approximate the calculation, even if it isn't perfect. --Omzy 16:44, 23 June 2006 (EDT)

Division by zero isn't the only such issue, the game shuts down the script whenever it stumbles upon an illegal command that wasn't caught by the construction set. Another example is this:

if < 2
endif

The IF-statement compiles fine, but once it is executed, the script stops completely.

Open Oblivion.ini and set bDisableWarning=0 and you'll get an error message that tells you that the script will be stopped.--JOG 16:48, 23 June 2006 (EDT)

That sounds like a valuable tool! --Omzy 16:57, 23 June 2006 (EDT)
Dragoon Wraith TALK 22:39, 23 June 2006 (EDT): Indeed it does, thank you JOG!