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

Method 1: It only creates the alias if there is no method that has the same name as the alias

Method 2: It only creates the alias if $@ is false

Not sure what $@ pertains too though, if it's something they made or a premade global in RM...

Anyway, the bottom line is that both of those basically just determine whether the alias should be made or not
$@ is the stack backtrace (an array) generated by the last exception.


I don't really know what that means in this context, and whether that line alone (the alias) is enough to determine what it contains.
Maybe it is to avoid making the alias when there is an exception? But then I wonder why...
I really am only guessing here, but I wonder if it's just trying to make the alias and if THAT generates an exception (because it's already defined) then don't worry about doing it.


In that case, they're really doing the same thing, but checking whether they should in a different way. The first is saying "make the alias if it doesn't already exist", and the second is saying "make the alias if there's no exception when you try (the alias already existing would trigger an exception)"


The second form would be easier to write and possibly faster to run (though you'd have to have many hundreds or thousands of them to have any impact, I think), but the first form is easier to understand, especially for non-pros (like me).


Someone will come along soon and explain it to us all (*cough* Zeriab?)
It was something that was done/needed when scripting in vx. The garbage collector is better in vxa so it is no longer needed. So in vx when you were playing the game and used f12 to reset it, then you would sometimes get some bad errors because not all the scripts were reloaded correctly... Or something along those lines. DP3 explained it in one of his video tutorials for rgss3. I just know its not required in vxa so I may be foggy on the details cause at the time of watching those.. I didn't always care for 100% clarity..just a better understanding of ruby.
Ace also gives errors on some scripts (including mine) if you use F12 to reset the game.
Thanks for clarifying the question. Here's another one:

In skills and actions, we can directly put the targets and all that stuff. So my question goes like this, what script should I put in order to perform a set of skills or just a skill that if I have 4 actors on Scene_Battle and I let Actor1 do that skill, instead of the other 2, 3 and 4's action to be processed, the whole actor's turn is used.

Basically what i want is how can I make a skill that makes my turn only once instead of having the other actors perform their actions too?
@vacis82, please do not make posts in other threads directing people to yours. They will see it when they look at new posts. Removed.
@milena - IMHO that's a question that already needs a new thread as it's looking for a particular kind of script, and it has been asked multiple times already. basically, you might be looking for a combo/unison script of sorts...
Hi, complete newb programmer here, trying to understand something about writing conditionals in ruby/ace...

If I want to write "If A is true, AND either B or C is true" how would I do that? 

I can't do "If A and B or C" because that sounds like in order for the condition to be met, both A and B have to be true, or merely C could be true. 

Can I just add parentheses, i.e. "If A and (B or C)" ...and this would give the logic I want? 

So I guess the larger question is, do mathematical orders of operation to apply to the logic of the language as well...Thank you in advance. 
@milena - IMHO that's a question that already needs a new thread as it's looking for a particular kind of script, and it has been asked multiple times already. basically, you might be looking for a combo/unison script of sorts...
No, I am not looking for a Unison script. What I was asking is a way to cancel other's turn by one actor's command. Basically, it doesn't execute any other turns but that actor's. It ignores the other actor's turn.
@jonthefox: the () will work to check if a is true and if either b or c. I've had to write logic that way a few times and use of the parentheses is great for easier to read code and preventing undesired results. Like order of operators, multiplying, division, modulars, etc.
Great, thank you so much!
@Milena - that is a start though. anyway, you better post a request thread for that since you're looking for a specific script.
Yes, anything that goes on for more than a page here no longer falls into the "does not deserve its own thread" category. By starting a new one you'll also ensure attention isn't diverted away from your request in the same topic.
I have no idea if others get this problem, but... for some reason the Cover ability is working oddly. Mass Debuff spells targetted at everyone are being blocked, so the defender gets two doses rather than one. This isn't supposed to happen.

I'm using Yanfly's engines. What could be causing this problem?
Please start a new thread in RGSSx Script Support for that issue. This thread is not for assistance with imported scripts. Also provide links to the scripts you're using - ANY that would affect this - it could be a combination of several scripts that's doing it.
I'm curious as why this is not working, It says it can't convert to Integer.

t = $game_party.target_actor$game_actors[t].class_id = 2This is in a common event. I was trying to put it into an item and have it change the class of the targeted actor. It seems right to me, but obviously not. I even tried to throw a .to_i in there but it won't do it.
Take a look at the definition of Game_Party#target_actor:

def target_actor    $game_actors[@target_actor_id] || members[0]  endAs you can see it already returns a GameActor instance and not a ID.

So you can just write (assuming GameActor#class_id= is defined):

Code:
$game_party.target_actor.class_id = 2
it is in $game_actors[n].class_id but not $game_party.target_actor

I printed $game_party.target_actor.methods

And I didn't see a way to actually CHANGE the class. there is :class but it doesn't seem you can really change anything in there, except a slight few.

EDIT:

Figured it out!

 For anyone curious:

$game_party.target_actor.change_class(integer, true/false)

EDIT: Idk if double posting allowed, though i doubt it so EDITED question

I've done think to a common event call on a change class item:

$game_party.target_actor.skills.each do |skill|id = $game_party.target_actor.skills[0].id$game_party.target_actor.forget_skill(id)end$game_party.target_actor.change_class(2, true)$game_party.target_actor.learn_skill(16)
That loop of course forgets all the skills that actor has learned... is there a more efficient way of doing it?

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