Hi Mike,

I had some time to start to play with TBEM module, but I found a little problem which demonstrates following script.
Maybe it is just that I misunderstood something.

The script should add 5 rabbits and 3 wolves ( no, I am not drunk, just test sample ):
[code=thinbasic]
uses "CONSOLE"
uses "TBEM"

begin const
%evt_AddElement = 1
end const

Scene_Init()

' -- Prepair events
dim eventAdd as long
eventAdd = TBEM_AddEvent("Scene_AddRabbit", %evt_AddElement)
TBEM_Addtrigger(%evt_AddElement)
TBEM_setRepeat(eventAdd, %TRUE, 1000)

console_PrintLine("Program started, it will add 5 rabbits, 3 wolves and then end ")

while Scene_Built = 0
' -- Our event loop
TBEM_Run
wend

' -- Aux functions
sub Scene_Init()
Global Scene_Built as long = 0
Global Scene_NumRabbits as long = 0
Global Scene_NumWolves as long = 0
end sub

sub Scene_AddRabbit()

if Scene_NumRabbits = 5 then
TBEM_SetEventFunc(eventAdd, "Scene_AddWolf")
console_printline("-- Time to spawn wolves")
else
incr Scene_NumRabbits
console_printline("Rabbit"+STR$(Scene_NumRabbits)+" added")
endif

end sub

sub Scene_AddWolf()

if Scene_NumWolves = 3 then
TBEM_SetEventFunc(eventAdd, "Scene_AddRabbit")
Scene_Built = 1
else
incr Scene_NumWolves
console_printline("Wolf"+STR$(Scene_NumWolves)+" added")
endif

end sub
[/code]

After adding 5 rabbits and changing the func to add wolves it GPFs.


Thanks,
Petr