Glitchfinder
Staff
Well, I've posted a few times before regarding a timer that I was creating to utilize in another script I was building, and finally got that finished and working perfectly. Now, I'm working on the main script to utilize it, and the timer has stopped updating. I'm not sure what's causing the problem, so I'll just post my script and the "working" sime script. (The thing is, it works when I hook it up to something other than my current script.)
Well, here's the timer I'm currently using. I know it's called a "subtimer", but that's because I have a second copy of that script already in use as "Weather_Timer".
Well, I figured out my problem. I had accidentally had an "if variable = number" instead of "if variable == number". Silly me. Thanks for looking, though!
Well, here's the timer I'm currently using. I know it's called a "subtimer", but that's because I have a second copy of that script already in use as "Weather_Timer".
Code:
class Weather_SubTimer
def initialize
@waiting = false
@frames = 0
end
def update
if @waiting == true
if @frames <= 0
@waiting = false
else
@frames -= 1
end
end
end
def start(seconds)
@waiting = true
@frames = seconds*40
end
def check
if @waiting == false
return true
else
return false
end
end
end
Well, I figured out my problem. I had accidentally had an "if variable = number" instead of "if variable == number". Silly me. Thanks for looking, though!