I was putting the final touches on a LoG teaser when a puzzle that had worked flawlessly before suddenly started exhibiting a troublesome error. If any of you have ever played Dead to Rights, you'll doubtless remember those annoying 'hotzone' puzzles where you had to keep your pointer in an ever moving safe area. This puzzle sort of parodies that concept, using playeraction to guide a little tick inside a safe zone that randomly moves left or right. However, now that I've been testing this, it seems that the game boots me back to the desktop whenever I leave the safe area for the first time. :\
Code:
# showertweak.cog # [Grismath] #==============================================================# symbols message entered message playeraction message timer message pulse message touched sector shower flex time=0.5 local thing showercam thing pointer thing bar flex barvel local sound score int count=0 local int points=0 local int played=0 local int said=0 local surface downstairs int speech_handle local material gface thing player local sound g_smell sound g_shell sound g_pipery sound g_boil sound g_tepid sound showertheme int music local thing showerguy thing advcam thing knob end #==============================================================# code #------------------------------------------------------ touched: if(GetSenderRef()==downstairs && played==0) { if(said==0) { said=0; Print(""); Print("I had better shower first."); Print("I look, feel, and smell despicable."); Print(""); Print(""); PlaySoundLocal(g_smell, 1, 0, 0x0); speech_handle = MaterialAnim(gface, 4, 0x1); Sleep(GetSoundLen(g_smell)); StopAnim(speech_handle); } } return; #------------------------------------------------------ entered: if(GetSenderRef()==shower && played==0) { played=1; //Sleep(2.0); SetActionCog(GetSelfCog(),0x7fffffff); SetCurrentCamera(0); SetCameraFocus(0, showercam); CaptureThing(pointer); CaptureThing(bar); SetActorFlags(player, 0xa00000); SetActorFlags(GetLocalPlayerThing(), 0x20000000); Print(""); Print(""); Print("I'm about to take a shower from Hell."); Print(""); Print(""); PlaySoundLocal(g_shell, 1, 0, 0x0); Sleep(GetSoundLen(g_shell)+0.2); Print(""); Print("This house's pipery is poorly designed,"); Print("and Rajiv is not helping."); Print(""); Print(""); PlaySoundLocal(g_pipery, 1, 0, 0x0); Sleep(GetSoundLen(g_pipery)+0.2); Print(""); Print("Unless I constantly regulate the"); Print("cold water output, I'll be boiled alive."); Print("So it's imperative that I..."); Print(""); PlaySoundLocal(g_boil, 1, 0, 0x0); Sleep(GetSoundLen(g_boil)); ClearActorFlags(player, 0xa00000); SetTimer(time); SetPulse(0.2); Print(""); Print(""); Print("STAY IN THE TEPID ZONE!."); Print(""); Print(""); PlaySoundLocal(g_tepid, 1, 0, 0x0); Sleep(GetSoundLen(g_tepid)+0.3); Print(""); Print(""); Print(""); Print(""); Print(""); ClearActorFlags(GetLocalPlayerThing(), 0x20000000); music=PlaySoundLocal(showertheme, 1, 0, 0x1); } return; #------------------------------------------------------ playeraction: if(GetParam(0)==14) return; if(GetParam(0)==5.0) { SetThingVel(pointer, VectorScale(GetThingLVec(pointer), (GetParam(2)/1000))); Rotate(knob, VectorSet((GetParam(2)/1000), 0, 0)); } ReturnEx(0); return; #------------------------------------------------------ timer: if(count==30) { SetTimer(0); SetPulse(0); //Print("SCORE"); //PrintInt(points); SetActionCog(GetSelfCog(),0); SetCameraFocus(0, advcam); SetAdjoinFlags(downstairs, 7); StopSound(music, 1); return; } if(time<=0) { time=0.5; } barvel=Rand(); if(Rand()>=0.5) { barvel=(barvel*-1); time=time-0.1; } else { time=time+0.1; } //PrintInt(count); SetThingVel(bar, VectorScale(GetThingLVec(bar), (barvel/2))); count=count+1; SetTimer(time); return; #------------------------------------------------------ pulse: if(VectorX(GetThingPos(pointer))>=(VectorX(GetThingPos(bar))-0.05) && VectorX(GetThingPos(pointer))<=(VectorX(GetThingPos(bar))+0.05)) { points=points+1; if(GetThingHealth(GetLocalPlayerThing())<100) SetThingHealth(GetLocalPlayerThing(), (GetThingHealth(GetLocalPlayerThing())+5)); } else { PlaySoundLocal(score, 1, 0, 0x0); //DamageThing(GetLocalPlayerThing(), 20, 0x1, GetLocalPlayerThing()); //if(GetThingHealth(GetLocalPlayerThing())<=0) { //DamageThing(showerguy, 999, 0x1, showerguy); //} } return; #------------------------------------------------------ end