Forum

> > CS2D > Scripts > Timer never comes back
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Timer never comes back

4 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Timer never comes back

Mami Tomoe
User Off Offline

Zitieren
Hi!
I need help with.... LUA!
OK so this is a timer that will call a function after 2 minutes and 22 seconds:

1
timer(133200,"themeOver",tonumber(id))

This is the function:
1
2
3
function themeOver(id)
	themePlaying[tonumber(id)]=false
end

But my problem is that the song is finished but the timer never calls the function!

alt Re: Timer never comes back

Bowlinghead
User Off Offline

Zitieren
Try:
1
timer(133200,"themeOver",""..id.."")
(parsing parameter as string)

• You already have tonumber() in your function
cs2d.net hat geschrieben
Moreover it can pass an optional string parameter ("parameter") to this function
1× editiert, zuletzt 15.04.17 20:23:27

alt Re: Timer never comes back

Mami Tomoe
User Off Offline

Zitieren
Mehr >


Hi, instead of creating a new topic I will use this one instead.
I have the same problem again with this:
1
2
3
4
5
6
7
8
9
if isNight()==false then
			parse("sv_sound2 "..id.." terraria/themes/01 - Overworld Day.ogg")
			themePlayingDay[id]=true
			timer(140000,"themeOverDay",""..id.."")
		else
			parse("sv_sound2 "..id.." terraria/themes/03 - Overworld Night.ogg")
			themePlayingNight[id]=true
			timer(120000,"themeOverNight",""..id.."")
		end
And I use what you told me
please help!
1× editiert, zuletzt 08.05.17 19:19:40

alt Re: Timer never comes back

Cloudy71
BANNED Off Offline

Zitieren
You can also try inserting
tostring(id)
as parameter and in the timer's function use
1
2
id = tonumber(id)
themePlayingDay[id] = false
It should work. If it won't, there's probably another mistake.

Using
""..id..""
is really NOT working example.

alt Re: Timer never comes back

Mami Tomoe
User Off Offline

Zitieren
This worked:
1
2
3
4
5
6
7
8
9
if isNight()==false then
			parse("sv_sound2 "..id.." terraria/themes/01 - Overworld Day.ogg")
			themePlayingDay[id]=true
			timer(140000,"themeOverDay",id)
		else
			parse("sv_sound2 "..id.." terraria/themes/03 - Overworld Night.ogg")
			themePlayingNight[id]=true
			timer(120000,"themeOverNight",id)
		end
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht