Line 48 invalid timer function

[code]local function countDown(e)
if(time_remain == 10) then
ready = true;
display_txt.text = “Go!”;
end
time_remain = time_remain - 1;
countDowntxt.text = time_remain;

if(time_remain == 0) then
time_up = true;

if(o ~= 0) then
display_txt.text = “FAIL!”;
ready = false;
end

end
end
[/code]

If anybody could help me out with this problem, this is what it says in the error log,

"WARNING: Invalid reference point constant passed to object: setReferencePoint()
Runtime error
main.lua:48: attempt to index global countDowntxt’ (a nil value)
main.lua:48: in function ‘_listener’
?: in function
If anybody could help me out to fix this, that’d be great. Thanks! [import]uid: 19768 topic_id: 6499 reply_id: 306499[/import]

Also, this is from my own code. Thanks. [import]uid: 19768 topic_id: 6499 reply_id: 22514[/import]

Bump. Please. [import]uid: 19768 topic_id: 6499 reply_id: 22585[/import]

Two points:

  1. It says the error is on line 48, but which line is that? You’ve obviously not posted all your code, since what you posted is only 18 lines.

  2. The error message says that countDowntxt is set to nil, so check that you’ve created the display object before you call the function. I have no idea what you are doing with countDowntxt outside of this countDown() function since you haven’t posted any of that. [import]uid: 12108 topic_id: 6499 reply_id: 22591[/import]

I fixed it. Thanks for help. Now just one more thing. I’ve checked the onCollision docs, but they are so confusing.

I want it so that when the object drops, and hits the ground, it creates a win/loss function. I already have winLoss function. But it’s for a different set. So how do I make it so that, when it hits, It shows up fail, and makes you have to restart.

Thanks. [import]uid: 19768 topic_id: 6499 reply_id: 22624[/import]