General RGSS/RGSS2/RGSS3 Help

Started by G_G, March 04, 2009, 12:14:28 am

Previous topic - Next topic

nathmatt

April 30, 2010, 10:02:59 am #460 Last Edit: April 30, 2010, 02:30:55 pm by nathmatt
no they are not the same push adds to an array as far as i know << is only used to refer to super classes such
as Window_Base

edit: did not know that i always use push
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


Blizzard

You're talking about <. << is an operator and when used on an array is does the same as push.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Valdred

Is it possible to get a class as a string? I mean the class with all it's code.
Example:

module Example

def this_is_some_code
#nothing
end
end

Now I need a method that gets just that as a string. like this:

#module Example

def this_is_some_code
#nothing
end
end"

You see? I need this because I want to read the RPG module. Is that possible?

ForeverZer0

QuoteYou see? I need this because I want to read the RPG module. Is that possible?


The Help Manual that comes with the game shows the RPG module and the modules included within it.
If you need a copy of the Help Manual, download Blizzard's Scripting Guide for Advanced and Intermediate, or whatever its called, something like that. There is a copy of it included in that.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

G_G

How do we access Mysql data through ruby? I'm willing to look through it in RMX-OS if someone can pinpoint me to where it does it.
Help is appreciated.

Ryex

May 14, 2010, 12:53:29 am #465 Last Edit: May 14, 2010, 12:55:13 am by Ryexander
well for one thing you need the mysql.so file and include it or what ever. also if you get SciTE then you can run searches of all of rmx'os code and see the code color coded for syntax ect. just in the search option make sure that *.rb is one of the extension patterns for the files to look through. SciTE makes coding ruby outside of rmxos a lot easier in general.
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Blizzard

Check out RMXOS.rb and Data/Server.rb. And possibly Data/Client.rb
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Valdred

How do I set what page of an event is currently running?

Hellfire Dragon

Quote from: Hellfire Dragon on June 05, 2010, 02:46:11 pm
Would there be a way to disable the player from using skills with certain elements unless a switch is on? So basically I need a way to check if the skill the player attempting to use is a certain element, then check if the switch is on, if it is, then continue with the skill.

Aqua

Quote from: Hellfire Dragon on June 06, 2010, 10:55:00 am
Quote from: Hellfire Dragon on June 05, 2010, 02:46:11 pm
Would there be a way to disable the player from using skills with certain elements unless a switch is on? So basically I need a way to check if the skill the player attempting to use is a certain element, then check if the switch is on, if it is, then continue with the skill.


I answered you! D:

G_G

I sent him a script, and it'll do what he wants.

Hellfire Dragon

Thanks G_G

Quote from: Aqua on June 06, 2010, 11:06:58 am
Quote from: Hellfire Dragon on June 06, 2010, 10:55:00 am
Quote from: Hellfire Dragon on June 05, 2010, 02:46:11 pm
Would there be a way to disable the player from using skills with certain elements unless a switch is on? So basically I need a way to check if the skill the player attempting to use is a certain element, then check if the switch is on, if it is, then continue with the skill.


I answered you! D:

QuoteThat's not related to Blizz-ABS.
This is very much possible.
Just mod the skill_can_use? method.


I have no idea how to do that, so I posted here :P

G_G

Got a math question. Made a sprite class. I'm trying to make it look in the direction of a point.
So an arrow for example. It'll always be looking towards the mouse. Something like that. I know its just some sort of equation but I'm pretty stumped.
Pretty much just get a direction out of two points.

Thanks in advance!

nathmatt

i could be wrong but wouldn't you just get the x and y if the x is lower that the x being checked face left face down if the y is higher ?
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


G_G

I'm not doing left, up, right, and down stuff. I'm using a whole 360 degrees.

nathmatt

Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


winkio

atan2 (also known as the circular inverse tangent) is the function you need.  Specifically, it's atan2(x, y).

http://en.wikipedia.org/wiki/Atan2

nathmatt

this also might help

Spoiler: ShowHide
#==============================================================================
# ** Map Target Pointer
#------------------------------------------------------------------------------
# by Fantasist
# Version: 1.0
# Date: 30-Jan-2009
#------------------------------------------------------------------------------
# Version History:
#
#   1.0 - First version
#------------------------------------------------------------------------------
# Description:
#
#     This script adds a pointer which points to a desired event on the map.
#------------------------------------------------------------------------------
# Compatibility:
#
#     Should be compatible with almost everything.
#------------------------------------------------------------------------------
# Instructions:
#
#     Place this script in a new slot below Scene_Debug and above main.
#   If you're using any input modules and the key you set is from that script,
#   plave this below that input script.
#
#   Use the following call script to set a target event:
#
#         $game_temp.point_towards(EVENT_ID)
#
#   where EVENT_ID is the ID of the event to which the pointer should point.
#
#   To remove the target, use:
#
#         $game_temp.point_towards
#                   or
#         $game_temp.point_towards(nil)
#------------------------------------------------------------------------------
# Configuration:
#
#     Scroll down a bit for configuration.
#
#  MTP_Pic: Name of the picture file in the "Graphics/Pictures" folder.
#           The pointer should point upwards.
#  MTP_Position: Position of the pointer.
#                 - If it is fixed, use an array of X and Y values
#                   (like this: [X, Y]) if the pointer is static.
#                 - Use nil for placing the pointer above the player.
#  MTP_Key: The key which should be pressed for the pointer to appear.#
#------------------------------------------------------------------------------
# Issues:
#
#     None that I know of.
#------------------------------------------------------------------------------
# Credits and Thanks:
#
#    - Fantasist for making this.
#    - Hellfire Dragon for requesting this.
#------------------------------------------------------------------------------
# Notes:
#
#   If you have any problems, suggestions or comments, you can find me at:
#
# - www.chaos-project.com
# - www.quantumcore.forumotion.com
#
#   Enjoy ^_^
#==============================================================================

#==============================================================================
# ** FTSConfig
#==============================================================================
module FTSConfig
 
  #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  # CONFIG BEGIN
  #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 
  MTP_Pic = 'Target_Pointer'
  MTP_Position = nil #[320, 240]
  MTP_Key = Input::A
 
  #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  # CONFIG END
  #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 
end
#==============================================================================
# ** Game_Temp
#==============================================================================
class Game_Temp
 
  attr_reader :point_target
 
  alias mtp_game_temp_init initialize
  def initialize
    mtp_game_temp_init
    @point_target = nil
  end
 
  def point_towards(val=nil)
    @point_target = val
    $scene.set_target(val) if $scene.is_a?(Scene_Map)
  end
 
end
#==============================================================================
# ** Spriteset_Map
#==============================================================================
class Spriteset_Map
 
  attr_reader :character_sprites
  attr_reader :pointer
 
  alias mtp_spriteset_map_init initialize
  def initialize
    mtp_spriteset_map_init
    @pointer = Pointer.new(self)
    @pointer.z = 5100
  end
 
  alias mtp_spriteset_map_upd update
  def update
    mtp_spriteset_map_upd
    @pointer.update if @pointer != nil
  end
 
  alias mtp_spriteset_map_disp dispose
  def dispose
    mtp_spriteset_map_disp
    @pointer.dispose
  end
 
end
#==============================================================================
# ** Pointer
#==============================================================================
class Pointer < Sprite
 
  attr_reader :target
  attr_accessor :spriteset
 
  def initialize(spriteset)
    super()
    self.visible = false
    self.spriteset = spriteset
    self.target = $game_temp.point_target
    self.bitmap = RPG::Cache.picture(FTSConfig::MTP_Pic)
    if FTSConfig::MTP_Position
      self.x, self.y = FTSConfig::MTP_Position[0], FTSConfig::MTP_Position[1]
    end
  end
 
  def update
    super
    self.visible = @target && Input.press?(FTSConfig::MTP_Key)
    return unless Input.press?(FTSConfig::MTP_Key)
    update_pointing if @target
  end
 
  def update_pointing
    y = ($game_player.screen_y - @target.screen_y).to_f
    x = (@target.screen_x - $game_player.screen_x).to_f
    rad = Math.atan2(y, x) - Math::PI/2
    self.angle = rad * 180 / Math::PI
    unless FTSConfig::MTP_Position
      self.x = $game_player.screen_x
      self.y = $game_player.screen_y - 64
    end
  end
 
  def get_sprite_char(event_id)
    return nil unless $scene.is_a?(Scene_Map)
    self.spriteset.character_sprites.each {|spr_char|
    return spr_char if spr_char.character.id == event_id}
    return nil
  end
 
  def target=(event_id)
    @target = nil if event_id == nil || event_id < 0
    @target = get_sprite_char(event_id)
    @target = @target.character unless @target == nil
    update_pointing if @target
    self.visible = false
  end
 
  def bitmap=(val)
    super(val)
    return if val == nil
    self.ox, self.oy = self.bitmap.width/2, self.bitmap.height/2
  end
 
end
#==============================================================================
# ** Scene_Map
#==============================================================================
class Scene_Map
 
  attr_reader :spriteset
 
  def set_target(event_id)
    @spriteset.pointer.target = event_id
  end
 
end
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


G_G

Not sure if this would go here, but I'm having a major problem with ruby right now. First theres a file called dir.tmp it reads from. Here's what it says.
C:/Users/Ronnie/Documents/RPGXP/Project1
C:/Users/Ronnie/Documents/RPGXP/Project2


Then I have this.
f = File.open('dir.tmp', 'r+')
  dir1 = f.readline# + "/Data"
  dir2 = f.readline# + "/Data"
  f.close
  puts dir1
  puts dir2
  contains = Dir.new(dir2).entries
  contains2 = Dir.new(dir1).entries


Now the puts dir1 and dir2 print out what it should. Now I get this error when I try to run the ruby app.
Invalid Argument - C:/Users/Ronnie/Documents/RPGXP/Project1

Its referring to dir1, it doesnt do it for dir2 however. I'll comment this line
containts2 = Dir.new(dir1).entries

And my app will continue on just fine.

Help please :S

Dragoon

Please forgive me if this seems like a silly question, but is it possible to script battle animation concurrency between the attacker and target, using the animation frames of both to decide the total length? I'm trying to figure out the degree of difficulty involved in re-scripting the battle animation updating to allow for this. Would it merely involve merging the update phases for them?