Forum

> > CS2D > Scripts > A message every 1 minute
Forums overviewCS2D overview Scripts overviewLog in to reply

English A message every 1 minute

9 replies
To the start Previous 1 Next To the start

old A message every 1 minute

kerker
User Off Offline

Quote
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!

old Re: A message every 1 minute

Yates
Reviewer Off Offline

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

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

old Re: A message every 1 minute

Baloon
GAME BANNED Off Offline

Quote
@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.

old Re: A message every 1 minute

Yates
Reviewer Off Offline

Quote
@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).

old Re: A message every 1 minute

The Grim Reaper
User Off Offline

Quote
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 >
edited 1×, last 26.07.16 08:32:14 pm

old Re: A message every 1 minute

ohaz
User Off Offline

Quote
@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?

old Re: A message every 1 minute

QuakeR
BANNED Off Offline

Quote
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

old Re: A message every 1 minute

Baloon
GAME BANNED Off Offline

Quote
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
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview