English A message every 1 minute

9 replies
Goto Page
To the start Previous 1 Next To the start
26.07.16 04:57:30 pm
Up
kerker
User
Offline Off
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!
26.07.16 05:04:18 pm
Up
Yates
Reviewer
Offline Off
Code:
1
2
3
4
function _minute()
     msg("this?")
end
addhook("minute", "_minute")


What do you mean by "once in 1 minute written any message"?
26.07.16 05:22:33 pm
Up
Baloon
GAME BANNED
Offline Off
@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:
Code:
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.
26.07.16 05:30:51 pm
Up
kerker
User
Offline Off
user Yates Thanks!
@user Baloon: Thanks for trying but I'm happy with the previous script.
26.07.16 05:35:59 pm
Up
Yates
Reviewer
Offline Off
@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).
26.07.16 08:13:38 pm
Up
The Grim Reaper
User
Offline Off
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
Pc died.
26.07.16 09:14:47 pm
Up
Yates
Reviewer
Offline Off
@user The Grim Reaper: Genius:
user kerker has written:
Not with the add trigger msg on map.
27.07.16 07:41:57 am
Up
ohaz
User
Offline Off
@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?
https://ohaz.engineer - Software Engineering
17.08.16 03:58:40 am
Up
QuakeR
BANNED
Offline Off
Should this work of course,

Code:
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
Ban Reason: Multiple account of TN Anonymous /ZxC
17.08.16 05:01:00 am
Up
Baloon
GAME BANNED
Offline Off
Broadcasts message(s) in table.
Code:
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
Code:
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