Ruby/RGSSx questions that don't deserve their own thread

The cursor's 'blink' CANNOT be turned off without editing the default Window class. Its a HUGE pain the ass:/

Anyway.. I wrote a 'weather' script that uses images for the weather particles.

Within this script, I have a method to determine how many particles to show, ie, to determine the weathers 'power'

It looks like this...

  #-----------------------------------------------------------------------------  #  #-----------------------------------------------------------------------------  def particle_count(particle)    (@module::Type[particle]['amnt'] * $weather.current_power)  end@module::Type[particle]['amnt'] is currently set at 20.

This works 100% fine.

I was mostly wondering if anyone had a better formula for determining the amount of particles shown (the weather's power) as currently, it is simply a multiplication from the 'base' number :/

Edit:

I am mainly looking for other variables I could add to the calculation for determining the power value...
What is rgss30x.dll??

I found some cool looking script that was made around 2012, and it requires rgss30x.dll to run apparently.

I believe that rgss300.dll is the normal file. And I thought I've seen rgss301.dll at some point...

I can't find it, and Google searching only brings up script threads that say you need rgss30x.dll. And searching various RPG Maker forums has brought me no results either.
normally, x is used to denote any number... have you actually run the script and it specifically tells you that it needs a file named rgss30x.dll? if yes, then probably it's a custom dll based on rgss300. else it might simply mean that it needs any version of the rgss3 dll, so like rgss300, rgss301 and so on if there will be more
normally, x is used to denote any number... have you actually run the script and it specifically tells you that it needs a file named rgss30x.dll? if yes, then probably it's a custom dll based on rgss300. else it might simply mean that it needs any version of the rgss3 dll, so like rgss300, rgss301 and so on if there will be more
It worked! Thanks a bunch!

It was confusing because the projects I started myself had rgss301, while I had to get rgss300 from a demo. That's all I had to do, get the other rgss30x file.

Then I had a problem with the script itself, but the script call just needed quotation marks around part of it.

Glad that's resolved. Thanks again.
I want to truncate a game variable.

This must be simple, but I'm failing. I use "Control Variables" to multiply a variable by a percent, which I'd like to convert to an integer. I don't see a way to do this via the engine, and whatever I try to do to "$game_variables[8]" either has no effect or returns an error. I could post the script, but it's little more than a guess. Any method that gives me an integer is fine.
($game_variables[8]*value).to_i
Thank you, but that seems to create a new object - when I call the variable in a text box later (\V[8]) it's unchanged. I would like to either:

1) Replace the game variable with a truncated version

2) Show the truncated version in the text box

Either would be fine, since it won't make much difference.
oh wait...


change * to *=


if shows an untruncated one after this


use this:


($game_variables[8]*=value)


$game_variables[8]=$game_variables[8].to_i
The second one worked perfectly, thanks!

That's enough for me to figure the rest out. I applied this to the rest of the game and I think it all runs smoothly now. If anyone is viewing this answer later via Google, be advised that for larger variable numbers your lines will be cut off midway. The text wrapping will give you this:

($game_variables[10]*=1.0125)
$game_variables[10]=$game_variables
[10].to_i

But you can't split up the function, so use this:

($game_variables[10]*=1.0125)
$game_variables[10]=

$game_variables[10].to_i
Only if you're doing it in a script box in an older version of the engine.


You can put it into the Control Variables event command:

Code:
Control Variables [0010: MyVar] = Script: ($game_variables[10]*1.0125).to_i
You can also use a shorter named local variable

temp = $game_variables[10]temp *= 1.0125$game_variables[10] = temp
A better name is preferable, but for copy-and-paste this makes do.

*hugs*
Will that give an integer as a result?
no I dont think it would. Variables can store any information / integers / floats / text within it. you would still have to use a .to_i (or similar) function.
It's also a good habit to use 'terse' code when appropriate, or at least be able to.

Shaz' one line script is preferable here, style wise, especially in Ruby.

That sort of thing will also help you start to think in an Object Oriented way, which will pay loads of dividends down the line. Whatever you have in the parentheses returns a value -> that value is an object (a floating point number, in this case) -> you can call .to_i on any Numeric object.

You can also think of it as a compound function call if you want to think procedurally. Either way it helps.
The example provided by Shaz is absolutely preferable in this case. Sorry for not making it clear.

I showed a workaround of a technical limitation in the editor (Script box size). This adds complexity, as workarounds usually do. Using the control variable event command communicates the effect much better than a script call could.

Will that give an integer as a result?
Nope missed the integer conversion. -_-

Wonder what will happen if you use \v[10] in that case.

*hugs*
Everything works now, but if you guys want to discuss technique, I'm sure it will do me some good.

Only if you're doing it in a script box in an older version of the engine.

You can put it into the Control Variables event command:

Control Variables [0010: MyVar] = Script: ($game_variables[10]*1.0125).to_i
I didn't realize my version was that old, but so it is. Anyway, your method works and is obviously more elegant. I think I disregarded that box back when I was using the wrong function.

It's also a good habit to use 'terse' code when appropriate, or at least be able to.

Shaz' one line script is preferable here, style wise, especially in Ruby.

That sort of thing will also help you start to think in an Object Oriented way, which will pay loads of dividends down the line. Whatever you have in the parentheses returns a value -> that value is an object (a floating point number, in this case) -> you can call .to_i on any Numeric object.

You can also think of it as a compound function call if you want to think procedurally. Either way it helps.
I've already set up most of the game using the clumsier method, but lessons learned and all that.

Speaking of terse code, I have another question. It's not essential, since what I have works, but what I have is ugly. Basically, my game involves a semi-complicated kingdom management system, and all the values change during this Common Event. I also need to calculate total expenses and total income for various reasons, but right now what I'm doing is just:

x = x + y + z (etc)

Since there are a lot of variables, it becomes an ugly block of code. I assume there's a better way to do it, but I don't know Ruby.

The example provided by Shaz is absolutely preferable in this case. Sorry for not making it clear.

I showed a workaround of a technical limitation in the editor (Script box size). This adds complexity, as workarounds usually do. Using the control variable event command communicates the effect much better than a script call could.

Nope missed the integer conversion. -_-

Wonder what will happen if you use \v[10] in that case.

*hugs*
Tried it out, and it looks like \v[10] gives the right number (except for the integer thing). Same effect as you get using the Control Variables multiply option, so I think .to_i is the only non-destructive function. I suspect what was tripping me up before was the short text window, since I think "$game_variables[10] = $game_variables[10].to_i" should have worked in theory.
I have an RGSS3 question.

Is there any way to change the types of equipment slots without using an imported script?

Say I wanted the equip menu to show one weapon slot and four accessory slots. Where would I go to change this? I'm assuming it's controlled by Window_EquipSlot, but I can't figure out what needs to be changed there.
You can opt not to import another script, but rather edit the default script...


Find the equip slot initialization, probably it's on the actor class
Ah, found it. It was indeed under Game_Actor.

Thanks!
[XP]

I'm working on a skill tree system using events (the RMXP scrips I've found so far haven't made the cut unfortunately) and I was brainstorming the potential roadblocks I might run into (which are many!).

I'm planning on having the Skill tab in the menu send you to the skill tree instead of the regular skill window, so my biggest concern at the moment is skills that can be used from the menu (healing, reviving, etc.). With no regular skill window, I won't have a way to use these menu-usable skills very easily.

The question! You know when you click on a healing skill how it brings up the little party member selection window on the right? I was wondering if there is a script call I can use to bring that up on command from the map? I would need to be able to specify what skill is being used of course, but besides that, it would just carry on as if I was using it from the menu.

Is this possible, or am I going to need a script made to allow for such event calls?

Thanks in advance! 🙂

Original thread: https://forums.rpgmakerweb.com/threads/ruby-rgssx-questions-that-dont-deserve-their-own-thread.150/