FYI
What I want is for the timer that triggers the spawner function to update its frequency(f) everytime it changes(changed by function time) so the spawner with start spawning slowly and then go faster and faster and faster
But once the timer is set it does not update the frequency
If I use the update and set the timer on false a timer will be initiated 60 times each secondso it doesnt work
If I use another timer to timer the timer the inner timer will only play when the other timer does and The outer timer still wont update the frequency
The purpose of the 1 second timer calling into time() seems to be to decrease t by 5 every second. (and do something/nothing with f).
The purpose of the 2 second (f) timer calling into spawner() seems to be to depending on the value of t post one out of a several messages to spawn something.
What is not working? Did you expect the timer for spawner() to be called more and more frequently? It will never do that since it started in init() with a 2 second interval. Modifying f afterwards will not change the timer. You need to stop and restart the timer with a new value to f for that to happen.
Sorry I cant do code font iphone just wont add a backwards ‘ for the code font style
Oh fricking frick what the hell the f was suppose to be f=fx0.95
Can I ask how does timers work
Does it start off by wait for the time after jt is called then do the function or does it do the function then wait for the time
WAIT WAIT CAN I make it so there will be a third function called repeater, i remove the f from timer function and so first I ativate the timer calling the spawn once with false for repeat then at the end of the spawn function I add a link to activate the repeater function and the repeater function will be this
Function repeater()
____F=1
____If f >0.1 then
_________F=f*0.95
____End
____Timer.delay(f,false,spawn)
End
Will thus form a loop and so the time updates omg im a genius
Also I dont understand the timer.stop function it goes like putting timer.stop() in the function that has timer.delay but when I load it it says expect variable in () so I just left a random 2 in the timer.stop(2) and it worked what is the () suppose to be for WHATS HANDLE
Also whats this weird banner icon next to the report button that seems to not do anything when I click
local function next_bullet(self)
-- if we already have a timer firing bullets we need to cancel it
-- we also change to the next type of bullet to fire
if self.fire_timer then
timer.cancel(self.fire_timer)
self.bullet_type = math.min(self.bullet_type + 1, #self.bullets)
end
-- get the bullet to fire
local bullet = self.bullets[self.bullet_type]
-- start a timer to call the bullet fire() function with the defined
-- interval
self.fire_timer = timer.delay(bullet.frequency, true, bullet.fire)
end
function init(self)
-- definition of bullets to fire
self.bullets = {
{
frequency = 2,
fire = function() msg.post("/bullet_sender#bullet_sender", "wb") end,
},
{
frequency = 1.9,
fire = function() msg.post("/bullet_sender#bullet_sender", "db") end,
},
{
frequency = 1.8,
fire = function() msg.post("/bullet_sender#bullet_sender", "sb") end,
},
}
-- start with the first bullet type
self.bullet_type = 1
-- start firing the bullet
next_bullet(self)
-- start a timer that every 30 seconds will change to the next bullet
timer.delay(30, true, next_bullet)
end