• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Problem using "wait()" function!

Rayeko

Programmer
Joined
Apr 9, 2008
Messages
185
Reaction score
3
Hi.

The reason I made this topic is because I wanna know how can I use the "wait" system the TFS 0.3.6 has? I tried using like: wait(3000) for 3 seconds, but I get this error:
Code:
[22/03/2010 22:06:35] [Error - TalkAction Interface] 
[22/03/2010 22:06:35] data/talkactions/scripts/stats/charge.lua:onSay
[22/03/2010 22:06:35] Description: 
[22/03/2010 22:06:35] attempt to yield across metamethod/C-call boundary
[22/03/2010 22:06:35] stack traceback:
[22/03/2010 22:06:35] 	[C]: in function 'wait'
[22/03/2010 22:06:35] 	data/talkactions/scripts/stats/charge.lua:17: in function <data/talkactions/scripts/stats/charge.lua:1>

This is the code I have in the lib folder:
Code:
wait = coroutine.yield

function runThread(co)
	if(coroutine.status(co) ~= 'dead') then
		local _, delay = coroutine.resume(co)
		addEvent(continueThread, delay, co)
	end
end

function createThread(data)
	local dataType, func = type(data), nil
	if(dataType == 'string') then
		func = loadstring(data)
	elseif(dataType == 'function') then
		func = data
	end

	if(func ~= nil) then
		local co = coroutine.create(func)
		runThread(co)
	else
		print("[createThread]", "Invalid data specified.")
	end
end

I would appreciate if somebody knows something about this..
 
i'm not very experienced with the upper levels of .lua
but i am pretty sure you could use a delay
like a delay for teleport or something
or in other words what your doing does't make any sense
 
@Zor
Yeah, that's what I wanna do. You know, there's a function called "doEvent" something like that.. And I used that for making delays inside my scripts.. But that function slows downs everything. That's why I was asking if someone knows how to use the function of "wait()" that comes with TFS.
Or if that function actually, does what I think it does.
 
addEvent(doSendAnimatedText, 0 * 1000, itempos1 , "60" , math.random(01,255))
addEvent(doCreateItem, 60 * 1000, wallid1 , 1 ,wall1 )
addEvent(teleportThing, 5 * 1000, seconds)

i don't know if i understood you right
but if you are interested in delays then try these
 
The wait function wont work until elf updates it I suppose.. Might already be updated in the new rev though, havent looked.
 
Back
Top