Scripting problems... - by Slith
Slith on 24/8/2002 at 14:22
I've been having a little trouble with a script...
begin DS_mfr_falsebed
; Acts like a normal bed, until the player possesses
; the Empty Bottle of Skooma. Then the bed scoots
; aside to yield access to the trap door beneath!
short Moving
float Timer
short toggleSound
if ( MenuMode == 1 )
return
endif
if ( OnActivate == 1 )
if ( player->GetItemCount "_ds_mfr_skoomakey" > 0 )
if ( Moving == 0 )
set Moving to 1
set toggleSound to 0
elseif ( Moving == 2 )
set Moving to 3
set toggleSound to 0
endif
else
ShowRestMenu
endif
endif
; Moving states:
; 0 At rest in 'set' (covering door) position
; 1 Moving from 'set' to 'open'
; 2 At rest in 'open' (revealing door) position
; 3 Moving from 'open' to 'set'
if ( Moving == 0 )
return
elseif ( Moving == 2 )
return
elseif ( Moving == 1 )
if ( toggleSound == 0 )
PlaySound "Door Stone Close"
set toggleSound to 1
endif
MoveWorld Y, -10
"_ds_mfr_pillow"->MoveWorld Y, -10
elseif ( Moving == 3 )
if ( toggleSound == 0 )
PlaySound "Door Stone Close"
set toggleSound to 1
endif
MoveWorld Y, 10
"_ds_mfr_pillow"->MoveWorld Y, 10
endif
if ( Timer > 3 )
set Timer to 0
if ( Moving == 1 )
set Moving to 2
else
set Moving to 0
endif
return
endif
set Timer to ( Timer + GetSecondsPassed )
end
The bed that this changes doesn't seem to move *all* the way back to it's original position, and I don't understand a word of what any of this stuff says... otherwise I'd be fixing it myself ;) (I got it from: (
http://www.weathersong.net/tomorrow/tuts/first01.html)) Anyway, I'd really apprieciate help with this.
Btw; this is the very first time I've created and used a script... so I might've had a problem with a letter or sumthing, but I'd like to know if the problem is in taht script shown above.
Inline Image:
http://halo.bungie.org/wallpaper/CoviebyLaZ.thumb.jpg:thumb:
P.S. I was just trying to tie that above picture. With the given url, but it kept coming up with a page 404 error when clicked on it, and it wouldn't show the pic either... if someone would like to give it a shot and show me how it's done... Id really appreciate it.
Slith on 25/8/2002 at 01:24
Can anyone point me in the direction of a website that has more programmers on it? This little script took me all of an hour to get working... and now, well it doesn't work properly :( Heeelp! :o
I'm an angel... :angel:
Forsythe on 25/8/2002 at 01:33
Patience ;) I was at work much of today (someone did something stupid), else I would've answered sooner.
Hmm.. when you say it's not working, do you mean it does nothing? Or do you get the 'rest' menu? Or does the game freeze? Details, already ;)
Slith on 25/8/2002 at 02:21
When I have the skooma bottle in hand and click on the bed, the bed moves to the left a little bit... maybe a foot or half a foot, then I click on it again, and it moves back, but not back to original spot, no... this time it moves further to the other side. I click on it again, and it gets to it's original position... But, if I click on it Again It moves to the right instead of going a little left, Then when you click on it to move it back, the bed doesn't go all the way back. And this in turn means that when you click on it again it moves a little more to the right... untill it gets to the point that it's going through the wall. The bed rest and and whatnot is fine... I ust need to finetune this moving stuff... I need to prevent it from moving to the left when I first click on it, and I have to get it to move all the way back to the left after it has moved to the right.
It's confusing... I'll try taking screenshots of it.
Slith on 25/8/2002 at 02:50
Inline Image:
ScreenShot 10.jpgThis is what it looks like if this works.. no time now though must go to barbeque very quick...
Forsythe on 25/8/2002 at 04:47
Okay, I think I've got this one licked; try replacing this section:
Quote:
if ( Timer > 3 )
set Timer to 0
if ( Moving == 1 )
set Moving to 2
else
set Moving to 0
endif
return
endif
set Timer to ( Timer + GetSecondsPassed )
with this:
Quote:
if ( Timer > 150 )
set Timer to 0
if ( Moving == 1 )
set Moving to 2
else
set Moving to 0
endif
return
endif
set Timer to ( Timer + 1 )
If I'm right, what was going on is that your machine couldn't keep up with what his script wanted; that 'GetSecondsPassed' piece was erroneously counting seconds in which the script hadn't had a chance to run yet, making it so your bed moved unevenly. (I know I'm being unclear... sorry.. if you want a more concise description, I'll write one up) Btw, if you want to adjust how far the bed moves, modify that '150' to a greater or lesser number.
(Blast, but that 'remove-leading-spaces' part of the board is annoying... screws up indenting quite messily)
Slith on 25/8/2002 at 07:37
Thankyou Forsythe... I'm back now from the barbeque. Fun playing some MAGIC but it got cut short 'cause it was time to go home :sweat:
Forsythe on 25/8/2002 at 08:46
Anytime ;) Glad you had a good'un ;)