Help with your scripting

Issue with States?

Issue with States?

Postby Shando » 13 Mar 2019, 05:15

Hi all,

I've just tried using the Game States in the "Lite" Version (using 'state.setGameStart ( )', and it appears that the "onEnter" state gets executed almost 200 times?

This is the output from my run where I've used an 'lprint' for each function (I've cut a lot of the "onEnter" out, but there was a total of 198 of them):

Code: Select all
onInit
loadLayouts
loadTiles
loadHighScores
onKeyDown
onEnter_GameStart
onEnter_GameStart
onEnter_GameStart
...
onEnter_GameStart
onEnter_GameStart
onEnter_GameStart
onEnter_GameStart
onEnter_GameStart
onExit_GameStart
onEnter
onStop


Thanks in advance

Shando

PS: I have run this a few times and get 198 'onEnter_GameStart' each time.
PPS: Just re-run with an 'lprint' for each line of code in the 'onEnter' and none of the lprints are printed to the console.
PPPS: Just tried with 'sky.setGameState ( 3 )', which appears to work better, but it only prints the 1st 'lprint' (which is followed by 'camera.setPosition ( cam, 0, 25, -20 )' - does this mean that States cannot access variables (the camera was set up in the Scene Editor)?
Ryzen 7 4800H 16GB GTX1650 Win 11 64
Love, Hope, Strength http://www.lovehopestrength.co.uk
User avatar
Shando
Skyline Moderator
Skyline Moderator
 
Posts: 560
Joined: 06 Mar 2013, 22:35
Location: Moffat Beach, Queensland
Skill: Programmer
Skill: Scripter
Skill: Level Designer

Return to Lua Scripting

Who is online

Users browsing this forum: No registered users and 1 guest

cron