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

Galv's script call should do what you want.


And don't write extra 0's in front of a number that makes it an octal and not a decimal.
No, that's not the right syntax - Galv wrote it exactly as you should key it in.


If you're using a move route, then whatever character the move route is applied to (in your drop-down box at the top of the move route) is the character that the balloon will appear over. And the number on the right is what animation you want to show from that balloon sheet. So 1 will be the exclamation.


So, if you want to show an exclamation over the player, you'd do this:

Set Move Route (Player): Script: @balloon_id = 1
And if you want to show it over event 2, you'd do this:

Set Move Route (EV002): Script: @balloon_id = 1
Notice there's no change in the @balloon_id = 1 to say whether it's over the player or an event - it's the move route itself that determines it.
Thanks for the heads up, I wasn't aware that the script call was from one of Galvs scripts. I'm assuming its the Galv's Move Route Extras? I'll give it a shot.

Edit: Bleh I'm so out of it. Nevermind, I got it to work. Thanks guys!
Sorry, I should have been more specific. You don't require a script for that one - it will work by default. Glad you worked it out, though
Got an RPG XP qustion! Not sure if it's been answered elsewhere; I've tried looking for an answer, but haven't seen anything.

Anyway, it has to do with Window_Message, i.e. the text box that appears when you have someone talking, or a message appearing, etc. There's a bit of a gap between the bottom of the box and the bottom of the screen, about 16 pixels or so. Despite my best efforts, I can't get the darn thing to sit along the very bottom of the screen, even after altering Window_Message itself to SPECIFICALLY TELL IT to move down.

I've seen other games pull it off. Am I missing something?
There's a bit of a gap between the bottom of the box and the bottom of the screen, about 16 pixels or so.
Uh... 🤔 Nope. There is not even a single pixel. The border in the defult system graphic is 6 pixel, not even close to 16 and it's the border anyway, so it's not an actual gap.
Maybe it's some script you're using?


---


My question


How do you debug a situation where the game "halts" in the menu giving no errors? Excluding loosing hours trying to guess the cause of the bug.
What do you mean, "halts" in the menu? I'm guessing you've added your own functions and you're doing some kind of update loop inside them, rather than relying on the way windows are updated by default, and you don't have a way to exit the loop (or you haven't added a 'cancel' response)
What do you mean, "halts" in the menu?
I mean that the window (which is a selectable one) doesn't move its cursor (the cursor doesn't even blink) and doesn't answer to inputs (I've set the handlers). Maye "freezes" was a better verb.
I'm guessing you've added your own functions
Yes, I'm trying to create a custom menu command using various references (looking at other scripts).
I and you're doing some kind of update loop inside them, rather than relying on the way windows are updated by default
No.

Among various things I tried, I tried to aliasing the update method putting a messagebox inside and the message does appear, so it seems that the scene is not actually frozen, but still the cursor does not blink. Yes I did ".activate".


My actual question is: is there any debug method I could use excluding guessing and msgbox-style debugging? Because I already lost more than two hours on this and I feel I'll never find the cause of the "freezing".
Uh... 🤔 Nope. There is not even a single pixel. The border in the defult system graphic is 6 pixel, not even close to 16 and it's the border anyway, so it's not an actual gap.

Maybe it's some script you're using?
I'm not talking about a gap within the window, I mean the gap between the window itself and the edge of the screen. Like this:

View attachment 4422

Even a default project, with zero modification, has it. So it's not a script I'm using.

View attachment 4423

I want the edge of the window to be touching the bottom of the screen. I've SEEN other games do it, so I know it's possible.
255, there is no 'debug' facility, other than just putting print statements into your code and testing with the console open to see what's happening. There's no way to 'step through' the code.


If you can't figure it out yourself and you don't want to spend more hours trying, I suggest you start a new thread and post your scripts so we can take a look. Be sure to wrap your code in code tags to preserve formatting (makes it so much easier to read), and if it's very long, maybe put all of that inside spoiler tags too. Without actually seeing the code, we'd just be guessing at what's wrong.
Unresponsive windows are usually due to not activating a window somewhere.
@Allerka


Oh, I now see that you use RMXP, so I cannot help. In VX Ace the window is already on the bottom.


@Shaz:


I see, thanks.


@Tsukihime


Thanks to your suggestion, today, with fresh mind, I've guessed and confirmed that I wrote ".active" instead of ".activate". =__='


That's bad luck, because "active" actually exists, it's a boolean and so it wasn't giving me an error. Otherwise it would've been easier to find the bug.
Here are two things I'm curious about (since I may want to modify the first, and definitely the latter).

Where exactly is the code that states how much TP is generated from taking damage, and where is the code that says how much TP actors start battles with? The latter in particular I want to eliminate for those classes that don't use TP at all.
in class

Game_Battler

or 

Game_BattlerBase 

Ctrl + F and you can search for tp 

(cant remember which one but its in one of those classes 😛 )
How would you capture an array out of a string with a regular expression?


I want:


"<key 1 2 3 4 5>" to result in [1, 2, 3, 4, 5]


"<key 1 2 3>" to result in [1, 2, 3]


Everything after the key will always be digits (could be multiple digits, like 10, 11, etc), but there could be any number of them.
How would you capture an array out of a string with a regular expression?

I want:

"<key 1 2 3 4 5>" to result in [1, 2, 3, 4, 5]

"<key 1 2 3>" to result in [1, 2, 3]

Everything after the key will always be digits (could be multiple digits, like 10, 11, etc), but there could be any number of them.
Maybe this would help:

Code:
def blah(string)  string =~ /<key (.*)>/i  return $1.scan(/\d+/).collect { |i| i.to_i }end
That did it. Thank you 🙂 Pity there isn't a way to do it all in a single line.
That did it. Thank you 🙂 Pity there isn't a way to do it all in a single line.
Single line:

Code:
def blah(string)  /<key (.*)>/i.match(string)[1].scan(/\d+/).collect {|i| i.to_i}end
awww, just beautiful 😀


Thank you again 🙂
Quick question.

I'm using input numbers for an ATM machine event.

I have ones for entering PIN codes (different PIN codes as quest rewards etc) and an input number for withdrawing and depositing cash.

Whenever using the 'Input Number' event, the number I input stays the same, (for this example 6266) even after coming back to the event the number stays the same.

So is there a way to 'reset' the input number event to just 0's?

Thanks for any and all help.

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