Difference between revisions of "Talk:Move/slide an object up and down"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Lanceor
(New page: I found that the script failed to work as-is. The condition in the onactivate block: if xObject == 0 wasn't firing so the initial variables weren't set. I rectified it by changing the l...)
 
imported>DragoonWraith
 
(6 intermediate revisions by 3 users not shown)
Line 5: Line 5:
wasn't firing so the initial variables weren't set. I rectified it by changing the line to checking a DoOnce condition. Could someone else confirm that the original script doesn't work for them as well before I update the script?
wasn't firing so the initial variables weren't set. I rectified it by changing the line to checking a DoOnce condition. Could someone else confirm that the original script doesn't work for them as well before I update the script?
--[[User:Lanceor|Lanceor]] 10:31, 14 December 2010 (EST)
--[[User:Lanceor|Lanceor]] 10:31, 14 December 2010 (EST)
:Since the very next line of code sets xObject to something not-zero, the "if xObject == 0" acts exactly the same as a DoOnce, with the advantage (??) of not using an extra variable. Can't see how this could not work.[[User:QQuix|QQuix]] 16:12, 14 December 2010 (EST)
::It ''should'' work as-is, and it makes no sense to me why it doesn't. All I can think of is the until a reference is set, xObject takes some sort of null value, but not a numerical "0" which the script may be checking for.--[[User:Lanceor|Lanceor]] 23:28, 14 December 2010 (EST)
:::References ''are'' initialized to a null value, but that value is zero (thus <tt>if ( refVar )</tt> is an effective way to test if a variable has been set). What is your modified code?
:::PS. extra spaces between comments do make things much easier to read in the plaintext, and looks the same on the page.
:::[[User:DragoonWraith|<span style="font-family: Oblivion, Daedric Runes; size=2;">D</span>ragoon <span style="font-family: Oblivion, Daedric Runes; size=2;">W</span>raith]] [[User_talk:DragoonWraith|<span style="font-family: Oblivion, Daedric Runes; size=2;">TALK</span>]] 00:18, 15 December 2010 (EST)
::::Problem resolved - turns out to be a newbie syntax error not related to setting XObject. In the line:
set xStdSpeed to -5 ; <<< Change to your liking  (units per second)
::::changing the variable to "+5" will compile but the script will not run as intended. I propose that we change the number in sample script to "5" instead of "-5". Clueless n00b's like myself will easily figure out using a minus sign for down movement, but won't make the mistake of using a plus sign for up movement.--[[User:Lanceor|Lanceor]] 01:30, 15 December 2010 (EST)
:::::Huh, I honestly didn't know that "+5" wouldn't work. It ''should'', and if it doesn't, it shouldn't compile, but this sort of thing simply doesn't surprise me anymore about the CS; it has these kinds of bugs all over the place. Yeah, I think using a default value of "5" should probably help here, that's a good idea. I'm not intimately familiar with the script and don't really feel like becoming so, so feel free to make the appropriate edits.
:::::[[User:DragoonWraith|<span style="font-family: Oblivion, Daedric Runes; size=2;">D</span>ragoon <span style="font-family: Oblivion, Daedric Runes; size=2;">W</span>raith]] [[User_talk:DragoonWraith|<span style="font-family: Oblivion, Daedric Runes; size=2;">TALK</span>]] 13:52, 15 December 2010 (EST)
::::::Done. :-) --[[User:Lanceor|Lanceor]] 03:09, 16 December 2010 (EST)
:::::::Thank you for your contributions to the CS Wiki!
:::::::[[User:DragoonWraith|<span style="font-family: Oblivion, Daedric Runes; size=2;">D</span>ragoon <span style="font-family: Oblivion, Daedric Runes; size=2;">W</span>raith]] [[User_talk:DragoonWraith|<span style="font-family: Oblivion, Daedric Runes; size=2;">TALK</span>]] 11:59, 16 December 2010 (EST)

Latest revision as of 11:59, 16 December 2010

I found that the script failed to work as-is. The condition in the onactivate block:

if xObject == 0

wasn't firing so the initial variables weren't set. I rectified it by changing the line to checking a DoOnce condition. Could someone else confirm that the original script doesn't work for them as well before I update the script? --Lanceor 10:31, 14 December 2010 (EST)

Since the very next line of code sets xObject to something not-zero, the "if xObject == 0" acts exactly the same as a DoOnce, with the advantage (??) of not using an extra variable. Can't see how this could not work.QQuix 16:12, 14 December 2010 (EST)
It should work as-is, and it makes no sense to me why it doesn't. All I can think of is the until a reference is set, xObject takes some sort of null value, but not a numerical "0" which the script may be checking for.--Lanceor 23:28, 14 December 2010 (EST)
References are initialized to a null value, but that value is zero (thus if ( refVar ) is an effective way to test if a variable has been set). What is your modified code?
PS. extra spaces between comments do make things much easier to read in the plaintext, and looks the same on the page.
Dragoon Wraith TALK 00:18, 15 December 2010 (EST)
Problem resolved - turns out to be a newbie syntax error not related to setting XObject. In the line:
set xStdSpeed to -5 ; <<< Change to your liking  (units per second)
changing the variable to "+5" will compile but the script will not run as intended. I propose that we change the number in sample script to "5" instead of "-5". Clueless n00b's like myself will easily figure out using a minus sign for down movement, but won't make the mistake of using a plus sign for up movement.--Lanceor 01:30, 15 December 2010 (EST)
Huh, I honestly didn't know that "+5" wouldn't work. It should, and if it doesn't, it shouldn't compile, but this sort of thing simply doesn't surprise me anymore about the CS; it has these kinds of bugs all over the place. Yeah, I think using a default value of "5" should probably help here, that's a good idea. I'm not intimately familiar with the script and don't really feel like becoming so, so feel free to make the appropriate edits.
Dragoon Wraith TALK 13:52, 15 December 2010 (EST)
Done. :-) --Lanceor 03:09, 16 December 2010 (EST)
Thank you for your contributions to the CS Wiki!
Dragoon Wraith TALK 11:59, 16 December 2010 (EST)