Code: Select all
begin EG_SpinWheel
short button
short messageOn
short state
float timer
set state to 0
if ( MenuMode == 1 )
return
endif
set timer to ( timer + GetSecondsPassed )
if ( OnActivate == 1 )
MessageBox, "Spin thread", "Marshmerrow", "Kresh", "Exit"
set messageOn to 1
endif
if ( messageOn == 1 )
set button to GetButtonPressed
if ( button >= 0 )
set messageOn to 0
endif
if ( button == 0 )
if ( player->GetItemCount "ingred_marshmerrow_01" >= 5 )
player->RemoveItem "ingred_marshmerrow_01", 5
player->AddItem "EG_MarshmerrowThread", 1
MessageBox "You begin to spin thread from marshmerrow."
PlaySound "Item Misc Up"
set state to 1
else
MessageBox "You don't have the resources."
endif
elseif ( button == 1 )
if ( player->GetItemCount "ingred_kresh_fiber_01" >= 5 )
player->RemoveItem "ingred_kresh_fiber_01", 5
player->AddItem "EG_KreshThread", 1
MessageBox "You begin to spin thread from kresh fiber"
PlaySound "Item Misc Up"
set state to 1
else
MessageBox "You don't have the resources."
endif
else
return
endif
endif
if ( state == 1 )
if ( timer > 10 )
PlaySound "Item Misc Up"
set state to 0
endif
endif
end EG_SpinWheelSince then I've tried shifting things around adding things solving it differently. I changed it to rely on the state variable a few tries ago... I checked the the other scripts with timers in game a million times, checked wiki documentation, googled around. None of it worked!
I'm starting to wonder if maybe the MessageBox or buttons create problems with GetSecondsPassed method? Or maybe I overlooked something and can't see it because I'm too tangled up. >.>

