Jump to content
AeghtyAteKees

Adjust Loading Time

Recommended Posts

Hello!

 

I'm using Galv's Variable Instance Bars script, and at line 73:

ACTIVE_TIME = 100   # How long the bar takes to fill/change.

I'm wanting to change the fixed value (100) to a variable I can adjust ($game_variables[160]). However, I can't simply replace the number with the variable.

 

Can someone explain to me why not? (I get an undefined method '[]' for nil: NilClass.) Thank you!

Share this post


Link to post
Share on other sites
4 minutes ago, AeghtyAteKees said:

I'm wanting to change the fixed value (100) to a variable

You will need to change two lines in the script.

 

Line 234

@show_count = Galv_VarBar::ACTIVE_TIME

to become

@show_count = $game_variables[Galv_VarBar::ACTIVE_TIME]

 

Line 317

($game_temp.varbar[1] - $game_temp.varbar[0]) / (Galv_VarBar::ACTIVE_TIME * 0.5)

to become

($game_temp.varbar[1] - $game_temp.varbar[0]) / ($game_variables[Galv_VarBar::ACTIVE_TIME] * 0.5)

 

 

The way it is set by default is that the value is defined when you start the game and does not change because it is a Constant.

A constant is a value that is defined when you place a capital letter at the start of the name

Active_time is also a Constant

 

Constants in the game are designed to never change, hence the name constant. If they were to change errors would pop up.

 

If it was @Active_time then it becomes an instance variable, which is used throughout that class.

active_time is a local variable, lower case letter at the start

when you try to set ACTIVE_TIME = $game_variables[XXX]

it will give an error as you are trying to set a variable in a module, which does not understand [ ] symbols

You could use def blah; $game_variables[x]; end

but then you would have to call that def somewhere.

Easiest method is to change the code that calls the constant to search for a variable instead.

 

Share this post


Link to post
Share on other sites

Thanks for the answers!

 

I'm now getting an error saying unexpected "tIDENTIFIER, expecting keyword_end" at the @show_count line.

 

Edited by AeghtyAteKees
typo

Share this post


Link to post
Share on other sites

Ok, sorry about the first error message. I'm not sure what happened. I compared my version of the script with the one I linked, and there was some syntactical differences, although the version number is the same in both. I replaced my script and now it works fine. Shrug.

 

Thanks for your help! And the lesson in Ruby. :)

Share this post


Link to post
Share on other sites

If I may ask another question regarding this script (since we modified it to be adjustable in a way it wasn't originally intended to be), if I set the active time to a high number, starting at about 300, the time it takes the bar to load and the duration it is displayed seem to be out of sync. 100 frames loads pretty fast, so I don't think I'd ever set it lower than that, and the bar disappears right after it finishes loading. At about 300 frames the delay before disappearing becomes noticeable, and at 1000 or more the bar stays more than twice as long as it took to load.

 

The entire display time seem to be accurate to the frames I set the active time variable to. It's just that the loading time must be proportional or something, and it goes by too quickly if the variable is high.

 

Could you take a look and help me figure out why?

 

Thanks so much!

Share this post


Link to post
Share on other sites

Ok I think we are referring to the show count.

Line 234

make it like this

$game_variables[Galv_VarBar::ACTIVE_TIME] * 0.8

 

You can change the number lower or higher.

What this will do is set the amount of time to display the bar. * 0.8. My testing shows that 0.5 is way to fast and 1.0 is the same as it was.

Share this post


Link to post
Share on other sites

Got it!

 

So I believe I was actually referring to fill_rate, which is defined at like 317. There, I changed 0.5 to a higher number (0.95 actually), and it works a lot better.

 

Thanks again!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×