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

@Seerfree The global variables default to 0, you're checking for nil.
Hello friends; is there a simple way to change the alignment of the help window text for one scene in a script?
The default help window uses draw_text_ex to display the text, and that method got no alignment options at all, so no, there isn't (simple way, I mean).
In case it's a custom help window from a custom script, you should open a separate topic for it, I guess.
Ninja'd by Sixth, but eh

If you're asking how to put a conditional for one scene, it should be as easy as just use if SceneManager.scene_is?(Scene_Name)
But if you're asking on how to do alignment, I'm afraid it won't be as easy since it uses draw_text_ex as Sixth mentioned.

The way you asked though, it feels like you already know how to do the alignment text for help_window
Thanks guys. No, not too sure how to do the alignment text for the help_window at all, not even in a long, convoluted way. Oh well! It's no biggie.
Is this to have the text show up in the middle of the screen or something?
I just tried using yanfly's message code \px[xxx] to position text at a different spot for a weapon and in the store it moved the text over.
so I don't know if this is what you want. I'm just guessing.
Hello - I was looking at a really clean note tag guide and I think I'm starting to understand how it works/ or its a bit less intimidating to attempt now, but I'm kind of at a loss how you'd get a note tag from an actor - and use it in a conditional statement or in a damage formula, and was wondering if anyone here knew how to call it out.

In general what I'm looking for is how you'd actually write something like: If $game_actors[x].notetag = "text" then do something.
You could try:
Code:
$game_actors[id].actor.note =~ /your regex here/i
If you need a specific data from that note-tag (get that data from the regex you use).
Or if you just need to check if something is present in a note-box or not without any extra data from your note-tag:
Code:
$game_actors[id].actor.note.include?("your note-tag here")
Ok - that worked perfectly. And it even works in damage formulas which might let me knock off a few variables off the table. Thanks!
If I create a window in a scene, can I then hide said window in a script call from the editor?

For example, in Scene_Map, you create a new window: @instance_var = Custom_Window.new and then @instance_var.show.
If I make a script call (e.g. @instance_var.hide or Scene_Map.instance_var.hide), it tells me that the method 'hide' is undefined or that the method 'instance_var' is undefined.
You would use SceneManager.scene for the script call. And you need to get access to the window
Code:
class Scene_Map
  attr_reader :window_name
end
And the script call gonna be like
Code:
SceneManager.scene.window_name.hide
It's not a good practice though, since if you move to other scene, it will reset. Means if you use the script call to hide the window which was originally being shown, if you go to menu scene, and back to map, your custom window will be shown again
@TheoAllen that works, thanks. It's not resetting when I open other scenes, etc., because I'm also resetting what made the window show in the first place. Is that okay?
As long as it works for you, should be okay 🙂
Been experimenting with other ways applying states using functions - so if I had to make any changes I could just edit the state call in the function.

When the function itself is just:
Spoiler
def poison(a,b)
b.add_state("poison-id")
end
It works fine, target gets poisoned.

However, I've been trying to do a check involving a random poison check - so it's not always an 100% thing. And it just always returns no damage when I try it.

The formula looks like this so far - though I will probably add a def poison_immunity that just bypasses this:
Spoiler
def poison(a,b)

def poison_hit;rand(100);end;
def poison_dodge;rand(100);end;

if poison_hit < 90 #place holder to be replaced by a poison chance variable.
if poison_dodge < 100 #place holder to be replaced by poison_resist(b) check funct.
b.add_state(41);
end
end

end;

Anyone know what could be causing the damage to fail?
The keyword 'def' is to define a function/method. I don't think you can define a function inside a function in Ruby.
You might want to change it to something like
Code:
def poison(a,b)

poison_hit = rand(100)
poison_dodge = rand(100)

if poison_hit < 90 && poison_dodge < 100
b.add_state(41)
end

end
@TheoAllen Well, maybe that was the problem. It seems to work great now!

Though I'm unsure if functions don't work within functions because my damage multipliers - are pretty much functions being added to functions, but then again those functions just register numbers using if statements so maybe that's okay with the system?

Though I am honestly glad I don't need to make functions to set up variables I'm not going to use anywhere else though - could have sworn I tried it before in a few functions and got undefined error messages, but they seem to work fine now.

Thanks again!
I'm playing around with Rpg maker vx ace lite before i buy the full version so i can't edit scripts. However, i was wondering if it was possible to equip two weapons at once with Falcao Pearl ABS Liquid V3. I've created a character that has a bow but found that ranged weapons are to overpowered. In order to negate that, i've decided to limit the player's amount of arrows and give them the second option of using a close ranged melee weapon when they run out of arrows. (which should happen frequently) The only problem is a player can only have one weapon equipped at a time which means the player would have to switch weapons in the middle of the battle and that seems like a really annoying hassle. Apologies for the question length. I'm just hoping someone has a simple non-script editing solution...
Thanks so much in advance 🙂
@Openworld This is the wrong place to ask this question. Please post in the thread for that script. Weapon swapping cannot be done without a script, so your "simple non-script editing solution" is not available.
@Openworld This is the wrong place to ask this question. Please post in the thread for that script. Weapon swapping cannot be done without a script, so your "simple non-script editing solution" is not available.
okay sorry
[ACE] Sorry for asking here again, but I've been trying to find a way to get the hp_rate of enemies individually. But I've having trouble referencing certain enemies in the way I need. Not trying to get the enemy index info - but something along the lines of "this is the first enemy put in the troop, so it's id is 1" kind of thing?

I noticed that the conditional branch has an option for 8 enemies it can check for various things - so I feel like there is a way to reference this, but everything I've found online seems to be about getting info on the enemy in the troop, rather then its "battle number".

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