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

SoulPour777

Crownless King
Veteran
Joined
Aug 15, 2012
Messages
1,093
Reaction score
104
First Language
English
Primarily Uses
N/A
Okay, thanks for this. its a big help.  BD
 

djDarkX

Retro & Remastered Music Guru
Veteran
Joined
Jan 17, 2013
Messages
2,698
Reaction score
1,894
First Language
Music
Primarily Uses
RMMV
Okay now I've looked this up, but can't seem to find anything on this, or perhaps I'm just not looking hard enough?

Anyway, I'm trying to re-position Battle Status gauges.  I've checked Window_BattleStatus and I get the basic understanding of it, however when I check other scripts, this kinda flys over my head.  First off, how is x,y of a gauge determined (or better way to put it, how is it read to be positioned in a certain place), along with width and height?

To better help me through this, I'm using Yanfly's Battle script with Syvkal's Menu Bars.  The way the gauges are showing in battle is totally wrong and I'd like to fix them.  I'm not looking for someone to do it for me, I'd like some direction on what to look for and how this is all determined and figured out so I can make a mini-script, I suppose.

Script links:

http://yanflychannel.wordpress.com/rmvxa/battle-scripts/ace-battle-engine/

http://forums.rpgmakerweb.com/index.php?/topic/840-syvkals-menu-bars-vxace/

Anyway, thanks for any insight I can get on this.  I'm learning Ruby (slowly) by actually looking at scripts and determining what everything does and how it's all linked together, not just user scripts, but also plain RGSS3 and looking at the manual.
 

Lowell

The Walking Atelier
Veteran
Joined
Apr 21, 2012
Messages
292
Reaction score
69
First Language
English
Primarily Uses
Looking for a way to add additional weapon type requirements to a skill.

I assumed that I could use wtype_equipped?(x) to define more but I got an error in battle when I did this.

The code block below comes from Game_Actor

Code:
  def skill_wtype_ok?(skill)    wtype_id1 = skill.required_wtype_id1    wtype_id2 = skill.required_wtype_id2    return true if wtype_id1 == 0 && wtype_id2 == 0    return true if wtype_id1 > 0 && wtype_equipped?(wtype_id1)    return true if wtype_id2 > 0 && wtype_equipped?(wtype_id2)    return false  end
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,966
Reaction score
13,602
First Language
English
Primarily Uses
RMMV
What was the code you used, and what error did you get?
 

Lowell

The Walking Atelier
Veteran
Joined
Apr 21, 2012
Messages
292
Reaction score
69
First Language
English
Primarily Uses
I was using Yanfly's Skill Restriction script that has a section for small script snippets

<restrict eval>

wtype_equipped?(2)

</restrict eval>

The error was...

Script 'Skill Restrictions YF' line 762: NoMethodError occurred.

undefined method `wtype_equipped?' for #<Game_Enemy:0x8ce1b7c>

 

Going on a limb here but I'm assuming I need more than that small snippet to pull out the proper method to restrict weapon types this way.
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,966
Reaction score
13,602
First Language
English
Primarily Uses
RMMV
Game enemies don't have weapons.
 

ShinGamix

DS Style 4Ever!
Veteran
Joined
Mar 18, 2012
Messages
3,905
Reaction score
450
First Language
April Fools
Primarily Uses
N/A
say I add a script and get an error 



which is the line for script eval.

Does that mean it's having problems reading a script or what? Could someone please explain some for me.

#Note

I am trying to add MogHunter's BattleBack_Ex to my Modified Symphony Engine for reference.
 
Last edited by a moderator:

Zalerinian

Jack of all Errors
Veteran
Joined
Dec 17, 2012
Messages
4,696
Reaction score
934
First Language
English
Primarily Uses
N/A
The line number just means it crashed inside a script box within an event. Those are run in an eval on line 1411, so that's where the error happens. It doesn't tell you where specifically in the calls it broke, just at the root of it. If you want it to give you a line number for your error, then you'll probably have to call it through a script from the script editor. As in, make a script in the editor that calls what's in the script box. For exameple:

module Input if trigger?:)Z) ~scriptbox contents go here~ endendThat should work better for you and give you an actual error with a line number.

What the error means, though, is that whatever object is calling '.clear'(probably a bitmap, that will clear anything off of it) isn't assigned. It's nil, ruby's 'nothing' variable. If something is nil, it doesn't exist. The scripts are trying to call 'clear' on something that doesn't exist, so it can't do that. It gives you an error about trying.
 

ShinGamix

DS Style 4Ever!
Veteran
Joined
Mar 18, 2012
Messages
3,905
Reaction score
450
First Language
April Fools
Primarily Uses
N/A
So where do I put that in at? Do i put the script i need to test in the script box area??

edit- So I found two lines that read

$game_system.bb2.clear 

that is the only place clear is used. Would clear need to be deined?
 
Last edited by a moderator:

Lowell

The Walking Atelier
Veteran
Joined
Apr 21, 2012
Messages
292
Reaction score
69
First Language
English
Primarily Uses
Trying to set the Initial MP of all actors to a variable set in <initial mp: x> but it crashes in battle due to...

Note: The RegExp works fine, I'm guessing I don't have the latter half of the script written up right

---------------------------

Script 'Initial MP' line 20: NoMethodError occurred.

 

undefined method `*' for nil:NilClass

---------------------------

 

Code:
module RPG  class Actor < BaseItem    def initial_mp      return @initial_mp unless @initial_mp.nil?      get_initial_mp      return @initial_mp    end        def get_initial_mp      regex_initial_mp = /<initial[-_ ]?mp:\s*(\d+)\s*>/i      #Default Initial MP should be 28%      @initial_mp = self.note =~ regex_initial_mp ? $1.downcase : "28"     end  end  endclass Game_Battler < Game_BattlerBase  #  def init_mp    self.mp = self.mmp * (@initial_mp * 0.01)  end  #  alias_method :mp_battle_start, :on_battle_start  def on_battle_start    for actor in $game_party.members      #Take the actors MP and sets it to x * Max MP      #where x is <initial mp: x> * 0.01      self.mp = init_mp    end  endend
 
Last edited by a moderator:

ShinGamix

DS Style 4Ever!
Veteran
Joined
Mar 18, 2012
Messages
3,905
Reaction score
450
First Language
April Fools
Primarily Uses
N/A
I got it to work!!! The clear was errored out due to the fact that the note tags were using 

bb1(nil)bb2(1,0,10)$game_system.transition_ex = 1as the opening for the script call transition to the battleback_ex effects

I changed it to 

bb1(0,0,0)bb2(1,0,10)$game_system.transition_ex = 1to use zero values for the variables instead of the nil.

(I was using MogHunters Battleback_Ex 1.3 and his Battle Transitions Scripts for future members who use these scripts and encounter a similar issue)

damn I just ran into the 

undefined method `*' for nil:NilClasserror.

Thought that was the multiply symbol??
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,966
Reaction score
13,602
First Language
English
Primarily Uses
RMMV
Trying to set the Initial MP of all actors to a variable set in <initial mp: x> but it crashes in battle due to...

Note: The RegExp works fine, I'm guessing I don't have the latter half of the script written up right

---------------------------

Script 'Initial MP' line 20: NoMethodError occurred.

undefined method `*' for nil:NilClass

---------------------------

module RPG class Actor < BaseItem def initial_mp return @initial_mp unless @initial_mp.nil? get_initial_mp return @initial_mp end def get_initial_mp regex_initial_mp = /<initial[-_ ]?mp:\s*(\d+)\s*>/i #Default Initial MP should be 28% @initial_mp = self.note =~ regex_initial_mp ? $1.downcase : "28" end end endclass Game_Battler < Game_BattlerBase # def init_mp self.mp = self.mmp * (@initial_mp * 0.01) end # alias_method :mp_battle_start, :on_battle_start def on_battle_start for actor in $game_party.members #Take the actors MP and sets it to x * Max MP #where x is <initial mp: x> * 0.01 self.mp = init_mp end endend
initial_mp is a method, not a variable, so you should use initial_mp, not @initial_mp. I would also question where you should just use @mmp instead of self.mmp
 

ShinGamix

DS Style 4Ever!
Veteran
Joined
Mar 18, 2012
Messages
3,905
Reaction score
450
First Language
April Fools
Primarily Uses
N/A
What the heck is a type error?

 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,966
Reaction score
13,602
First Language
English
Primarily Uses
RMMV
A type error means you're trying to do something with two operands that are of a different type. One of them is an integer, and the other is nil. Since it's nil, the problem probably occurred a bit further back - either the method is being called at the wrong time, or whatever the non-integer operand is, it's not being initialized properly.


May I suggest, since you seem to be having so many problems with these scripts, that you actually start a thread to request help to get the script working?
 

Elegnaim

Warper
Member
Joined
Aug 12, 2013
Messages
2
Reaction score
0
First Language
English
Primarily Uses
I have two events with an Autorun trigger, and both have their conditions met for starting. Both Events do the same thing: Print out a unique message ("Message 1" and "Message 2"), and nothing else.

What I'm currently seeing is that the first Autorun event to execute loops forever.

How could I set the Events up so that the first autorun event yields to the next one after completion, which in turn yields back to the first, and so on?

I grafted the following functions onto Game_Interpreter and Game_Event, and it's doing what I wanted, but I don't think this is the best approach. More questions after the code.

class Game_Interpreter def run wait_for_message while @list[@index] do execute_command @index += 1 end Fiber.yield @fiber = nil get_character(@event_id).yield_event_trigger_auto endendclass Game_Event def yield_event_trigger_auto clear_starting_flag if @trigger == 3 endendSo right, forcing the starting property off in the Interpreter is causing the behavior that I want; however, I've only had this since Thursday and I'm not really sure how the update loop is structured. I'm under the impression that the Game_map object is what ultimately loops through its event lists and causes them to execute, and it looks like it does this by associating them with its internal Interpreter object and then running THAT. 

If this is the case, the process used for grabbing events that need run should be setting the starting flag to off after it feeds them to the Interpreter, so my modification shouldn't be necessary (unless Autorun events have their starting flag set to ON somewhere else, or preempting the event selection process in Game_map).
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,966
Reaction score
13,602
First Language
English
Primarily Uses
RMMV
This is not a Ruby/RGSSx question. Please post your question in the appropriate forum.


They are doing exactly what they're meant to be doing. Read the latest blog article on setting up cutscenes (which is what you're doing).
 

Elegnaim

Warper
Member
Joined
Aug 12, 2013
Messages
2
Reaction score
0
First Language
English
Primarily Uses
Sorry, I didn't ask that clearly. I'm not asking about how Autorun events work, I was asking about whether the Interpreter class was the appropriate class to modify if I wanted to alter the default Autorun event processing, or if I wanted to change something in either the Game_map or Game_event classes (and, by extension, why calling clear_starting_flag from the interpreter causes the Autorun event to yield execution, while calling it from Game_map does not). 
 
Last edited by a moderator:

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,562
Reaction score
3,832
First Language
English
How an event should run should be determined by the event itself. The interpreter simply executes instructions.
 

Zane

Food for thought
Veteran
Joined
Jun 9, 2013
Messages
913
Reaction score
110
First Language
US English
Primarily Uses
How can I split the actors  and the commands into there own separate windows in the window_battlestatus?

Examples:

Go from this:

to this

You can ignore the details and everything else 

I just mean the concept of splitting the windows up

where each actor has its own window

and each command has its own window

I have no clue where I would post this I didnt think it deserved its own thread though. 

If anyone would be kind enough to help that would be great!

p.s a semi - newbie

I can write out the values and all for the text and faces but again how do I turn the dbs

into its own windows for everything.

sorry for repeating my question 3 times

Thanks for reading this and/or responding! :)
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,966
Reaction score
13,602
First Language
English
Primarily Uses
RMMV
This question does not belong here - it's an entire rewrite of several scripts, not a "question that does not deserve its own thread". You have also asked this question elsewhere. Please do not post the same question in multiple locations. Thank you.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 2)

Latest Threads

Latest Posts

Latest Profile Posts

I'm back from my visit to my family. Was really great to see them again after a year even if I had to get tested for covid for the visit.
Sometimes... I do absolutely genius things... But then I counteract that by spending all day trying to figure out what's wrong with my event creator... Only to learn I commented out some lines in MV... Not even in my plugin. This must be why villains "true heroes" don't win in the end. :kaoswt:
Procrastination at it's finest.
annnnd after 2 days lol... and I still feel I need to work out a few kinks

Forum statistics

Threads
104,260
Messages
1,005,055
Members
135,772
Latest member
changefly
Top