Forum

> > CS2D > Scripts > A message every 1 minute
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch A message every 1 minute

9 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt A message every 1 minute

kerker
User Off Offline

Zitieren
In a previous thread I asked a question, but checked all the options, why the number of messages lasted for 2 pages.This time I'll see all the variations thoroughly.
And the question that I now ask: how to do so once in 1 minute written any message.Not with the add trigger msg on map.
• Thank you in advance!

alt Re: A message every 1 minute

Yates
Reviewer Off Offline

Zitieren
1
2
3
4
function _minute()
	msg("this?")
end
addhook("minute", "_minute")

What do you mean by "once in 1 minute written any message"?

alt Re: A message every 1 minute

Baloon
GAME BANNED Off Offline

Zitieren
@user Yates: sometime, minute hook are not accurate because it depends with operation sytem clock or called os.clock. So, I think my code is more accurate than yours:
1
2
3
4
5
6
7
8
9
time=0
function timing()
 time=time+1
 if time>=60 then
  time=0
  msg("this?")
 end
end
addhook("second","timing")

Of course, your code is works properly and more efficient than mine.

alt Re: A message every 1 minute

Yates
Reviewer Off Offline

Zitieren
@user Baloon: Your code will trigger exactly the same time as as my code. If you wanted a smart answer you could have gotten the
os.clock
time and exectuted a cs2d lua cmd timer on the first whole minute which triggers itself and a function each minute (checking
os.clock
every second would be cumbersome - use a timer).

alt Re: A message every 1 minute

The Grim Reaper
User Off Offline

Zitieren
uhm boyz there is also a other way
1) Goto map editor. Choose the map that you want the msg in.
2) Goto entities(the light bulb)
3) And place Trigger_Start, trigger_delay and func_Message      
anywhere on the map.
4) (double click to select)Give The func_message and
Trigger_delay a name.
5) Select Trigger_Start and let it trigger Trigger_delay.
6) Select Trigger_Delay and let it trigger Func_message.
7) Finally select the Func_message and type in the message That                          
you want to appear.
oh and set the time when u want it to appear inTrigger_delay
Spoiler >
1× editiert, zuletzt 26.07.16 20:32:14

alt Re: A message every 1 minute

ohaz
User Off Offline

Zitieren
@user Baloon: haha, you really think that the second hook does not use the os clock? also, you really think that there are more exact ways to do that in cs2d? Also, you really think that you NEED more exact ways than the os clock?

alt Re: A message every 1 minute

QuakeR
BANNED Off Offline

Zitieren
Should this work of course,

1
timer(20000, "parse", "sv_msg ©000255000This script for italine-RUS", 2)

-Why you can't make timer ? and put the "sv_msg" then it work

alt Re: A message every 1 minute

Baloon
GAME BANNED Off Offline

Zitieren
Broadcasts message(s) in table.
1
2
3
4
5
6
7
8
9
message={"Hello","how are you","you are handsome"}
addhook("always","timing")
function timing()
 freehook("always","timing")
 for i=1,#message do
  timer((60*1000),"msg",message[i])
  timer((60*1000),"timing")
 end
end
Randomly
1
2
3
4
5
6
7
8
message={"Hello","how are you","you are handsome"}
addhook("always","timing")
function timing()
 freehook("always","timing")
 local i=math.random(1,#message)
 timer((60*1000),"msg",message[i])
 timer((60*1000),"timing")
end
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht