Hello everyone, I apologize if this question is dumb but I just started this out.
I compiled a script which takes the current time and stores it in a variable, however, even though the script works as intended it also seems to freeze the game in its loop.
I know I can achieve this using common events, but for reasons, I want to be able to do it within script.
I set the common event to parallel process and all, but it just won't work.
Here's the script and the event :
#still a test, class that handles time and updates the prices
class Prices_Updater
def initialize
@current_prices = 0
@starting_time = Time.now
@interval_time = 5
end
def update_prices
@current_time = Time.now
if @current_time - @starting_time >= @interval_time
puts "Currently this amount of time has passed : "
print @current_time - @starting_time
puts ""
@interval_time = @interval_time + 5
end
end
end
Parallel Process Event call :
updater = Prices_Updater.new
loop do
updater.update_prices
end
Thank you sooo much to anyone that can help me out, I'm sure it's something very daft but still
I compiled a script which takes the current time and stores it in a variable, however, even though the script works as intended it also seems to freeze the game in its loop.
I know I can achieve this using common events, but for reasons, I want to be able to do it within script.
I set the common event to parallel process and all, but it just won't work.
Here's the script and the event :
#still a test, class that handles time and updates the prices
class Prices_Updater
def initialize
@current_prices = 0
@starting_time = Time.now
@interval_time = 5
end
def update_prices
@current_time = Time.now
if @current_time - @starting_time >= @interval_time
puts "Currently this amount of time has passed : "
print @current_time - @starting_time
puts ""
@interval_time = @interval_time + 5
end
end
end
Parallel Process Event call :
updater = Prices_Updater.new
loop do
updater.update_prices
end
Thank you sooo much to anyone that can help me out, I'm sure it's something very daft but still