Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: fantome2024 on November 03, 2015, 09:05:07 PM

Title: Light switch not working. Help error Loop count exceeded maximum 1000
Post by: fantome2024 on November 03, 2015, 09:05:07 PM
Hello, I'm brand new to Playmaker and trying to figure out connecting a switch to lights. Here is what I'm trying to do.

On "Mouse pick event" flip lights "On"
On "Mouse pick event" flip lights "Off"

but when I click the switch I receive the error below

Switch : FSM : Loop count exceeded maximum: 1000 Default is 1000. Override in Fsm Inspector.
UnityEngine.Debug:LogError(Object)
HutongGames.PlayMaker.FsmLog:AddEntry(FsmLogEntry)
HutongGames.PlayMaker.FsmLog:Log(FsmLogType, String)
HutongGames.PlayMaker.FsmLog:LogError(String)
HutongGames.PlayMaker.Fsm:EnterState(FsmState)
HutongGames.PlayMaker.Fsm:SwitchState(FsmState)
HutongGames.PlayMaker.Fsm:UpdateStateChanges()
HutongGames.PlayMaker.Fsm:UpdateState(FsmState)

Here is the pic of what I've done

Title: Re: Light switch not working. Help error Loop count exceeded maximum 1000
Post by: terri on November 03, 2015, 10:05:12 PM
Is it the same if you use mouse up instead of mouse down?
Title: Re: Light switch not working. Help error Loop count exceeded maximum 1000
Post by: fantome2024 on November 03, 2015, 10:16:12 PM

Correct same thing happens. I set both events to "mouse up" and it happened again.
Title: Re: Light switch not working. Help error Loop count exceeded maximum 1000
Post by: djaydino on November 04, 2015, 01:10:16 AM
Hi,
you can try to add 2x a state with a "mouse pick event" with a "mouse up" and "mouse off" on it. and place those in between
Title: Re: Light switch not working. Help error Loop count exceeded maximum 1000
Post by: fantome2024 on November 04, 2015, 07:50:59 AM
Hi,
you can try to add 2x a state with a "mouse pick event" with a "mouse up" and "mouse off" on it. and place those in between

Wouldn't that make it if I moved off the object the light would turn off? I want to be able to click On/Off  like an actual light switch.  If I'm mistaken could you elaborate a little more on how to setup. Like a drawing or pic. Thank you
Title: Re: Light switch not working. Help error Loop count exceeded maximum 1000
Post by: Rabagast on November 04, 2015, 08:06:16 AM
Hi!

You can add a new state between those two with the action Wait 0.1 sec. it happened to me also
Title: Re: Light switch not working. Help error Loop count exceeded maximum 1000
Post by: djaydino on November 04, 2015, 08:33:48 AM
Hi,
an easier way is to add a state with a "next frame" action between your actions
Title: Re: Light switch not working. Help error Loop count exceeded maximum 1000
Post by: Rabagast on November 04, 2015, 09:22:34 AM
I think you need a delay between the two states. therefor I normally add a wait action with 0.1 sec.
Title: Re: Light switch not working. Help error Loop count exceeded maximum 1000
Post by: Rabagast on November 04, 2015, 09:24:47 AM
You are right! It worked with Next Frame Action! :)
Title: Re: Light switch not working. Help error Loop count exceeded maximum 1000
Post by: Lane on November 04, 2015, 09:44:41 AM
It just happens that the next state is reached inside the same frame and the conditions are still true so it again goes to the next state... where the conditions are still true...

Ends up looping too much and throws the flag. Next Frame Event fixes this most of the time, but you could also fix it by using Get Mouse Button Down and Get Mouse Button Up which behave differently.
Title: Re: Light switch not working. Help error Loop count exceeded maximum 1000
Post by: fantome2024 on November 04, 2015, 06:42:11 PM
It just happens that the next state is reached inside the same frame and the conditions are still true so it again goes to the next state... where the conditions are still true...

Ends up looping too much and throws the flag. Next Frame Event fixes this most of the time, but you could also fix it by using Get Mouse Button Down and Get Mouse Button Up which behave differently.

Sorry I'm really new to this. Could you draw something or give me a visual of how to should be setup
Title: Re: Light switch not working. Help error Loop count exceeded maximum 1000
Post by: djaydino on November 05, 2015, 01:52:28 AM
Hi,
Here you go :)