Chaos Project

RPG Maker => RPG Maker Scripts => Topic started by: G_G on March 04, 2009, 07:14:28 AM

Title: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on March 04, 2009, 07:14:28 AM
General RGSS/RGSS2 Help



Introduction

Here is a general RGSS/RGSS2/RGSS3 Help Topic. You're welcome to ask any question about either scripting language to help you be a scripter.

Instructions

First search the topic for your question.  It might have already been answered, so please search first.

Notes

If we don't answer right away, just wait a day or two then bump it.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Landith on March 04, 2009, 07:19:44 AM
Maybe have an if branch to see if the player is pressing left, right, up, or down then refresh the window to prevent lag? I would check out Ccoa's HUD tutorial on rpgrevolution, it has a solution to this. Don't have a link at the present time because I'm on my phone, I might be able to get one in a little bit though
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Fantasist on March 04, 2009, 02:06:39 PM
How's your update method like? Could you post it?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on March 04, 2009, 04:34:27 PM
(click to show/hide)

(click to show/hide)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Fantasist on March 04, 2009, 04:41:25 PM
OK. In Scene_Map#update, here's how you're updating the coordinate window:

Code: [Select]
if @coordinate.visible == true
      update_coordinate
    end

But update_coordinate is not defined. Besides, if you want to update the coordinate window, you should use:

Code: [Select]
@coordinate.update

That will call the update method in Window_Coordinate IF that method is defined in Window_Coordinate, which is not. You only defined initialize and refresh. Make an update method and check if the player's X and Y coordinates have changed. If they have, call refresh. Do all of this in Window_Coordinate#update. Then all you have to do in Scene_Map#update is:

Code: [Select]
if @coordinate.visible == true
  @coordinate.update
end
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on March 04, 2009, 04:50:26 PM
Code: [Select]
    if @coordinate.visible
      update_coordinate
    end

Optimized. :P
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: fugibo on March 04, 2009, 06:41:34 PM
Ha. Both of ya is wrong.

Code: [Select]
@coordinate.update if @coordinate.visible
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on March 04, 2009, 06:51:23 PM
HAHA! YOU FELL RIGHT INTO MY TRAP!

Code: [Select]
@coordinate.update if @coordinate.visible && @coordinate.active

Also, it being in one line instead of 3 doesn't change the performance.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on March 05, 2009, 01:11:46 AM
It still doesnt work. I used
Code: [Select]
@coordinate.update if @coordinate.visible && @coordinate.activeAnd still no luck. Also I added this under @coordinate = Window_Coordinate.new
Code: [Select]
def initialize
  @coordinate = Window_Coordinate.new
  @coordiante.visible = true
  @coordinate.active = true
end

Still no luck. Its not updating at all.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Tazero on March 05, 2009, 01:32:39 AM
Should 2 &'s be there?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: fugibo on March 05, 2009, 01:35:37 AM
Yes; one ampersand is a bitwise operator. Two ampersands is the same as using the keyword "and," but since there is a bug with that that Blizz found a year or two ago, we always use "&&" here if possible.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on March 05, 2009, 01:41:18 AM
Okay I realized that I totally forgot something. In Window_Coordinate I didn't add a def update in it so it wasnt really updating the window. So its all figured out and done!!! Still need to know this

One more question is it possible to display a picture in the window? Like normally i've been using
Code: [Select]
RPG::Cache.picture("") But that displays a picture in the whole scene and I just want it in a window if possible.

Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: fugibo on March 05, 2009, 04:37:36 AM
What folder is the picture in?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on March 05, 2009, 04:46:31 AM
What? I'm not having problems display pictures.

I want to display a picture in the window without having to set x and y coordinates and RPG::Cache.picture("")
Like is there a line of code I can add in a window that displays a picture in the window?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: winkio on March 05, 2009, 05:21:21 AM
you are confusing people because you have no idea what you are talking about.

RPG::Cache.picture("filename.png") get the image of the filename.

Then, you have to either set it to a background or display it some other way.

HOW do you want it in the window?  As a background?  or just inside its bounds?  either way, it should be pretty obvious...
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: fugibo on March 05, 2009, 05:22:25 AM
I think you'd need this:
Code: [Select]
window.contents = Bitmap.new(path_to_file)

OR

Code: [Select]
window.contents = RPG::Cache.<pick_ur_method>(filename)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on March 05, 2009, 05:49:37 AM
Thanks WcW yea I had no idea what I was talking about. I had it prefectly said right in my head but hey we all think differently right?

EDIT: Wait I tried both methods, then it jsut displays the picture for like half a second then dissappears, then it shows two arrows, one pointing down, and one points right.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: fugibo on March 05, 2009, 03:15:35 PM
Oh, you probably don't have the window's size set right :P

Another method that you might want to use is

Code: [Select]
src = Rect.new(0, 0, <width>, <height>)
dst = Rect.new(<ur x>, <ur y>, <width>, <height>)
window.contents.blt(src, Bitmap.new(<filename>), dst) # takes the image at <src> from the bitmap and draws it at <dst>

Or something like that; it's in the help file, under Bitmap.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on March 13, 2009, 02:45:11 AM
New question:

How would you go making a Horizontal command window for a menu? Instead of a normal command window one that has the selections side by side: Items, Skills, etc. Could someone tell me or guide me on my way or something.

If you need to contact me, my msn is gameguy27@hotmail.com
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on March 14, 2009, 06:58:10 AM
*bump*
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Fantasist on March 14, 2009, 11:18:51 AM
Change the @column_max variable to @item_max in Window_Selectable. You might have to tinker with update_cursor_rect.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on March 14, 2009, 04:14:07 PM
Thanks fantasist now I can make my cms I had in mind.
Okay it works but I still dont know how to lay the choices together.
Instead of
Items
Skills
Etc.

I want this but I dont know how to do this
Items Skills Etc.

The window selectable thing works but I started up title screen and it showed all three options the same but the selection was different.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: winkio on March 14, 2009, 04:40:51 PM
you need to change the dimensions of the window (in the constructor, where it says 'def initialize), then change draw_item.  Or whatever that method is called.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on March 14, 2009, 04:55:26 PM
Well I still dont know exactly what to change. I tried changing a few things just now but it started only showing the New Game option. So then I changed it back.

EDIT: Okay I just made a new window based off of ShopCommand so I got it now.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on March 17, 2009, 01:18:42 AM
New question:
 is it possible to have a message thing have to use more than one letter? Like the name thing is \n[1] but I need to know if its possible to have something like \sd[1] and if so how?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: winkio on March 17, 2009, 02:31:54 AM
yes.  Just search for the string like you would any other.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on March 17, 2009, 04:17:02 AM
well I wouldnt know what to do. I had the thing setup in the code like this
[SDsd] but that didnt work and I wouldnt know what else to try.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: winkio on March 17, 2009, 05:33:30 AM
its in Blizz-ABS.  here, let me find it...

Code: [Select]
event.name.clone.gsub!('\spc') {''}
thats how it looks through event names in blizzabs.

For messages, replace event.name with whatever you get the message text from.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on March 17, 2009, 05:44:40 AM
It doesnt work :( heres the code I have
(click to show/hide)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on March 17, 2009, 09:28:20 AM
That's for "\spc", not for "[spc]".
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on March 17, 2009, 11:14:42 PM
What do you mean its for "\spc"?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: fugibo on March 17, 2009, 11:30:23 PM
Two things:

1) He meant that it checked the event's name for \spc, not [spc].

2) I'm fairly sure you can just use
Code: [Select]
event.name.gsub('[spc]') do '' end
Since regular gsub copies on its own 0_o
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on March 18, 2009, 12:44:51 AM
I dont want to see what an events name is its for a message system. The message system uses this \n[1] to display a name. I want this
\ah[1] to display Game_actor 1's hp.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: shdwlink1993 on March 18, 2009, 02:57:09 AM
Like this?

Code: [Select]
text.gsub!(/\\[Aa][Hh]\[([0-9]+)\]/) { $game_actors[$1.to_i].hp.to_s }
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on March 18, 2009, 04:33:09 AM
Will that work? I'll try it once rpg maker xp is re-installed.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: fugibo on March 18, 2009, 04:36:34 AM
Good luck. And yes, that will almost definitely work just by glancing at the code.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on March 18, 2009, 04:41:06 AM
YES IT WORKS FINALLY!!!! I've been trying to get it to work forever thank you shdwlink!! *powers up*
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on March 20, 2009, 09:02:50 PM
Another question  :^_^':
How do we check an events x or y coordinate through script call?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Landith on March 20, 2009, 09:07:14 PM
$game_map.events[@event_id].x

$game_map.events[@event_id].y

I think... :/
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on March 20, 2009, 10:01:49 PM
it doesnt work :(
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: fugibo on March 20, 2009, 10:34:50 PM
Here's a tip:

Look in the Scene_Map class. You'll find a variable for events there. Find out what class is being stored there.
Next, go find either a) that class's source in the scripts or b) that class's documentation in the help file.
Finally, look for something with 'x' in it.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on March 23, 2009, 06:17:31 AM
Gots a new question I am making a status menu for my ABS Arcade game and I want the enemies to be animated in the menu so it looks like they are walking in place. How would I go doing this?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Fantasist on March 23, 2009, 01:36:11 PM
Use sprites and link them to the window as needed. For example, window.visible=false will also do sprite.visible = false. Check out STCMS and see how Blizz did it. That, or you could constantly use contents.blt to paste the graphic, which I don't recommend (but I mentioned this cause it might be considerable).
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on March 24, 2009, 08:58:59 PM
I didnt quite get it working  :^_^': But anyways new question :P Of course :)
How do I transfer a player using script call?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: shdwlink1993 on March 24, 2009, 09:17:08 PM
You'd use:

Code: [Select]
$game_temp.player_new_map_id = <<New Map>>
$game_temp.player_new_x = <<New X>>
$game_temp.player_new_y = <<New Y>>
$game_temp.player_new_direction = <<New Direction to face>>
$scene.transfer_player

while on the map.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on March 28, 2009, 12:11:11 AM
Another question :^_^':
I have something setup for a font changing size and and font changer. My script does what its supposed to do. This is the part thats not working I have the class game_system set up heres my script can someone help please?
Code: [Select]
class Game_System
  attr_accessor :font                    # font
  attr_accessor :size                    # size
  alias re_init initialize
  def initialize
    @font = "Arial"
    @size = 20
    re_init
  end
end

class Font
  alias change_font initialize
  def initialize
    change_font
    self.name = $game_system.font
    self.size = $game_system.size
  end
end

When I use $game_system.font = "Arial Black" it doesnt work. the $game_system.size = 10 doesnt work eitehr can someone help?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on March 29, 2009, 06:46:26 AM
Another question :^_^':
I have something setup for a font changing size and and font changer. My script does what its supposed to do. This is the part thats not working I have the class game_system set up heres my script can someone help please?
Code: [Select]
class Game_System
  attr_accessor :font                    # font
  attr_accessor :size                    # size
  alias re_init initialize
  def initialize
    @font = "Arial"
    @size = 20
    re_init
  end
end

class Font
  alias change_font initialize
  def initialize
    change_font
    self.name = $game_system.font
    self.size = $game_system.size
  end
end

When I use $game_system.font = "Arial Black" it doesnt work. the $game_system.size = 10 doesnt work eitehr can someone help?

*bumps*
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Landith on March 29, 2009, 08:21:29 AM
Make the class font part to module font and try calling it with change_font, after you set the $game_system.font = "Arial Black"

So like an example would be:

Code: [Select]
$game_system.font = "Arial Black"
change_font

and your code would be

Code: [Select]
class Game_System
  attr_accessor :font                    # font
  attr_accessor :size                    # size
  alias re_init initialize
  def initialize
    @font = "Arial"
    @size = 20
    re_init
  end
end

module Font
  alias change_font initialize
  def initialize
    change_font
    self.name = $game_system.font
    self.size = $game_system.size
  end
end

You can try that.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on March 29, 2009, 02:41:22 PM
I suggest you rather use something like my Ultimate Font Override.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on March 29, 2009, 06:18:53 PM
I suggest you rather use something like my Ultimate Font Override.

Normally I would but this isn't for changing the font :P
I'm trying to learn to be a better scripter. More knowledge of RGSS the better.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Fantasist on March 30, 2009, 05:30:58 PM
You could learn from Ultimate Font Override, if not use it. I did the same. But in the end, my version came out pretty much the same.

PS: btw, doesn't Font#initialize have arguments? Shouldn't it be like:

Code: [Select]
alias re_init initialize
def initialize(*args)
  #stuff
  re_init(args)
end

*args will simply pass all the given arguments to the aliases method. You use this when you're not sure about the number of arguments or you don't want to handle them again when you don't need to.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on March 31, 2009, 05:54:27 AM
How do we cut image script wise. I seen it in Berans Ipod Script.
(http://i307.photobucket.com/albums/nn318/bahumat27/bluenumbers.png)

I want to be able to cut that up in a script so I can use it or something. But how would I go like "cutting" it up like make it display only one section of the image?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on April 04, 2009, 03:20:47 PM
How do we cut image script wise. I seen it in Berans Ipod Script.
(http://i307.photobucket.com/albums/nn318/bahumat27/bluenumbers.png)

I want to be able to cut that up in a script so I can use it or something. But how would I go like "cutting" it up like make it display only one section of the image?
*bump*

It is a whole image. All the numbers are put together.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: shdwlink1993 on April 05, 2009, 05:47:01 AM
Something like this would work (I think):

Code: [Select]
self.bitmap = RPG::Cache.picture('Numbers', 0)
self.ox = bitmap.width / 10
self.oy = bitmap.height
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Fantasist on April 05, 2009, 10:41:39 AM
That won't cut the image, it'll only set the ox. For cutting the image, you'd need self.src_rect.set(x, y, w, h). Check it out in Arrow_Actor class, see how it selects the cursor parts from the windowskin.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Reno-s--Joker on April 05, 2009, 02:14:03 PM
Wow, now that is a handy thing I did not know. <333
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on April 09, 2009, 03:22:04 AM
I need some major help and it involves my new script with the background changer. I am so stuck on this and can't figure it out.
Here's my script.
Code: [Select]
module GameGuy
  Tilesets_Apply          = [1]
  Terrain1                = "001-Grassland01"
  Terrain2                = "002-Woods01"
  Terrain3                = "003-Forest01"
  Terrain4                = "004-Mountain01"
  Terrain5                = "004-Mountain01"
  Terrain6                = "004-Mountain01"
  Terrain7                = "004-Mountain01"
end
class Scene_Map
  alias re_update update
  def update
    re_update
    if GameGuy::Tilesets_Apply.include?($data_tilesets[$game_map.tileset_name])
      if $game_map.terrain_tag($game_player.x, $game_player.y) == 1
        $game_map.battleback_name = GameGuy::Terrain1
      elsif $game_map.terrain_tag($game_player.x, $game_player.y) == 2
        $game_map.battleback_name = GameGuy::Terrain2
      elsif $game_map.terrain_tag($game_player.x, $game_player.y) == 3
        $game_map.battleback_name = GameGuy::Terrain3
      elsif $game_map.terrain_tag($game_player.x, $game_player.y) == 4
        $game_map.battleback_name = GameGuy::Terrain4
      elsif $game_map.terrain_tag($game_player.x, $game_player.y) == 5
        $game_map.battleback_name = GameGuy::Terrain5
      elsif $game_map.terrain_tag($game_player.x, $game_player.y) == 6
        $game_map.battleback_name = GameGuy::Terrain6
      elsif $game_map.terrain_tag($game_player.x, $game_player.y) == 7
        $game_map.battleback_name = GameGuy::Terrain7
      end
    end
  end
end

Its an unreleased non working version. Anyways I want to make it so you have to enter the tileset id's in the
Tilesets_Apply so that the background changer only works on the tileset id's you entered in there
but I am having troubles getting to that.

Please someone help :(
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Fantasist on April 09, 2009, 11:44:29 AM
Code: [Select]
Tilesets_Apply          = [1]
Code: [Select]
if GameGuy::Tilesets_Apply.include?($data_tilesets[$game_map.tileset_name])
I'm not sure, but I don't think $data_tilesets[$game_map.tileset_name] is a number, it has to be one of those RPG:: objects. Try checking that out. If that IS the case, something like this might work:
if GameGuy::Tilesets_Apply.include?($data_tilesets[$game_map.tileset_name].id)

PS: This is all off my head, there is every chance I could be wrong.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on April 09, 2009, 03:53:13 PM
actually this works tested

(click to show/hide)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Fantasist on April 09, 2009, 05:49:19 PM
lol nathmatt! I only made things complicated >.< *powers up*
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on April 09, 2009, 11:21:14 PM
actually this works tested

(click to show/hide)

Yea but I wanted it for tilesets not maps.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on April 10, 2009, 12:58:32 AM
there for tilesets but it goes by the name of it not the id
(click to show/hide)
& blizz"s unofficial h window
(click to show/hide)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on April 10, 2009, 10:23:36 AM
I posted a version for public use of a horizontal window several times already and that's not the one. -_-
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on April 25, 2009, 08:08:14 PM
Okay nother question guys sorry :^_^':

How do we check if an item has an element checked? I'm making this Augmentation system like off of fable. Also how do we add an element or remove it from an item?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: fugibo on April 25, 2009, 08:14:39 PM
The Help File Helps
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on April 25, 2009, 08:17:59 PM
I see how to add elements but I still dont see how to check if it has an element checked.'

Ok I still dont know how to add them or see if one is checked. I only know how to set the elements in an array
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on April 29, 2009, 12:05:05 AM
More help :<_<: probably getting sick of me huh? >.<

Anyways couple of questions

How do I wait frames in rgss and how do I randomize variables in rgss?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on April 29, 2009, 12:13:45 AM
there is no wait command in rgss ur best bet is to use a variable so put in update that if  @wait_count > 0 @wait_count = - 1 and for random u use rand(n)  so u use n as the range
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on April 29, 2009, 12:19:50 AM
There has to be a wait command because The event editor has a Wait command and it waits the amount of frames you put in.
(click to show/hide)
Each event command has a line of script behind it.

But for the random thing use
Code: [Select]
Rnd(8)and it'll randomize a number between 0-8?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on April 29, 2009, 12:33:47 AM
yea put
Code: [Select]
rand(8)
& thats how they do the wait command the have a @wait_count in there update method
look at the update method in scene battle
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on May 15, 2009, 12:01:49 AM
New question.

I want to be able to find the percentage of somethign how would I do so? Wouldnt i use this?
Code: [Select]
$value = 1000 %
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Aqua on May 15, 2009, 12:03:45 AM
A percent in math is...

Value / Max Value * 100

Gosh... so simple math =X
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on May 15, 2009, 12:05:22 AM
This will be always 0 if Value and MaxValue are both integers. Better use

Value  * 100 / MaxValue
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on May 15, 2009, 12:06:02 AM
There is no max value. I want to be able to find what 1% = compared to a number. Like so...

1% of 100 = 1
1% of 1000 = 10
etc....

There is no ma value to divide by thats why I was asking.....
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Aqua on May 15, 2009, 12:09:12 AM
DON'T YOU KNOW YOUR MATH!?!? >8U

1% = 0.01
10% = 0.1
etc
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on May 15, 2009, 12:14:42 AM
That's only for the number 1. Try getting the single percent for this than

23385
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Aqua on May 15, 2009, 12:18:01 AM
You mean 23385% of something?

233.85
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on May 15, 2009, 12:28:29 AM
Oh so I just move the decimal is all?

Thank you aqua thats all I wanted to know but

What if I dont know what the value will be? How would I get that mathematical in RGSS. I'm going to make Gold Boosting Equipments

and I wanted an equation that did that so than I can take the percentage from the armor and add it to the gold amount
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Aqua on May 15, 2009, 12:33:58 AM
Where val = the % of the gold increase you want
Code: [Select]
gold_increase_percent = val.to_f / 100

Then add that as a % modifier to the amount of gold you receive.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on May 15, 2009, 12:35:25 AM
Thank you so much aqua. *powers up*

Just what I needed to finish this. If I do release the script (might be private for my game not sure) You'll be on the special thanks.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on May 21, 2009, 03:11:41 AM
How do we setup
Code: [Select]
$game_temp.shop_goods
I need to figure this out for a script for my game.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: legacyblade on May 21, 2009, 05:10:57 AM
long answer:

(click to show/hide)

short answer:

(click to show/hide)


Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on May 21, 2009, 05:24:19 AM
$game_temp.shop_goods is an array that looks like this
Code: [Select]
[[x, y], [x, y], [x, y], [x, y]]
where x is the item type
Code: [Select]
case x
when 0
  item is a $data_items
when 1
  item is a $data_weapons
when 2
 item is a $data_armors
end
and y is the items ID
so...
Code: [Select]
[[0, 1], [1, 1], [2, 1]]would create a shop where you could buy a potion, bronze sword, and bronze shield in that order

hope this helps!

Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on May 21, 2009, 05:44:51 AM
$game_temp.shop_goods is an array that looks like this
Code: [Select]
[[x, y], [x, y], [x, y], [x, y]]
where x is the item type
Code: [Select]
case x
when 0
  item is a $data_items
when 1
  item is a $data_weapons
when 2
 item is a $data_armors
end
and y is the items ID
so...
Code: [Select]
[[0, 1], [1, 1], [2, 1]]would create a shop where you could buy a potion, bronze sword, and bronze shield in that order

hope this helps!



Thanks Rye *powers up*

And lb of course
$game_temp.shop_goods is going to equal something xD thanks anyways lb *powers up*
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on May 21, 2009, 05:53:23 AM
yay I need power!
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: legacyblade on May 21, 2009, 06:09:17 AM
yay, power! And Game_Guy, that is how I find out what I need about certain data structures, print them when they're in use. It's how I figured out the move picture command in RGSS. I was just giving you my standard process.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on May 21, 2009, 06:57:41 AM
short answer
(click to show/hide)




I was referring to the short answer. $game_temp.shop_goods = something of course it'll equal something xD
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: legacyblade on May 21, 2009, 07:42:07 AM
oh, lol. My short answers are usually a sarcastic literal answer of the question :P
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on May 23, 2009, 04:06:29 AM
Ok I want to be able to have each item have rarity stars. Now I have the icon but how would I go making this icon be display 1, 2, 3, 4, or 5 times on that item line?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on May 23, 2009, 11:34:22 PM
Code: [Select]
n.times do |i|
  src_rect = Rect.new(0, 0, 24, 24)
  <bitmap_class_instance>.blt(<init_x_value> * i, y, RPG::Cache.icon(<icon_name>), src_rect)
end
where n = <number_of_times_to_draw_icon>
you can set n to 1, 2, 3, 4, or 5 with conditional branches or what ever
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on May 23, 2009, 11:51:18 PM
so do I replace the i or the n with the number of times?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Aqua on May 24, 2009, 12:04:17 AM
where n = <number_of_times_to_draw_icon>
you can set n to 1, 2, 3, 4, or 5 with conditional branches or what ever


You could also do...
Code: [Select]
for i in item.rarity
  src_rect = Rect.new(0, 0, 24, 24)
  <bitmap_class_instance>.blt(<init_x_value> * i, y, RPG::Cache.icon(<icon_name>), src_rect)
end
This way you don't have to use conditions nor the n.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on May 24, 2009, 12:11:07 AM
where n = <number_of_times_to_draw_icon>
you can set n to 1, 2, 3, 4, or 5 with conditional branches or what ever


You could also do...
Code: [Select]
for i in item.rarity
  src_rect = Rect.new(0, 0, 24, 24)
  <bitmap_class_instance>.blt(<init_x_value> * i, y, RPG::Cache.icon(<icon_name>), src_rect)
end
This way you don't have to use conditions nor the n.

I just replaced the n with item.rarity and it worked so there was no need to have branches.... thanks guys (lvs up aqua and ryex)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on May 24, 2009, 02:10:30 AM
where n = <number_of_times_to_draw_icon>
you can set n to 1, 2, 3, 4, or 5 with conditional branches or what ever


You could also do...
Code: [Select]
for i in item.rarity
  src_rect = Rect.new(0, 0, 24, 24)
  <bitmap_class_instance>.blt(<init_x_value> * i, y, RPG::Cache.icon(<icon_name>), src_rect)
end
This way you don't have to use conditions nor the n.
You COULD  use a 'for i in' but you SHOULDN'T it's slow and  'n.times do |i| end' is much faster WcW taught me that
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on May 24, 2009, 02:48:29 AM
Either way this question is resolved but could someone just explain how i would call a bitmap like the one ryex told me through the window.

I just want to know what everything in the line does.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on May 24, 2009, 02:55:46 AM
in a window
Code: [Select]
n.times do |i|
  src_rect = Rect.new(0, 0, 24, 24)
  self.contents.blt(<init_x_value> * i, y, RPG::Cache.icon(<icon_name>), src_rect)
end
self.contents IS a Bitmap instance

but elsewhere
Code: [Select]
bitmap = Bitmap.new(width, height)
n.times do |i|
  src_rect = Rect.new(0, 0, 24, 24)
  bitmap.blt(<init_x_value> * i, y, RPG::Cache.icon(<icon_name>), src_rect)
end
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on May 24, 2009, 02:57:27 AM
Ok that makes a bit more sense now what exactly does src_rect do/mean?

Just trying to learn as much as I can
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on May 24, 2009, 03:11:14 AM
src_rect is a compressed form of source_rectangle it is an instenct of the Rect class the Rect class simply stores a rectangle
so
Code: [Select]
src_rect = Rect.new(0, 0, 24, 24) creates a Rect instance with the dimensions 24 by 24 at the co-ordanets (0, 0)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: fugibo on May 24, 2009, 03:25:32 AM
You should probably just add the Rect.new parts inside the argument list, skip over storing then reloading the variable.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on May 24, 2009, 03:26:03 AM
Thanks both of you *lv's both up*

Any bit of RGSS I can learn the better.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on June 04, 2009, 04:29:27 AM
Another question...

How would we turn an events Self Switches off via script call?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on June 04, 2009, 09:50:28 AM
Code: [Select]
$game_self_switches[[MAP_ID, EVENT_ID, 'ID']] = false
MAP_ID = a number
EVENT_ID = a number
ID = A, B, C or D
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Aqua on June 05, 2009, 11:08:45 PM
Code: [Select]
$game_self_switches[[MAP_ID, EVENT_ID, 'ID']] = false
$game_map.need_refresh = true

MAP_ID = a number
EVENT_ID = a number
ID = A, B, C or D

Fixed :)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on June 05, 2009, 11:18:51 PM
He didn't say he wanted to apply it to the map immediately. :P *hides*
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on June 05, 2009, 11:19:35 PM
Hmm very true thanks both of you guys *double lv up*
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on June 08, 2009, 12:38:52 AM
Another question guys.

How would we go deleting a save file via script?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Aqua on June 08, 2009, 02:05:40 AM
Code: [Select]
File.delete('Filename.rxdata')
:)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on June 08, 2009, 02:06:06 AM
Thanks aqua *lv's up*
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on June 10, 2009, 10:11:11 AM
Another question....well ok two.

First one. How do we change the player's speed via script?

Second. Could someone explain how the zoom_x and zoom_y works and tell me how to use it please?

Thanks guys in advance!
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on June 20, 2009, 09:50:47 PM
Another Question....
How is everything setup in the Enemie's Element Ranks? Or the Element Efficiancy is what its called in teh database.
I tried printing it and it didnt work just printed <Table0xsome random numbers here>
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on June 20, 2009, 10:57:48 PM
print it for me an i'll interpret , just up load a screen shot of the print
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on June 20, 2009, 11:40:14 PM
Here it is
(http://i307.photobucket.com/albums/nn318/bahumat27/print.png)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on June 21, 2009, 12:08:41 AM
oh... well never mind that means nothing to me. how are you printing it?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on June 21, 2009, 12:12:58 AM
print $data_enemies[1].element_ranks

then I tried
print $data_enemies[1].element_ranks.to_s

And that still didnt work :P I dont know what else to do
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Aqua on June 21, 2009, 12:16:42 AM
It might be that there's too much stuff to print and can't fit on a print window?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on June 21, 2009, 12:37:39 AM
Code: [Select]
p $data_enemies[1].element_ranks[1]tell me what that dose
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on June 21, 2009, 12:39:14 AM
Well see in the thing right here

This is the script that controls $data_enemies
(click to show/hide)

I wanted to find out how to add elements into there element ranks and change the efficiency and stuff. I wanted to make a boss in my game where once you hit it with whatever element it'll change to that element and absorb all of that element until its hit with a different element.

EDIT: @reyx you posted before me :P

EDIT 2: It printed one which doesnt seem right...
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on June 21, 2009, 12:49:26 AM
now fell me what this dose
Code: [Select]
p $data_enemies[1].element_ranks[2]
if it prints 3 this i know how it works
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on June 21, 2009, 12:50:00 AM
yup it prints 3 if you can help me with this I'd be so grateful ryex!
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on June 21, 2009, 12:54:54 AM
ok so  it is a table class, Don't ask me whay they just did it that way it works like this p

$data_enemies[<id>].element_ranks[<elamit id>] => rank
where rank is 0, 1, 2, 3, 4, or 5 which means A, B, C, D, E, or F from the database
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on June 21, 2009, 01:00:38 AM
exactly how is it layed out though?
[1 => 3, 4=> 4]


Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on June 21, 2009, 01:01:48 AM
it's in an array but stupid enterbrain decided to but the array in a table so you can really print it
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on June 21, 2009, 01:04:33 AM
yea but I wanna know how to set it up still
[1 => 3, 4=> 4] is this what you mean in your post before?

And then how would I change an efficiancy of an element?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on June 21, 2009, 01:10:39 AM
it is layed out in and array where the position is the elamit id and the value is the rank
so
for the default ghost his array look like this

[ 0, 2, 3, 3, 3, 3, 3, 3, 3, 1, 3, 3, 3, 3, 3, 3, 3]

1 => A
2 => B
3 => C
4 => D
5 => E
6 => F

EDIT: sorry had the data wrong now it is right
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on June 21, 2009, 01:17:08 AM
ah ok so the first one, nil, is element id 0 which there isnt one
then it goes on I see ok thanks ryex *lv's up* will level you up again when I can this'll help out alot for this boss
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on June 21, 2009, 01:17:55 AM
edit recheck my post i had the data wrong
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on June 21, 2009, 01:18:28 AM
Ah ok still thank you ryex
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on June 21, 2009, 12:35:15 PM
Iteration through tables:

Code: [Select]
(0...table.xsize).each {|x| (0...table.ysize).each {|y| (0...table.zsize).each {|z| table[x, y, z]}}}
Keep in mind that your table might be 2 dimensional so you would have to use table[x, y] and only 2 loops.
Also, tables cannot be printed like other things. They are internally defined in a different way and nobody implemented a proper inspect method in them. :/
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on June 21, 2009, 07:58:02 PM
Iteration through tables:

Code: [Select]
(0...table.xsize).each {|x| (0...table.ysize).each {|y| (0...table.zsize).each {|z| table[x, y, z]}}}
Keep in mind that your table might be 2 dimensional so you would have to use table[x, y] and only 2 loops.
Also, tables cannot be printed like other things. They are internally defined in a different way and nobody implemented a proper inspect method in them. :/

this is why i think it is stupid that they are using a table for this; its a ONE dimensional table, EXACTLY like an array but no! they had to make it more complex than it should be.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: fugibo on June 21, 2009, 08:02:26 PM
Iteration through tables:

Code: [Select]
(0...table.xsize).each {|x| (0...table.ysize).each {|y| (0...table.zsize).each {|z| table[x, y, z]}}}
Keep in mind that your table might be 2 dimensional so you would have to use table[x, y] and only 2 loops.
Also, tables cannot be printed like other things. They are internally defined in a different way and nobody implemented a proper inspect method in them. :/

this is why i think it is stupid that they are using a table for this; its a ONE dimensional table, EXACTLY like an array but no! they had to make it more complex than it should be.

Okay, okay, I can take a hint! I need to sublcass Array, gotcha. >_>
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on June 21, 2009, 08:04:43 PM
wait what?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on June 21, 2009, 08:11:00 PM
There's a reason Table exists. It's much faster than multidimensional arrays.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on June 21, 2009, 09:37:36 PM
that may be true but why in the world would you use a ONE dimensional table?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on June 21, 2009, 09:49:11 PM
Again, speed. But tables are fixed sized and they only support integers from -32768 to 32767. That's the limitation.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: fugibo on June 21, 2009, 10:25:09 PM
Again, speed. But tables are fixed sized and they only support integers from -32768 to 32767. That's the limitation.

Any particular reason it's 16-bit?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on June 21, 2009, 10:26:18 PM
Probably because most data in tables doesn't need to have such a big range and probably for performance reasons. Table was made due to performance problems after all.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: fugibo on June 21, 2009, 10:37:30 PM
How much of an increase could it really get over 32-bit (that's usually just a signed int, right?) It seems like the millions of more values would make it more than worth it.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on June 22, 2009, 04:04:06 PM
Ok, now slowly reread my post from before and this time please don't skip the part where I said that a table is not resizable (realloc is an expensive operation, hint, hint -_- ). Along with that I would assume that there are other tweaks for faster access. It's very probable that Ruby's Array class is actually an implementation of a list. Tables in that case would be even faster since they seem to definitely be arrays.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on July 02, 2009, 08:05:25 AM
Another question......

How do I call up the message screen via script call? At the beginning of every battle I want a message to display that shows what the terrain is like
"Desert ~ Fire Power increased etc."

So at the beginning of every battle I want it to show a message all I need to know how is to call the message screen. I already ahve everything else setup.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on July 02, 2009, 10:43:47 AM
Use a variable where you assign the player's terrain tag to. Just check the variable and you will know which tag it is. Then you simply do a conditional branch with text at the beginning of a battle.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on July 02, 2009, 05:27:26 PM
I already have the terrain thing but i dont want to put a message and branch in a page on every troop I have. So I wanted to call the message easier so I could place it in the beginning of Scene_Battle.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: matte012 on July 02, 2009, 05:43:26 PM
Common Events are a mans best thing y'know. Of course, I am not that advanced I know that common events can be used for such things, as long as the area provides the variables *is somewhat new to RPGXP*

(and now that I realized..are you using the default battle system (or at least not ABS). Because you can arrange the events to play when the battle starts using the nifty little thing on the troops section)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on July 02, 2009, 05:45:26 PM
Yea but then at teh beginning of every battle I'd still have to place the common event on the first page of every troop. Where I just want to call the message or common event in the battle so its easier.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: matte012 on July 02, 2009, 05:49:03 PM
As I spoke before, I do think you should either call the common event in the troop section (possibly with condition branches if X is in the party) or you can call through eventing. Either way is possible.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on July 02, 2009, 05:51:25 PM
Look all I need is a message to display at the beginning of every battle. I dont want to place a text on one page in every single troop that would take to long. So heres what I have right now
Code: [Select]
module GameGuy
  def self.terrain_message
    case $game_player.terrain_tag
    when 1 then return "Battle Effects:\nIce power is increased.\nEarth power is weakened."
    when 2 then return "Battle Effects:\nFire power is increased.\nWater power is weakened."
    when 3 then return "Battle Effects:\nWater power is increased.\nThunder power is increased.\nFire power is weakened."
    end
    return "Battle Effects:\nNormal"
  end
end

All I want now is to call a message using GameGuy.terrain_message at the beginning of a battle in the actualy Scene_Battle so I can type it one time and not paste it in all my troops.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on July 02, 2009, 05:53:45 PM
Just make a common event and call it on the beginning of battles. :P

EDIT: matte beat me to it. xD
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on July 02, 2009, 06:00:23 PM
;__; how would I call it at the beginning of the battle without putting it in every troop.......nvm I'll figure it out myself.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on July 02, 2009, 06:01:54 PM
Call the common event at beginning of the battle scene (after the troop has being set up). Just use my common-event-by-script code.

EDIT: Even better. Find $game_troop.setup_battle_event. Do it there. In fact, you could code it right into Game_Troop#setup_battle_event. Screw events. xD
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: matte012 on July 03, 2009, 08:15:14 AM
As much as I cannot script, Blizz makes a point. There might be some kind of terrain tags somewhere that displays message but most likely not. Of course, calling a common even and copy and pasting on every troop wouldn't be too time consuming. Even Blizzards demo has around 40 troops (I hacked it, not for cheating, for reference O-O), setting the common even to a copy and paste would make adding it as easy as click on eventing troops add-on and hiting the nifty Ctrl+V button and moving on. Takes about 5 seconds on each troop..

But, possibly go for Blizz's technique. And maybe if you ask nicely, make a shrine of him in Toronto, pray to him and give him bribes he might script it for you. Okay, maybe if you ask nicely. It seems like a small script, still to big for my understanding. Makes me wish there was a 'RGSS For Dummies' eh?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Aqua on July 03, 2009, 08:18:07 AM
If you edit the Game_Troops scripts, you wouldn't need to copy paste events :P
^That's what Blizz means.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: matte012 on July 03, 2009, 08:21:56 AM
Still of course looking from a 'if you cannot script' point of view, like me ^_^

(Edit: That is relating to the 'why copy and paste' not the comment about Game_Troop.)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on July 03, 2009, 08:28:55 AM
Yea but who knows how many troops I'm going to have? I'd rather just get it out of the way. Anyways I already have the terrain tags store a message into a variable. I have a common event that displays that variable in a text. And I followed blizz's way and now I have it all setup.

In my above config it checks the id of the player's terrain tag then returns a message instead.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: matte012 on July 03, 2009, 08:33:52 AM
...I see. Not much else I could provide on the topic. Good luck man on your game. Lucky you have an idea how to script, right now I am a leecher. And, if you wouldn't mind. I am available for criticism on everything, if I could come up with 5 wrong things with the beta of Chaos Project, I think all gamers should fear my review.

(Edit: I somewhat had an idea of what it does. I'm just using the 'I cannot script' route)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Aqua on July 03, 2009, 08:37:52 AM
Off-topic
@Matte:
The version of CP demo you downloaded is veeeerrrrry old; lots of things have changed since its release.
If you want the newer version, then ask Blizz to sign up to be a Beta Tester here (http://forum.chaos-project.com/index.php?topic=1591.0)
It's even unencrypted, so you can use it to learn
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on July 03, 2009, 11:13:03 AM
Yeah, I was just going to say that. ^_^ In the beta there are over 260 troops.
I was suggesting the copy-paste idea because it's probably not necessary to script it if you can't script. I would use a script because making one would take me a few minutes and it would be automatic while somebody else would spend way less time copy-pasting each event. Sure, my method would be more error proof, but it also requires to know scripting.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on July 03, 2009, 08:58:31 PM
anyways I got the common event thign by script to work and its all setup in Game_Troops so now its over and done with. Any troop I make just has to have enemies dealt in it (putting aside cutscenes and whatnot) :) *thnx blizzy* 

So heres how it works. In my module GameGuy I have two methods. One that has the battle effects message and then the other who actually changes the skills power.

Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on July 21, 2009, 10:49:44 PM
Another Question *sighs*

Is there a way to dispose a blt in a window?

If not is it possible to draw a bitmap in a window a different way then dispose of it later?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on July 22, 2009, 09:15:53 AM
blt draws one bitmap on another, self.contents IS a bitmap. You can use .clear to clear the entire bitmap or ".fill_rect(x, y, width, height, Color.new(0, 0, 0, 0))" to clear just a specific area.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on July 25, 2009, 05:59:35 AM
Yet another question. Is it possible to create a folder using rgss?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on July 25, 2009, 06:39:51 AM
have you tried to write to a path that dose not exist yet? because it might create them automatically
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on July 25, 2009, 12:19:25 PM
Nope. You need FileUtils or you need to use an API call.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on July 25, 2009, 02:31:02 PM
could you post the FileUtils? or link me where they would be?

EDIT: Found it but now how do I make a folder with it?

(click to show/hide)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on July 26, 2009, 02:15:36 PM
That's not FileUtils. That's the shortened version I use in CP. -_-
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: fugibo on July 26, 2009, 02:18:16 PM
*cough*

Code: [Select]
Dir.mkdir "<name>"
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on July 26, 2009, 02:49:44 PM
I'm not sure if that works in RGSS, that's why I didn't mention it. >.<

EDIT: In case it doesn't work, here:

(click to show/hide)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on July 27, 2009, 01:19:05 AM
I got the directory making thing work. But how do I check to see if it exists? Because I get an error if the directory exists already.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: fugibo on July 27, 2009, 02:06:33 AM
I got the directory making thing work. But how do I check to see if it exists? Because I get an error if the directory exists already.

Code: [Select]
FileTest.directory? "<dir_name>"

Geez, Ruby standard library anyone? 0_o
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on July 27, 2009, 09:45:57 AM
Ruby != RGSS. You can't expect everything that works in Ruby to work in RGSS. Now stop being a smartass. I'd rather not receive help from somebody at all than having to bear somebody acting like a mega ass for every single piece of information.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: fugibo on July 28, 2009, 01:42:46 AM
Sorry 0_0 I meant that this is all readily available if you just Google the Dir class.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on July 30, 2009, 08:56:34 PM
@longfellow: in case you havent noticed I'm not the best googler

@blizz: could you help me with your gradient bars? I'm making a Blizz abs HUD with the following
HP
SP
Exp
Stamina(to run, sneak, and jump)

All I really need to know is how to make a gradient bar thanks for help if anyone can help
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on July 30, 2009, 09:25:45 PM
*points to e-book that has an example*
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on July 31, 2009, 03:44:35 AM
*points to my battle system thread in general RPG maker section for fully commented bar code"
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on August 13, 2009, 12:48:43 AM
Another question. Okay so I have this thing setup in an array
Code: [Select]
blah = [1 => 2, 2 => 3, 4 => 5]
I wanna know how this can be used and how can I access the two different numbers.
Like so 1 => 2

I wanna be able to access the first number at one time and the 2nd number at a different time.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Aqua on August 13, 2009, 12:52:59 AM
Look at hashes in the help doc... XD
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on August 13, 2009, 12:56:49 AM
I did and I dont really understand how to call the different numbers
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Aqua on August 13, 2009, 12:59:32 AM
1 => 2
1 is the Key
2 is the Value

I think...

So just look at the help manual for stuff on Keys and Values
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on August 13, 2009, 01:08:08 AM
Well here's what I have,
$blah = {1 => 2}

so how am I supposed to call that? I dont really get it. I tried this

print $blah[0]
print $blah{0}
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on August 13, 2009, 01:48:26 AM
just a question are you sure you need to use a hash y not an array then would just be $blah = [1,2] $blah[0] would = 1 but im sure you know this and probably need to use hashes

edit fixed lol was on my psp
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Aqua on August 13, 2009, 01:51:41 AM
Arrays use [], not ()
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on August 13, 2009, 02:02:53 AM
I cant tell much but it has to do with items.

[1 => 2]

1 is the item id
and
well its like this

I'm making a cooking script, so its going to be like this
when recipe_id then return [item_id => amount, item_id => amount]

that way it requires multiple items and multiple amounts of the item
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on August 13, 2009, 02:49:32 AM
y not a combination so say
Code: [Select]
case recipe_id
when 1 then item_id[1 => 2]

i dont know anything about hashes so what do you think
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on August 13, 2009, 02:56:47 AM
whats that suppose to do? thats exactly how I have it setup but I dont know how to access the 1 andc 2 at different times
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on August 13, 2009, 03:03:03 AM
ok it heres what i found

Code: [Select]
index(val)
Returns the key corresponding to val. If there is no corresponding element, returns nil.

If there are multiple corresponding keys, arbitrarily returns one of them.

Code: [Select]
self[key]
Returns the value mapped to key. If the corresponding key is not registered, returns the default value (or nil if not specified).

that's the only thing i can find not sure how you implement them so looks like index(val) would get 1 from 2

and self[key] would get 2 from 1 in {1=> 2}

edit does that help at all because i don't think there is a way to get the key without using the val or the val without the key there might be but i don't see it in the help file
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Aqua on August 13, 2009, 04:17:40 AM
$hash = {1 => 2, 3 => 4}

$hash[KEY]
$hash[1] would return 2
$hash[3] would return 4

And look at the other methods for more info and stuff.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on August 13, 2009, 06:03:36 AM
okay so we wouldnt be able to get the actual 1 then would we by using 0? Dangit oh well.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on August 13, 2009, 09:52:09 AM
You can get the key from the value as well.

Code: [Select]
hash.index(value) # returns the mapped key
Remember my config methods?

Code: [Select]
case id
when 5 then return 'Test 1'
when 7 then return 19
end

It's almost the same like a hash, but only one-way.

Code: [Select]
$hash = {}
$hash[5] = 'Test 1'
$hash[7] = 19

Why are hashes useful? The key and the value can be anything while in an array the "key" (actually index) can only be a number. Also, in hashes you can use any number as key while in an array the indices start from 0. Hashes are usually used to connect two values (i.e. like in Blizz-ABS actor action observation subsystem the actor is the key and the damage is the value).
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on August 13, 2009, 04:48:18 PM
yea but is it possible at all to get the first key? Because I'm making a cooking script, So the first key in the hash might be 5 or 33. I plan on releasing it so I dont know if someone else is going to put 33 as the first ingredient.

So is it possible to access the first one without inputing the key?

EDIT:
can we at least put an array inside an array? so its like this
when recipe_id then return [[item_id, amount], [item_id, amount]]
and if so how would I access the first array andc the numbers in it?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Aqua on August 13, 2009, 05:28:50 PM
$array = [[5, 1], [2, 2]]

$array[0] = [5, 1]
$array[1] = [2, 2,]

$array[0][0] = 5
$array[0][1] = 1


Unless my mind is still sleeping, and I messed up :P
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on August 13, 2009, 06:13:03 PM
no you not sleeping you got it right Aqua
@game_guy
also note that you can add as many levels to your array as you want

$bla = [[[5, 6], [4, 3]], [[2, 7], [8, 1]]]


$bla[0][0][0] => 5
$bla[0][1][1] => 3
$bla[1][0][1] => 7
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on August 22, 2009, 06:23:44 PM
Need help sorting an array. I tried the example from the help file but it didnt work...I want it for my skillshop so like how would I sort it alphabetical, reverse alphabetical, or by id?

Here's my window I just need to sort the @data array.
(click to show/hide)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on August 22, 2009, 06:26:59 PM
STCMS, just find where I sort the items by ID, name and quantity. After you sort, you can simply use .reverse or reverse! to reverse the order of all elements.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on August 22, 2009, 06:28:56 PM
I tried that and I get a wrong number of arguments (0 of 1) thing...
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on August 22, 2009, 06:52:38 PM
Make sure you know what you are sorting.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on August 22, 2009, 06:57:55 PM
Yea skills, it pushes $data_skills in it, and I figured the a.name, and b.name would be great so I tried copying that and I kept getting an error. I'll try again.

EDIT: I'm retarded, I kept calling my skill shop wrong, nothing was wrong at all XD

EDIT 2: Okay I know how to actually create a new weapon using this
Code: [Select]
new_weapon = RPG::Weapon.new
new_weapon.id = x
ect.

Now is there anyway to dump that weapon into the Weapons.rxdata without erasing all the other weapons?

EDIT 3:
Okay I got it. It dumps the weapon into $data_weapons[id] then it dumps $data_weapons into Weapons.rxdata

One more question, say I create another .rxdata file and store it in the Data folder. When the game's encrypted will the game be able to still read it?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on August 23, 2009, 06:40:20 AM
this thread now has so many answers to basic scripting questions it could be called a tut! lol
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on August 23, 2009, 06:42:17 AM
I declare this the General RGSS/RGSS2 Help Topic *hint hint sticky sticky*
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Aqua on August 23, 2009, 06:46:35 AM
Make the 1st post look better, and I'll sticky it for you. XD

Not a lot of us know how to RGSS2 though... o.o
Not sure how many could actually help with that XD
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on August 23, 2009, 06:51:58 AM
how's that?

oh and I could probably help :)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Aqua on August 23, 2009, 06:55:03 AM
After fixing some grammar issues...
*stickies*
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on August 23, 2009, 06:57:44 AM
Yea I know a bit about rgss2 enough to get me by anyways.

But I still need this question answered.
say I create another .rxdata file and store it in the Data folder. When the game's encrypted will the game be able to still read it?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Aqua on August 23, 2009, 06:59:21 AM
Why don't you just test it out yourself...? XD
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on August 23, 2009, 06:59:54 AM
Because I dunno...lazyness der xD
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on August 23, 2009, 10:47:29 AM
Now is there anyway to dump that weapon into the Weapons.rxdata without erasing all the other weapons?

EDIT: 3
Okay I got it. It dumps the weapon into $data_weapons[id] then it dumps $data_weapons into Weapons.rxdata

Lol, I posted the script snippet in the screenshot thread. Just be sure to have RMXP closed while you are doing this because RMXP will overwrite your file with the file it loaded in the first place if you save it.

One more question, say I create another .rxdata file and store it in the Data folder. When the game's encrypted will the game be able to still read it?

Yes. You need to use load_data and everything will work fine. load_data is usually loading a file through Marshal serialization, but it can also read such files from the encrypted RGSSAD archive. Blizz-ABS does the same with "MapData.abs" and CP with "MapData.cpx".

I use my own encryption for CP Beta 2. >:3 <3 <3 <3
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: shdwlink1993 on August 25, 2009, 03:03:32 AM
Not a lot of us know how to RGSS2 though... o.o

When you look at it, RGSS and RGSS2 aren't all that different. Granted, a lot of the RTP Scripts are different, but the core language is the same.

Yes. You need to use load_data and everything will work fine. load_data is usually loading a file through Marshal serialization, but it can also read such files from the encrypted RGSSAD archive. Blizz-ABS does the same with "MapData.abs" and CP with "MapData.cpx".

I use my own encryption for CP Beta 2. >:3 <3 <3 <3

Well, we all know how you think that Marshal is beneath you, Blizz. xD Regardless, I look forward to breaking said encryption. (Look, when you release CP, I'd love to make a Save File Editor for it. ^_^)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: winkio on August 25, 2009, 05:09:45 AM
props to the first person to use cheat engine on the final release of CP XD
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on August 25, 2009, 11:46:23 AM
Well, we all know how you think that Marshal is beneath you, Blizz. xD Regardless, I look forward to breaking said encryption. (Look, when you release CP, I'd love to make a Save File Editor for it. ^_^)

Oh no, that's not it. I meant encryption instead of rgssad. This also makes patching the game files so much easier since they aren't all embedded in the rgssad archive and people who upgrade don't need to download 40MB again. :/ The save files will stay DREAM encrypted.

Also, Marshal is a way to serialize data, not an encryption. xD
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on September 01, 2009, 08:54:56 PM
im trying to turn on a self switch via script but i keep getting an error
im using $game_self_switches[$game_map.map_id, event_id, key] = value
key as in 'A' "B" "C" or "D" value as true or false
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Zeriab on September 01, 2009, 10:06:58 PM
load_data decrypts the relevant portion of the RGSSAD archive before deserializing it. I.e. Marshal deserialization.
It's not like Blizz don't know how to decrypt the encrypted archive though XD
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on September 02, 2009, 09:10:56 AM
<3

@nathmatt:

$game_self_switches[[$game_map.map_id, event_id, key]] = value
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on September 02, 2009, 07:53:39 PM
that worked just had to make sure i refreshed the map
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on September 03, 2009, 10:08:27 AM
Yeah, you need to use "$game_map.need_refresh = true" as well.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on September 03, 2009, 08:56:45 PM
i used $game_map.refesh

edit well actually i was going to use that but just aliased game_map update and made a script very usefull so i could open and close my cell doors without 2 switches per cell see

(click to show/hide)

then had my event run the open door animation when "A" was on then turn b on so the door would stay open then when "C" was on it would show the door close and turn "D" on with would torn off the switches that i had not turned off yet
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on September 03, 2009, 10:07:19 PM
My thing just queues this call at an appropriate time. It shouldn't cause problems either way.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Satoh on September 06, 2009, 09:56:22 PM
I'm attempting to write a custom 'break damage/level/stat barrier' script. I think the caps are set in Game_Battler1, correct? I'm not sure if these are the enemy or actor values... Are actors stored separately?

Though it's mainly an aesthetic thing, I want level values up to 255, HP up to 99999, and stats up to 9999...

I'm not sure whether I need to change the setups in Game_Actor or Game_Battler1... GB1 has an HP value up to 999999, so I'm assuming that's the enemy setup. The GA setup seems to be setup differently though... and I'm not sure how to go about changing this...



Also, as I mentioned in another thread, I want to know how to interface weapons with status effects... or scripts... I want weapons/equipment to change the actor's state permanently, on equip and on unequip...

EDIT: Ok I changed the setups in those  two places but it doesn't seem to work...
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on September 07, 2009, 09:35:10 AM
RMXP'S default database settings don't allow to have more than the defaults. But if you change the scripts, you can have more stats ingame. It might be easier to simply go with an already existing script.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on September 07, 2009, 08:39:44 PM
Okay so I'm making a neat oblivion like saving script. So what I'm doing is make one file hold all save files. That way this file can keep track of how many saves have been done. Now the save slots is an array and I can have a multi array. So its like this.

Code: [Select]
@save_slots = []and when I go to save a game it'll dump all the important data into another array then dump that array into another array which will be in the save slots array. Is that possible? or will it cause errors or is it just a plain bad idea.
Code: [Select]
@vars = [$game_system, $game_actors, ect.]
@temp = ["Save #{$ggloadsave.saves}, @vars]
@save_slots.push(@temp)
That'd be right right?

Then I'd access the variables using this I think
Code: [Select]
@temp2 = $ggloadsave.saveslots[index]
$game_system = @temp2[1][0]

I think anyways can someone help me out here?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on September 07, 2009, 09:07:17 PM
High chance of inconsistent data. Don't do it.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on September 08, 2009, 12:39:10 AM
would a hash be better for this? that way you could save the data like so
Code: [Select]
@vars = {}
@vars['Game_System'] = $game_system
@vars['Game_Actors'] = $game_actors
ect.
@save_slots['slot_id'] = @vars
save_data(@save_slots, 'path.rxdata)


and retrieve like
Code: [Select]
@save_slots = load_data('path.rxdata')
$game_system = @save_slots['slot_id']['Game_System']
$game_actors = @save_slots['slot_id']['Game_Actors']
ect.

that way there is no messing around with indexes, no inconsistent data. right blizz?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: fugibo on September 08, 2009, 03:16:26 AM
would a hash be better for this? that way you could save the data like so
Code: [Select]
@vars = {}
@vars['Game_System'] = $game_system
@vars['Game_Actors'] = $game_actors
ect.
@save_slots['slot_id'] = @vars
save_data(@save_slots, 'path.rxdata)


and retrieve like
Code: [Select]
@save_slots = load_data('path.rxdata')
$game_system = @save_slots['slot_id']['Game_System']
$game_actors = @save_slots['slot_id']['Game_Actors']
ect.

that way there is no messing around with indexes, no inconsistent data. right blizz?

Epic waste of space. Instead of one file for all saves, why not use an index file for the saves? You could make a simple class for it and marshall it into SaveIndex.rxdata.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on September 08, 2009, 06:05:02 AM
even better! that way is saves the path to all the save files in the saveindex.rxdata!
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on September 08, 2009, 09:58:58 AM
With inconsistent data I meant that you take some data from before 10 seconds and some from now. This won't work because that combination of data never existed. i.e. There was no moment where the party had 5000 Gold and all characters were level 11. There was a moment where they were level 10 and had 5000 Gold and there was a moment where they had level 11 and they had 5500 Gold. You took the party state from before and the current state of the actors and so you got 5000 Gold with everybody on level 11 which actually never existed. Even worse, you SAVED that data. That is inconsistent data.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on September 11, 2009, 05:58:03 PM
I've been trying to keep myself busy seeing I'm sick, I tried doing all sorts of things but its too boring...anyways I was looking at all the scripts I made and then this idea just popped in my head.

I want to make a tileset creator. You import pictures and stuff into the pictures folder, use this command window showing all the options, you click one of your pictures, then you drag it on a layed out tileset sheet. I think its a great idea but I'm missing a few things. Mouse script and a resolution script (for larger tileset)

Okay so I found this resolution script but I dont really understand how to use it..maybe you guys can help me with it.
Code: [Select]
#==============================================================================
# ■ Resolution
#------------------------------------------------------------------------------
#  created by Selwyn
#  selwyn@rmxp.ch
#
#  released on the 19th of June 2006
#
#  allows to change the game window's resolution to 800 by 600.
#==============================================================================

module Resolution
  #--------------------------------------------------------------------------
  # ● instance variables
  #--------------------------------------------------------------------------
  attr_reader :state
  #--------------------------------------------------------------------------
  # ● initialize
  #--------------------------------------------------------------------------
  def initialize
    title = "\0" * 256
    Win32API.new('kernel32', 'GetPrivateProfileString','PPPPLP', 'L').call("Game", "Title", "", title, 256, ".\\Game.ini")
    title.delete!("\0")
    @set_resolution  = Win32API.new('Display.dll', 'SetResolution', 'III', 'I')
    @set_window_long = Win32API.new('user32', 'SetWindowLong', 'LIL', 'L')
    @set_window_pos  = Win32API.new('user32', 'SetWindowPos', 'LLIIIII', 'I')
    @gsm             = Win32API.new('user32', 'GetSystemMetrics', 'I', 'I')
    @gcr             = Win32API.new('user32', 'GetClientRect', 'LP', 'I')
    @kbe             = Win32API.new('user32', 'keybd_event', 'LLLL', '')
    @gaks            = Win32API.new('user32', 'GetAsyncKeyState', 'L', 'I')
    @window = Win32API.new('user32', 'FindWindow', 'PP', 'I').call("RGSS Player", title)
    @default_size = size
    if size[0] < 800 or size[1] < 600
      print("A minimum screen resolution of [800 by 600] is required in order to play #{title}")
      exit
    end
    @state = "default"
    self.default
  end
  #--------------------------------------------------------------------------
  # ● fullscreen
  #--------------------------------------------------------------------------
  def fullscreen
    @default_size = size
    @set_window_long.call(@window, -16, 0x14000000)
    @set_window_pos.call(@window, -1, 0, 0, 802, 602, 64)
    @set_resolution.call(800, 600, 4)
    @state = "fullscreen"
  end
  #--------------------------------------------------------------------------
  # ● default
  #--------------------------------------------------------------------------
  def default
    x = @default_size[0] / 2 - 403
    y = @default_size[1] / 2 - 316
    @set_window_long.call(@window, -16, 0x14CA0000)
    @set_window_pos.call(@window, 0, x, y, 808, 627, 0)
    @set_resolution.call(@default_size[0], @default_size[1], 0)
    @state = "default"
  end
  #--------------------------------------------------------------------------
  # ● trigger?(key)
  #--------------------------------------------------------------------------
  def trigger?(key)
    return @gaks.call(key) & 0x01 == 1
  end
  #--------------------------------------------------------------------------
  # ● private
  #--------------------------------------------------------------------------
  private :fullscreen
  private :default
  private :trigger?
  #--------------------------------------------------------------------------
  # ● size
  #--------------------------------------------------------------------------
  def size
    width = @gsm.call(0)
    height = @gsm.call(1)
    return width, height
  end
  #--------------------------------------------------------------------------
  # ● change
  #--------------------------------------------------------------------------
  def change
    if @state == "default"
      self.fullscreen
    else
      self.default
    end
  end
  #--------------------------------------------------------------------------
  # ● update
  #--------------------------------------------------------------------------
  def update
    if trigger?(121) # F10
      self.change
    end
    if Input.trigger?(Input::ALT) or Input.press?(Input::ALT)
      @kbe.call(18, 0, 2, 0)
    end
  end
  #--------------------------------------------------------------------------
  # ● module functions
  #--------------------------------------------------------------------------
  module_function :initialize
  module_function :fullscreen
  module_function :default
  module_function :trigger?
  module_function :size
  module_function :change
  module_function :update
end

And maybe ideas on a mouse script that detects the holding down of the left button, detects input of both right and left clicks and can detect mouse x and y. So help is appreciated
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on September 11, 2009, 06:39:17 PM
Tons' input module handles mouse buttons. o.o; I'm just too lazy right now to release the mouse controller. It just needs one last component to be coded. Man. ._.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on September 11, 2009, 07:05:11 PM
But I needed the mouse controller O_O but I guess I can code everything else for now, wait or can i? DUH DUH DUH DUH!!!!!

Anyways what about that resolution script up there?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on September 11, 2009, 07:27:14 PM
I might finish it then. ;>_>

Higher resolution = more lag, that's all I can say. You need to call Resolution.fullscreen, but first change the parameters in that method. The script is coded quite inconsistently. "Resolution" is conceptually not suited to be a module. -_- "Screen" should be the module and the most important method should be "set_resolution(x = 640, y = 480)" which obviously uses 640x480 as default parameters. -_-
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on September 12, 2009, 05:28:42 AM
Okay I'm using the bitmap.blt method in a scene. And its not showing any images. Am I supposed to be updating the bitmap?

Code: [Select]
@tile = Bitmap.new(256, 600)
@tile.blt(0, 0, bitmap, Rect.new(0, 0, 256, 600))
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on September 12, 2009, 03:15:52 PM
Nope. Just make sure "bitmap" is not nil.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on September 12, 2009, 04:42:33 PM
its not nil I even printed it but its not showing anything.

so here's my entire code right now,
Code: [Select]
Resolution.initialize
class TileCreator
  def main
    #@back = Sprite.new
    @back = RPG::Cache.tileset("Back")
    @grid = Sprite.new
    @grid.bitmap = RPG::Cache.tileset("Grid")
    @commands = ["New", "Insert", "Export", "Exit"]
    @names = []
    dir = Dir.new('Graphics/Pictures/')
    dir.entries.each {|file| next unless file.include?('.png')
    @names.push(file); RPG::Cache.picture(file)}
    @command = Window_Command.new(160, @commands)
    @graphics = Window_Command.new(160, @names)
    @graphics.active = false
    @graphics.visible = false
    @active = false
    @tile = Bitmap.new(256, 600)
    @tile.blt(0, 0, @back, Rect.new(0, 0, 256, 600))
    @command.x = 800-@command.width
    @graphics.x = @command.x-@graphics.width
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    @graphics.dispose
    @back.dispose
    @grid.dispose
    @commands.dispose
    @mouse.dispose if @mouse != nil
  end
  def update
    @graphics.update
    @command.update
    if @command.active
      update_command
      return
    end
    if @graphics.active
      update_graphics
      return
    end
    if @active
      update_active
      return
    end
  end
  def update_command
    if Input.trigger?(Input::B)
      @command.index = 4
      $game_system.se_play($data_system.cancel_se)
      return
    end
    if Input.trigger?(Input::C)
      case @command.index
      when 0
        $game_system.se_play($data_system.decision_se)
        @tile.dispose
        @tile = nil
        @tile = Bitmap.new(256, 600)
      when 1
        $game_system.se_play($data_system.decision_se)
        @graphics.active = true
        @command.active = false
        @graphics.visible = true
      when 2
        @tile.make_png("CustomTile")
        $game_system.se_play($data_system.decision_se)
      when 3
        $scene = nil
      end
      return
    end
  end
  def update_graphics
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @graphics.active = false
      @graphics.visible = false
      @command = true
      return
    end
    if Input.trigger?(Input::C)
      $game_system.se_play($data_system.decision_se)
      @mouse = Sprite.new
      @mouse.bitmap = RPG::Cache.picture("#{@names[@graphics.index]}")
      @mouse.x = Input.mouse_x? if Input.mouse_x? != nil
      @mouse.y = Input.mouse_y? if Input.mouse_y? != nil
      @active = true
      @graphics.active = false
    end
   
  end
  def update_active
    @mouse.x = Input.mouse_x? if Input.mouse_x? != nil
    @mouse.y = Input.mouse_y? if Input.mouse_y? != nil
    if Input.trigger?(Input::MOUSE_L)
      rect = Rect.new(0, 0, 256, 600)
      @tile.blt(Input.mouse_x?, Input.mouse_y?, @mouse.bitmap, rect)
      @mouse.dispose
      @mouse = nil
      @active = false
      @graphics.active = true
    end
   
  end
 
end

bitmap in the code is actually @mouse.bitmap
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Satoh on September 12, 2009, 08:04:36 PM
shouldn't it be' @mouse.Bitmap '?

I'm not positive, I'm still new to sprite calls... but it seems like that might be the problem...
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: fugibo on September 12, 2009, 08:13:30 PM
shouldn't it be' @mouse.Bitmap '?

I'm not positive, I'm still new to sprite calls... but it seems like that might be the problem...

No, the @bitmap variable is lowercase.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on September 13, 2009, 02:59:03 AM
Well I know for sure its placing the bitmap on the screen because I can export it into an actual tile but I cant see where I'm placing it... man this is just stumping me...
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Satoh on September 13, 2009, 03:10:17 AM
try commenting out the current coordinate assignment method you're using and give it absolute coords directly... if you can see the bitmap then your coordinate method is the issue... if not, then your issue is that the bitmap call isn't working properly (or as you would expect it to work rather)...

Did that make sense?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on September 13, 2009, 03:22:18 AM
Yea I tried that, I made it go to 0,0 and it still not working. So maybe if I make it a window? Yea I'll try that

EDIT:
Okay if I made it a window would I still be able to add contents to it? like
@window_tile.contents.blt?

Thanks in advance

EDIT 2:
w00tness I got it. I tried my above idea but I added a method that added a blt method so w00t I got it now. Yes a tilesetcreator is coming!!!
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Satoh on September 13, 2009, 06:43:25 AM
Yea I tried that, I made it go to 0,0 and it still not working. So maybe if I make it a window? Yea I'll try that

EDIT:
Okay if I made it a window would I still be able to add contents to it? like
@window_tile.contents.blt?

Thanks in advance

EDIT 2:
w00tness I got it. I tried my above idea but I added a method that added a blt method so w00t I got it now. Yes a tilesetcreator is coming!!!

Grats on the whole winning @ life thing... but what exactly is the purpose of the tileset creator... (not to go off topic or anything)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on September 13, 2009, 06:45:50 AM
Well now that you say that I'm finding it more useless than I imagined >_>

but anyways you import little pics and tiles and stuff you want in a tileset into the pictures folder. Run the game, and you can places those pictures you imported onto a grid. Theres an option turning Snap To Grid on/off, and then when you're all done, you press Export then type in a name for it and it'll save it into a tileset.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Satoh on September 13, 2009, 07:52:39 AM
basically a better way than using MSPaint, but without the hassle of waiting for Photoshop to take its Adobe freaking time to load... right?

I've not messed with file exporting before, but it sounds like it could be useful... if I ever find a way for it to be...


The real irony of me making a CMS, is that it will most likely be useless if I release it, as it's tailored to my needs and probably isn't versatile... and I'll probably never make a Star Ocean spinoff... because I simply lack the battle system, plot, and sprites necessary to do so...

However, every little bit that I get working, makes me feel a little more confident in my abilities... so I'm not quitting just yet...

I am still having difficulty deciding the best method for iterating through separate windows that are meant to be a single menu to scroll through...
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on September 13, 2009, 08:56:45 AM
yup it even deals with transparency ;)

okay another question, I'm going to add a few more features like saving and loading a tileset from a .rxdata to make it so you can work on it later. Could I just dump the bitmap into a .rxdata and still load it?

How would I go doing it?

EDIT
One question as well, how high can the hue go? Like when your getting a character
RPG::Cache.character(file, hue)

how hue can it go to?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: fugibo on September 13, 2009, 10:51:38 PM
yup it even deals with transparency ;)

okay another question, I'm going to add a few more features like saving and loading a tileset from a .rxdata to make it so you can work on it later. Could I just dump the bitmap into a .rxdata and still load it?

How would I go doing it?

EDIT
One question as well, how high can the hue go? Like when your getting a character
RPG::Cache.character(file, hue)

how hue can it go to?

11.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on September 14, 2009, 11:57:27 AM
Technically hue goes from 0 to 359. If you use more than 359, it will just cycle it.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on September 18, 2009, 02:40:36 AM
Okay so how do we draw a rectangle?

One thats just an outline? And then one thats just filled?

Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: fugibo on September 18, 2009, 02:51:40 AM
Okay so how do we draw a rectangle?

One thats just an outline? And then one thats just filled?



Wait, you honestly don't know Bitmap#fill_rect?
Code: [Select]
bitmap.fill_rect(<x>, <y>, <w>, <h>, <color>)

To draw an outline, you just draw lines using fill_rect:
Code: [Select]
bitmap.fill_rect(<x>, <y>, <w>, 1, <color>)
bitmap.fill_rect(<x> + <w>, <y>, 1, <h>, <color>)
bitmap.fill_rect(<x>, <y> + <h>, <w>, 1, <color>)
bitmap.fill_rect(<x>, <y>, 1, <h>, <color>)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on September 18, 2009, 02:52:45 AM
thanks LF *lv's up* I know you hate it but you've helped me out alot
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: fugibo on September 18, 2009, 02:55:23 AM
thanks LF *lv's up* I know you hate it but you've helped me out alot

Just for the record, I was trying to offend you above, but I thought that fill_rect was one of the things most scripters learned right off the bat. 0_o

Apparently, I was wrong...
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on September 18, 2009, 02:58:23 AM
Well yea you'd think I'd know but I've never been the one to really mess with bitmaps so thanks again
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on September 18, 2009, 09:31:06 AM
To draw an outline, you just draw lines using fill_rect:
Code: [Select]
bitmap.fill_rect(<x>, <y>, <w>, 1, <color>)
bitmap.fill_rect(<x> + <w>, <y>, 1, <h>, <color>)
bitmap.fill_rect(<x>, <y> + <h>, <w>, 1, <color>)
bitmap.fill_rect(<x>, <y>, 1, <h>, <color>)

Redundancy.

Code: [Select]
bitmap.fill_rect(x, y, w, h, c)
bitmap.fill_rect(x + b / 2, y + b / 2, w - b, h - b, Color.new(0, 0, 0, 0))
# x: x coordinate
# x: y coordinate
# c: color
# w: width
# h: height
# b: border width, use an even number
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: fugibo on September 18, 2009, 03:59:13 PM
Wow. I can't believe I didn't think of that. You know, since I've actually written huge scripts using that exact method before. ><
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on September 20, 2009, 09:31:17 PM
Don't worry about it. xD
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on September 25, 2009, 12:34:06 AM
Okay for this all I need is an answer to this. Its got nothing to do with rgss help but more of a "Is it worth scripting" question.

My friend relies on me when it comes to scripts...anyways he had this idea for his game called
Skill Equipping

Well what is exactly is each actor has ability points. For example
Aluxes: AP 10/10
Instead of being able to use all of your skills at once he wants to be able to equip skills to his actor. Each skill costs ap so when the ap's gone you cant equip anymore. The actor also gains some ap after every level up. He thought it was a great idea but is it really worth scripting?

I told him I might make it. But I want to know if theres a non sdk system like that already out there? Or if its even a good idea to script something. I thought it was a cool idea but I dont want to make it if its not worth it or if theres an already existing script like it.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: winkio on September 25, 2009, 01:37:21 AM
Definitely a good idea, a unique system that could add to a game.  I don't know if there's systems already out there, but I think you could make a better one anyways.  :)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on September 25, 2009, 02:07:55 AM
k thanks winkio I'll start working on it now and another question

Just some more bitmap stuff.
okay so I now know how to draw a rectangle but how do I make the inside clrea? Like transparent?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: fugibo on September 26, 2009, 06:28:26 PM
k thanks winkio I'll start working on it now and another question

Just some more bitmap stuff.
okay so I now know how to draw a rectangle but how do I make the inside clrea? Like transparent?

Use the alpha layer of the Color class:
Code: [Select]
# 24-bit (RGB) Color, doesn't have transparency
c = Color.new(<red value>, <green value>, <blue value>)

# 32-bit (RGBA) Color, transparency layer is called "alpha"
c = Color.new(<red value>, <green value>, <blue value>, <alpha value>)

And simply use that color along with Bitmap#fill_rect.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on September 29, 2009, 02:05:48 AM
another question....dang whats with all the questions? I'm going to count how many questions I asked in this thread lol

Okay anyways in a message window you can use commands like these
\n
\v
ect.

Is it possible to use codes like that in skills names or items and stuff? Like here's the item name
"Potion \p[100]"

Just for example than have a script like take that text and delete it and then use the number for something.

Also one more question. I plan on modding the message window for something but it requires this
\blah[1, false]

Like instead of it having just one thing in the brackets how would I make it two?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Aqua on September 29, 2009, 02:11:57 AM
ccoa's UMS does stuff like that.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on September 29, 2009, 02:15:30 AM
well that doesnt help with the first question, I want to put
\ commands in the item name in teh database then later
it does a command
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: fugibo on September 29, 2009, 04:10:57 AM
well that doesnt help with the first question, I want to put
\ commands in the item name in teh database then later
it does a command

Regular expressions.

Code: [Select]
# Code to print a number specified with \p[<x>] inside the name of an item with ID @item_id
if $data_items[@item_id].name =~ /\\p\[([0-9]*?)\]/i # << Here be the regular expressions
    # Print the number they added in the name
    print "Your number is #{$1}, foo!"
end
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on September 29, 2009, 04:19:13 AM
will that get rid of the \ command from the skill name?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: fugibo on September 29, 2009, 04:29:54 AM
will that get rid of the \ command from the skill name?



...I forgot that, dangit.

Code: [Select]
class RPG::Item
  alias real_name name
  alias real_name= name=

  def name
    return real_name.gsub /\\p\[([0-9]*?)\]/i, ''
  end
 
  def name= str
    if real_name =~ /\\p\[([0-9]*?)\]/i
      real_name = "#{str} #{$1}"
    else
      real_name = str
  end
end

Methods FTW!
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: samsonite789 on September 29, 2009, 07:15:06 AM
A question for thee (all of thee):

I am using events to create custom regen/poison/drain/osmosis blah blah blah etc. etc.  So far, all of it works, but there's one problem: no numbers pop up for the damage or healing done.  Of course, they wouldn't, seeing as I am only using events to do this, but I was wondering if there was a way to arbitrarily make the damage pop in battle using the Call Script command in the eventing window.  If so, is there a way I can specify which target it shows up on and also specify the number it displays as a certain variable that I set in the RPG Maker's database (not a variable I set in a script)?

Thank you.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: winkio on September 29, 2009, 07:17:50 AM
don't know if you want to use this instead or just borrow code from it, but: http://forum.chaos-project.com/index.php?topic=2481.0 (http://forum.chaos-project.com/index.php?topic=2481.0)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: samsonite789 on September 29, 2009, 08:07:10 AM
I've tried to use that, but it doesn't seem to work.

If I put it below RTAB 1.6 (which I am using) and I go into battle and use the Regen skill, it returns this error:

Script 'Real Time Active Battle' line 2671: NoMethodError occurred.
undefined method 'each' for 686:Fixnum

And when I go into the script editor, it points me to this method:

(click to show/hide)

I'm not sure where 'each' is or what to do about it, really.  So, I tried putting the HoT DoT script above RTAB, and I go into battle and it works, with one strange exception: no matter what I specify in the HoT DoT database, the spell consistently deals about 200 points of damage over time.  I tried changing the positives and negatives, the damage numbers and the type of damage and it always will deal 200 points every turn or so.  I'm thinking that something in RTAB is overriding its functionality partially so that it's getting mixed signals, but I have no idea what to do about it.

Any thoughts?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: fugibo on September 29, 2009, 02:11:23 PM
I've tried to use that, but it doesn't seem to work.

If I put it below RTAB 1.6 (which I am using) and I go into battle and use the Regen skill, it returns this error:

Script 'Real Time Active Battle' line 2671: NoMethodError occurred.
undefined method 'each' for 686:Fixnum

And when I go into the script editor, it points me to this method:

(click to show/hide)

I'm not sure where 'each' is or what to do about it, really.  So, I tried putting the HoT DoT script above RTAB, and I go into battle and it works, with one strange exception: no matter what I specify in the HoT DoT database, the spell consistently deals about 200 points of damage over time.  I tried changing the positives and negatives, the damage numbers and the type of damage and it always will deal 200 points every turn or so.  I'm thinking that something in RTAB is overriding its functionality partially so that it's getting mixed signals, but I have no idea what to do about it.

Any thoughts?

Your problem is that HoT DoT is specifying @damage as a number, while RTAB requires an array. I'm not sure how to fix it off the top of my head, but if you'll look at some of the RTAB compatibility code in Blizzard's Tons of Add-Ons I'm sure you'll find what you need.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: samsonite789 on September 29, 2009, 07:11:34 PM
Quote
Your problem is that HoT DoT is specifying @damage as a number, while RTAB requires an array. I'm not sure how to fix it off the top of my head, but if you'll look at some of the RTAB compatibility code in Blizzard's Tons of Add-Ons I'm sure you'll find what you need.

What RTAB compatibility code are you referring to?  I looked in Tons of Addons and didn't find anything that seemed like that specifically.  Come to think of it, another one of my big gripes is that Tons of Addons is not working well with RTAB.  The only way I can get it to avoid that stupid "wrong arguments (2 for 1)" error is to put the scripts above RTAB.  The problem, though, is that then RTAB overwrites all of the goodies that Tons of Addons provides. 

Any thoughtses?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on September 29, 2009, 08:11:32 PM
Well, Tons does have compatibility code for RTAB included so it should go below.
The compatibility code mostly includes things like method definitions with the battler parameter that is usually used in RTAB. That's what he meant. This usually gets rid of the argument error.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: fugibo on September 30, 2009, 01:05:37 AM
Well, Tons does have compatibility code for RTAB included so it should go below.
The compatibility code mostly includes things like method definitions with the battler parameter that is usually used in RTAB. That's what he meant. This usually gets rid of the argument error.

Exactly what I meant.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on September 30, 2009, 11:02:07 AM
I know. It wasn't just that clear from your post. xD
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: samsonite789 on October 01, 2009, 09:19:02 AM
But when I put it below RTAB, it still gives me the arguments error.  Is there a specific block of code I should be activating having to do with RTAB compatibility?

P.S.  Thanks for the help so far.  Much appreciated.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on October 01, 2009, 09:57:06 AM
No, there isn't. Which line is giving the error?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: samsonite789 on October 02, 2009, 07:57:25 PM
When I place Tons of Addons below RTAB, soon after I go into battle it gives me the following error message:

Script 'Real Time Active Battle' line 1683: ArgumentError occurred
wrong number of arguments (1 for 0)

The script it refers to is the following method in the massive Scene_Battle class of the RTAB script:
(click to show/hide)

I'm befuzzled...

On a side note, I have another simpler question about RGSS if'n ya don't mind.  How would one call a check to see if an actor has learned a certain skill?  Something like $game_data.skill_learned? or something like that...I'm trying to fix up one of my scripts to add a check to see if an actor has learned the skill and I'm not sure how to call it.

Thanks!
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on October 03, 2009, 01:14:41 PM
"$game_actors[ID].skill_learn?" is the call.

I'll take a look at that RTAB problem later.

EDIT: Fixed. Get the newest version of Tons. It was G_G's HP Consuming Skills. I forgot to make the script compatible with RTAB. Now it should be fine.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on October 04, 2009, 05:32:21 PM
wait was the error in the script my fault? If so sorry :(

Anyways question, is it possible to have rmxp load a script from a text file and run it? Like say I have this text file just for example and its got a config in it like so
Code: [Select]
module GameGuy
  Stuff = "Blah"
end

Now would it be possible to make one of the script slots load that text file and run it? This goes back to what I was asking blizz whether how to load rxdata through c# and reading and writing so seeing my friend is lazy....he like wants a config for everything so anyways instead of actually using c# to read and write I use it instead to generate this code that rmxp loads into a script that makes the rxdata.

So I just wanted to know if thats possible or not. So hopefully it is and I know its probably a stupid idea to be doing it like this but I want to experiment and stuff.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: samsonite789 on October 04, 2009, 07:16:21 PM
Thank you so much for all your help!  I'll try it out as soon as I can get back home.  One question, though...is there any specific place I should download the latest version of Tons from?  I assume it's from the stickied post in these forums, but I just thought I'd ask.

Thanks again!
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: fugibo on October 04, 2009, 07:20:18 PM
wait was the error in the script my fault? If so sorry :(

Anyways question, is it possible to have rmxp load a script from a text file and run it? Like say I have this text file just for example and its got a config in it like so
Code: [Select]
module GameGuy
  Stuff = "Blah"
end

Now would it be possible to make one of the script slots load that text file and run it? This goes back to what I was asking blizz whether how to load rxdata through c# and reading and writing so seeing my friend is lazy....he like wants a config for everything so anyways instead of actually using c# to read and write I use it instead to generate this code that rmxp loads into a script that makes the rxdata.

So I just wanted to know if thats possible or not. So hopefully it is and I know its probably a stupid idea to be doing it like this but I want to experiment and stuff.

Yep, you'd use
Code: [Select]
require File.expand_path 'script_name.rb'
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: samsonite789 on October 05, 2009, 07:07:32 PM
I tried the new Tons of Addons, and it's got several more error messages it's giving me...

When I put it below RTAB and everything else now, as soon as I attack something in battle, it gives me the following:

Script 'Tons of Addons 2' Line 3814: ArgumentError occurred
wrong number of arguments (0 for 1)

I checked out that section of the code - it's the skill separation section.  So I tried blocking out that chunk of code with =begin and =end to see if that was causing the problem.  When I did that and attacked something, it gave me the following:

Script 'Real Time Active Battle' line 2772: ArgumentError occurred
wrong number of arguments(2 for 1)

That is this sections of RTAB:
(click to show/hide)


Any thoughts?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on October 05, 2009, 08:13:43 PM
I'll look into it when I'm back from dinner.

EDIT: Fixed. BTW, you can post bugs about Tons in the Tons thread. :P

EDIT: Wait. Something else is wrong.

EDIT: Ok, done
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: samsonite789 on October 06, 2009, 08:39:14 AM
Rock on.  Thanks, man.  I will post in the Tons sticky in the future.  In fact, I just did because I found another bug.  Computers suck.

And thank you for all your help.  You are very helpful.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: samsonite789 on October 07, 2009, 01:29:35 AM
Question:

How do I detect player/event collision through a script call?

I have a little dilemma. I'm making an enemy detection system using a view range script. Right now, I've got it set up so that the first event page for an enemy is a parallel process in which they are constantly scanning to see if the player is within range via a script call - when they are, a self switch goes on and they chase the player down, etc., etc. However, there's a little problem: the few times I've tested it where the enemies DON'T see me, I can walk right up behind them and into them but nothing happens. Obviously, whether or not the enemy sees the player or not, I want a battle to start when the player touches the enemy. However, I can't do this simply by making an 'Event Touch' condition for battle processing because I need a parallel process to check for when the enemy DOES see the player.

So, all that rambling preamble is to this question: Is there a way to make a script call that will detect whether or not a player is in collision with an event? If I could use a conditional branch on the first parallel process page, that would bypass the problem completely.

Thanks!
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on October 07, 2009, 09:55:37 AM
Code: [Select]
$game_player.passable?(X, Y, DIRECTION)
Direction is 2, 4, 6 or 8 for down, left, right or up respectively. Also, this checks for general passability, not just for collision detection with events.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: C.C. rOyAl on October 11, 2009, 11:15:01 PM
k i got a question. in RGSS do you have to put things in order?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: winkio on October 11, 2009, 11:37:07 PM
lolwut?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: C.C. rOyAl on October 11, 2009, 11:39:51 PM
ok to be more specific

Say i  want to make a CMS, would i have to define the class Scene_Menu before i defined The Status screen?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on October 11, 2009, 11:43:07 PM
That's ok. Mostly classes can be defined in any order, but when several script redefine the same classes, this is where your scripts need to be in the correct order.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: C.C. rOyAl on October 11, 2009, 11:55:51 PM
what do you mean?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on October 11, 2009, 11:58:37 PM
This:

would i have to define the class Scene_Menu before i defined The Status screen?

No you wouldn't. This order IS NOT important.
BUT! Your CMS script that redefines Scene_Menu MUST be placed under the original Scene_Menu script. This order IS important.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: C.C. rOyAl on October 12, 2009, 01:49:53 AM
oh lol duh  8)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on October 13, 2009, 11:20:02 PM
if i wanted to inclose each Character in a separate window in my menu status how would i do that
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: fugibo on October 13, 2009, 11:22:44 PM
if i wanted to inclose each Character in a separate window in my menu status how would i do that

Just replace the single instance of Window_MenuStatus with four instances of your own window.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on October 17, 2009, 08:13:55 PM
so I have an dynamically generated array that looks something like this
Code: [Select]
powers = [[index_to_another_array, effective_power], [index_to_another_array, effective_power], [index_to_another_array, effective_power],[index_to_another_array, effective_power]]
what I need to do is find the array in the powers array that has the highest value for effective_power and return it so that I end up with
Code: [Select]
[index_to_another_array, highest_effective_power]how can I do this?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on October 17, 2009, 10:50:33 PM
Code: [Select]
max = nil
powers.each {|current| max = current if max == nil || current[1] > max[1]}

It's just a standard max/min loop. You could also use something like this:

Code: [Select]
max = powers[0]
(1...powers.size).each {|i| max = powers[i] if powers[i][1] > max[1]}

I prefer the latter due to only 1 condition being checked.

There's also a way to use a block with .max, but I don't really recommend it as it's confusing.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on October 18, 2009, 12:07:33 AM
*face palm* thanks Blizz
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on October 22, 2009, 02:47:19 AM
K here's a method from scene_battle
Code: [Select]
def start_phase5
    # Shift to phase 5
    @phase = 5
    # Play battle end ME
    $game_system.me_play($game_system.battle_end_me)
    # Return to BGM before battle started
    $game_system.bgm_play($game_temp.map_bgm)
    # Initialize EXP, amount of gold, and treasure
    exp = 0
    gold = 0
    treasures = []
    # Loop
    for enemy in $game_troop.enemies
      # If enemy is not hidden
      unless enemy.hidden
        # Add EXP and amount of gold obtained
        exp += enemy.exp
        gold += enemy.gold
        # Determine if treasure appears
        if rand(100) < enemy.treasure_prob
          if enemy.item_id > 0
            treasures.push($data_items[enemy.item_id])
          end
          if enemy.weapon_id > 0
            treasures.push($data_weapons[enemy.weapon_id])
          end
          if enemy.armor_id > 0
            treasures.push($data_armors[enemy.armor_id])
          end
        end
      end
    end
    # Treasure is limited to a maximum of 6 items
    treasures = treasures[0..5]
    # Obtaining EXP
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      if actor.cant_get_exp? == false
        last_level = actor.level
        actor.exp += exp
        if actor.level > last_level
          @status_window.level_up(i)
        end
      end
    end
    # Obtaining gold
    $game_party.gain_gold(gold)
    # Obtaining treasure
    for item in treasures
      case item
      when RPG::Item
        $game_party.gain_item(item.id, 1)
      when RPG::Weapon
        $game_party.gain_weapon(item.id, 1)
      when RPG::Armor
        $game_party.gain_armor(item.id, 1)
      end
    end
    # Make battle result window
    @result_window = Window_BattleResult.new(exp, gold, treasures)
    # Set wait count
    @phase5_wait_count = 100
  end

Anyways what I'm wondering is how do I change how the experience is handled when aliasing, see when I alias it and call the old method its gonna change how the exp is given but I wanna change that to something else but still be able to alias and not over write the method.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on October 22, 2009, 12:11:35 PM
Check out how I did it in the Different Difficulties System in Tons.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: fugibo on October 24, 2009, 04:14:29 PM
so I have an dynamically generated array that looks something like this
Code: [Select]
powers = [[index_to_another_array, effective_power], [index_to_another_array, effective_power], [index_to_another_array, effective_power],[index_to_another_array, effective_power]]
what I need to do is find the array in the powers array that has the highest value for effective_power and return it so that I end up with
Code: [Select]
[index_to_another_array, highest_effective_power]how can I do this?

This looks suspiciously like you're solving a polynomial, or something similar (that code would function to find the degree of any polynomial once you process it into an array of constants and variable names and the highest of their powers). May I ask what you're trying to do?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on October 24, 2009, 04:34:51 PM
http://forum.chaos-project.com/index.php?topic=4809.0
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on October 24, 2009, 06:21:02 PM
How do we get all of the map files put into an array?
For example, MAP001, MAP002, MAP003 are in the data folder, how would I get each of those map files in an array?

Because I dont know how many maps people are going. I'm working on a really cool script but yea I need all the map files in an array first.

Or if possible, instead of the file names, I want to use the actual map names used in the editor.
Like MAP001 is named Grasslands ect.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on October 24, 2009, 06:46:09 PM
Code: [Select]
hash = load_data('Data/MapInfos.rxdata')
The keys in the hash are the map IDs of all maps in the game (hash.keys returns an array of all keys). The values in the hash are RPG::MapInfo instances which have the attribute @name. So you can simply use hash[ID].name to get the map name.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on October 25, 2009, 02:38:41 PM
is there a way to get the exp curve and use it so that other things lvl the same way
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on November 02, 2009, 03:43:53 AM
how do you alias a self.method in a module?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on November 02, 2009, 11:12:09 AM
Code: [Select]
module XYZ
 
  class << XYZ
    alias abc_2 abc
  end
 
  def self.abc
    # code
    abc_2
    # code
  end
 
end
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on November 02, 2009, 04:40:57 PM
thanks Blizz
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Jackolas on November 02, 2009, 04:49:22 PM
Quote
is there a way to get the exp curve and use it so that other things lvl the same way
http://forum.chaos-project.com/index.php?topic=4851.0
should be correct
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Xelias on November 07, 2009, 02:59:02 PM
In class Game Battler, what is the syntax for
"If the attacker's Weapon Id is equal to..."
I tried "If attacker.weapon_id = ..." and it doesn't work:
I wanted to modify the algorithm of ONE weapon and all my weapons are changed !
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on November 07, 2009, 03:05:09 PM
use this
Code: [Select]
    if attacker.is_a?(Game_Actor)
      if attacker.weapon_id == 1
        # Code here
      end
    end
Got to make sure the attacker is a Game_Actor because when enemies use that same method when attacking and enemies dont have weapons.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Xelias on November 07, 2009, 03:23:46 PM
It works, but...
after the attack with the special weapon, I get an error
"Nil can't be coerced into fixnum"
at "self.hp -= self.damage"
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on November 07, 2009, 03:24:47 PM
post the code and I'll see whats wrong
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Xelias on November 07, 2009, 03:28:00 PM
(click to show/hide)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on November 07, 2009, 04:10:07 PM
all if statements need to be closed with an end statement after the

if attacker.is_a?(Game_Actor)
  if attacker.weapon_id == ATMA_WEAPON_ID

put

  end
end
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Xelias on November 07, 2009, 04:21:11 PM
I don't understand where I should place them. I tried after the formula ; I tried after BOTH formulas ; I tried at the end of the script and all of those tries  create strange bugs. Can you help me by putting the "End"s directly in my script please?  
EDIT : ...Whatever. I modified something in the defending part, and it worked. Thanks.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Aqua on November 07, 2009, 07:05:47 PM
The nil is when you have no equipped weapon.
So you gotta make a check for if you're fighting with just bare hands.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Xelias on November 07, 2009, 07:10:44 PM
Thanks, but you're a little to late. It works now.  :haha:
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on November 09, 2009, 11:02:16 PM
ok i cant figure out what im doing wrong so im initializing @name = [] then im updating
for i in 0 ..BlizzABS::Config::MAX_PARTY - 1 then im using this code
it keeps saying @name is nill i can post the whole script if you need it

#----------------------------------------------------------------------------
  # draw_name
  #  Draws the name display.
  #----------------------------------------------------------------------------
  def draw_name(id)
    actors = $game_party.actors[id]
    # set current variable
    @name[id] = actors.name
    # set font color
    self.bitmap.font.color = Color.new(0, 255, 0)
    # draw actor's name
    self.bitmap.draw_text_full(@name_x, @name_y+@all_y, 104, 20, @name[id])
  end
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on November 09, 2009, 11:48:17 PM
So, even if there is only 1 person in the party, you're still iterating through "0 ..BlizzABS::Config::MAX_PARTY - 1", are you?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on November 10, 2009, 12:46:57 AM
actually im going through 1..BlizzABS::Config::MAX_PARTY - 1 because the first 1 is done differently fixed the party member problem heres the full script its an edited version or ur BlizzABS hud


(click to show/hide)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on November 10, 2009, 01:31:49 AM
You need to use "1...$game_party.actors.size" instead. Your code tries to access non-existing actors if the party isn't full. It's MAX_PARTY, not CURRENT_PARTY or something like that.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on November 10, 2009, 02:34:42 AM
ok here the new code but its lagging realy bad & the exp for the other chars stays full also how should i update the faces

(click to show/hide)

Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on November 10, 2009, 10:11:44 AM
You probably did something wrong so it keeps refreshing it all the time rather than refreshing only when something changes.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on November 12, 2009, 09:14:30 AM
I'm all full of questions today.
How do I create a whole new event on a map?
All I need to know is setting up X, Y, Graphic, and Name
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on November 12, 2009, 10:20:34 AM
Check out how I did it with drop events in Blizz-ABS.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on November 12, 2009, 05:00:26 PM
EDIT:
Fixed that
Code: [Select]
module GameGuy
  def self.spawn_enemy(id,x,y,name,graphic)
    event = RPG::Event.new(0,0)
    event.x, event.y = x, y
    keys = $game_map.events.keys
    event.id = (keys.size == 0 ? 1 : keys.max + 1)
    event.name = name
    event.pages[0].graphic.character_name = graphic
    event.pages[0].graphic.character_hue = 0
    event.pages[0].trigger = 0
    drop = Game_Event.new($game_map.map_id, event)
    $game_map.events[event.id] = drop
    sprite = Sprite_Character.new($scene.spriteset.viewport1, drop)
    $scene.spriteset.character_sprites.push(sprite)
  end
end

But now the enemy wont appear it all on the map
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on November 12, 2009, 06:14:45 PM
IDK. Maybe you did something wrong. There are more than 1 method involved.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Satoh on November 13, 2009, 01:27:00 AM
Ok, I'm trying to make ONLY weapons display in this menu, and each weapon separate(Instead of

 it would be



I'm trying to modify the existing draw_item code (in a new class) but it doesn't seem to be working...

Code: [Select]
 def draw_item(index)
    item = @data[index]
    case item
    when RPG::Weapon
      number = $game_party.weapon_number(item.id)
    end
    if item.is_a?(RPG::Weapon)
      self.contents.font.color = normal_color
    end
    
    if number != nil
    for i in 1..number
      x = 4 + index % 1 * (288 + 32)
      y = index / 1 * 32
      rect = Rect.new(x, y, self.width / @column_max - 32, 32)
      self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
      bitmap = RPG::Cache.icon(item.icon_name)
      opacity = self.contents.font.color == normal_color ? 255 : 128
      self.contents.blt(x - 2, y + 2, bitmap, Rect.new(0, 0, 28, 28), opacity)
      self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
      if number > 1
        index += 1
        number -= 1
      end
      
      #self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
      #@number -= 1
    end
    end
  end

What am I doing wrong exactly?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Shining Riku on November 13, 2009, 02:51:46 AM
I have all I need, I'm just not sure how to do it. I understand scripting well enough to know where to go if somebody tells me, but I can't get my SE to play during a critical hit.

I think it'd be awesome to have it in my game. If it's possible, somebody please tell me how. I'd greatly appreciate it!

And everybody else that comes here could benefit from it too. :D
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Aqua on November 13, 2009, 02:58:55 AM
There are scripts out there already like this.

Try RPG Revolution or creationasylum or something. :)

Edit:
If you /really/ wanna do it yourself...
Code: [Select]
$game_system.se_play(name_of_sound_effect_here)Would play the sound effect.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: samsonite789 on November 13, 2009, 03:47:33 AM
So, I'm using a view range script for my game, and I was wondering how to do the following:

The script calls a method like so:

$view_range_enemies_view(a, b, c, d, e)
Where:
a = event_id (the monster's ID)
b = the view range in tiles
c = switch thrown when player is within view range
d = self switch thrown when player is within view range
e = whether impassable tiles are taken into account (block enemy view)

Here's an example:
$view_range_enemies_view(4, 5, nil, 'A', true)

However, I use a lot of these script calls in the enemy event and I'm going to make a lot of enemy events.  Instead of having to go through each page for each event and type in the enemy's event ID for each script call, I'd like to be able to set some sort of variable that will do that for me.

I tried PK8's Self Variables script to do that.  That does the following:

self_variable(variable_id, value, operation(i.e set, add, etc.))
And to call the variable, you use: self_variable(variable_id) in a call script.

So I tried this:

self_variable('monster', 4, 0) #set variable to monster's ID which is 4
$view_range_enemies_view(self_variable('monster'), 5, nil, 'A', true)

And I get an error telling me:
Script 'Self Variables' line 127: NoMethodError occurred
undefined method for '[]=' for nil:NilClass

That points to the following line in the script:
(click to show/hide)

I have a feeling it's just the syntax I'm messing up on.  Any ideas?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Shining Riku on November 13, 2009, 06:05:52 AM
Thanks Aqua. I'll take a look. :D

The reason why I asked is I figured I could edit the default scripts to do the critical noises, But now I dunno ha ha  :^_^':

So i'll go looking for now. I'll keep that script sniplet you showed me in mind though (I tried using it, but I guess I don't know how to get it to use the SE I need. I can't remember if I need " " around the SE name or not)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Aqua on November 13, 2009, 06:09:36 AM
Just add it in Game_Battler 3
Where the critical stuff takes place in attact_effects or whatever it's called
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on November 13, 2009, 11:46:30 AM
@Satoh: Don't do it like this. Instead in the refresh method you should add the items like you need them to be displayed. Then in the draw_item method just remove the quantity display.

Instead of the default loop to get all items, use this one:

Code: [Select]
data = []
(1...$data_items).each {|id|
    $game_party.item_number(id).times {data.push($data_items[id])}}

Remember to change $data_items and item_number to $data_XXXs and XXX_number depending for what you need it.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Satoh on November 13, 2009, 12:08:52 PM
Lol, Thanks again... I swear you fix things so easily and make it seem obvious... It's like looking back at childhood and wondering how 8 * 2 was ever a tough problem...(Ironically I always had issues with 8's... now they're the ones that come most naturally... binary and hexadecimal have changed my life.)

Eventually I'll probably find myself making a new battle system... but that's a ways off...

Thanks again.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on November 15, 2009, 07:58:21 PM
How would we take a screenshot and use it as a bitmap?
Its for my save system. When you save, it snaps a picture of the map, then only displays a small square of it, and the small square is where you saved.

Is this possible?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Aqua on November 15, 2009, 08:07:58 PM
I saw a save system like this before...
Either on RPG Rev or CreationAsylum.
It requires the screenshot dll

There even was a system where an image /was/ the savefile D:
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on November 15, 2009, 08:41:41 PM
Could you help me find it? I've been searching RRR and CreationAsylum for awhile now.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Aqua on November 15, 2009, 09:18:30 PM
http://www.rpgrevolution.com/forums/?showtopic=13382
That one is for VX.
You can take the screenshot dll from there and maybe even learn how to do it in RGSS by looking at RGSS2?
XD

I'll continue searching.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: winkio on November 15, 2009, 10:03:53 PM
If you just want a screenshot on map, look at Blizz-ABS.  That's how the pre-menu works, it takes a screenshot of the game then sets it as the background for the menu. ;)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on November 15, 2009, 10:09:06 PM
all it does is call Spriteset_Map, and I'm trying to do that but I'm trying to make it a small rectangle and center that rectangle on the player. I'm trying to understand spriteset_map some more.

>__> this is confusing >.<
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Satoh on November 15, 2009, 10:20:25 PM
all it does is call Spriteset_Map, and I'm trying to do that but I'm trying to make it a small rectangle and center that rectangle on the player. I'm trying to understand spriteset_map some more.

>__> this is confusing >.<

call that first, than BLT a portion of it to a variable, and save that variable to the save file...?

I can't say I'd know how to do it myself, but recently I have found block transfer to be invaluable for just about any drawing method...

Alternately you could save the transfered image to a new file and have the save files look up an image file with a corresponding name...


I regret that I'm too inexperienced to explain HOW to do any of that... but I can at least give the suggested modus operandi...
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: fugibo on November 16, 2009, 12:14:36 AM
You can't BLT Spriteset_Map, it's not a Bitmap. AFAIK, there's no way to do this without taking a literal screenshot or synthesizing a map on the fly.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: samsonite789 on November 16, 2009, 02:29:35 AM
I haveth a question...

How doth one change thine global variables in thine scripts before the main processing occurreth? 

In other, modern english words:

How do I set something like &data_enemies[1].exp in the script editor instead of in a map event?  If I try to do it, it tells me the following:

undefined method [] for nil:NilClass

Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Satoh on November 16, 2009, 03:20:52 AM
1. use a $ for global, not an &
2. Try adding "p $data_enemies[1].exp" on a line and see if it's producing the right info.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on November 16, 2009, 06:05:36 AM
I would still like to know how to do the map screenshot thing, but I have a question.
Also @aqua: the vx thing didnt have the screenshot dll in it, it simply copied some stuff from spriteset_map, but seeing how vx's rtp is way different then xp, makes it so difficult.

Anyways, how would we rotate a picture or bitmap?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Fantasist on November 16, 2009, 08:58:57 AM
@G_G: Dude, you can find Screenshot.dll in my Transition Pack demo, with a good demonstration of how to use it >.<

@samsonite789: The $data_BLAH stuff are loaded in Scene_Title#main. So if you want to do anything, look for where they are loaded and do your magic after they are loaded.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on November 16, 2009, 11:12:51 AM
I did a script once that would syntesize everything in Spriteset_Map to a bitmap, but the add-blended fog and weather were causing problems so I figured it's easier to go with a screenshot script.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: samsonite789 on November 17, 2009, 05:18:53 AM
@samsonite789: The $data_BLAH stuff are loaded in Scene_Title#main. So if you want to do anything, look for where they are loaded and do your magic after they are loaded.

Rock on.  Thank you!
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on November 17, 2009, 06:16:33 AM
@fantasist: it works great but I only want it to capture a small rectangle that surrounds the player. How would I do this?

EDIT: I got it nvm
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on November 19, 2009, 05:45:06 PM
any ideas how And where i would add the battle transition in my script http://forum.chaos-project.com/index.php/topic,3183.0.html
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: SorceressKyrsty on November 21, 2009, 03:55:05 PM
Hmm, not much of a scripter, but I'm wondering how I'd go about creating a static window in Battle Status that just shows the actor names.

(I say this too often)kinda like FF7, except without the 'Barrier' bars (Kinda pointless...). I'm not making an FF7 fan game, it's a parody with that system in particular. I've taken a few other systems from other FF's for it as well, but the battle/menu is FF7's mainly.

I've already moved the command window over and elimated the names from the actual Display, I just need that one box with the names in it...then I will rule the world...or something like that.

Static window creation is something I have attempted at but failed miserably. I keep back-ups for script testing of my game, but I'd rather not mess up my code completely by a simple error by floundering and guessing on my own.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Jackolas on November 21, 2009, 04:38:04 PM
out the top of my head
can be wrong tough because I'm no scripter :P

Code: [Select]
class Window_Battlernames < Window_Base

  def initialize
    super(0, 320, 640, 160)
    self.contents = Bitmap.new(width - 32, height - 32)  
    refresh
  end

  def refresh
    self.contents.clear
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      actor_y = i * 32 + 4
      draw_actor_name(actor, 0, actor_y)
   end
end


make sure that in "Scene_Battle 1" you add where you call out the windows:
Code: [Select]
@Name_window = Window_Battlernames.new
and under "# Dispose of windows" add
Code: [Select]
@Name_window.dispose
and under "# Update windows" add
Code: [Select]
@Name_window.update
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on November 27, 2009, 07:49:07 PM
How do we rotate images?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on November 27, 2009, 08:33:13 PM
sprite.angle = value
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on November 27, 2009, 09:33:15 PM
Works for sprites only, not for bitmaps.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Holyrapid on November 27, 2009, 10:09:46 PM
May i take a guess? bitmap.angle = value
Am i right? Have i learned anything about scripting?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on November 27, 2009, 10:15:13 PM
No, it doesn't work for bitmaps. using .angle or .angle= on a bitmap will cause an undefined method for Bitmap class error.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on December 02, 2009, 08:40:33 AM
so...
say I'm using RMX-OS and say that I want to sync the clocks between the server and the clients AND i want to be able to have more or less than 1 clock cycle in a 24 hours.

ok, so It dose not seem so hard all I would need to do I request the servers current time when you log in correct? then it would be a simple matter of finding the offset in hours between the server and the client using Time.now.hour correct?.

so If I have the Time object on the client and a number that is the server client off set how do I return a time object that reflects the server's current time?

and If I can do that how do I modified it using a float that represents the # of clock cycles in 24 hours?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on December 02, 2009, 11:41:51 AM
You can easily make a small server extension that sends the current server time to clients periodically (i.e. every second to reduce network load). Store this time into a special variable. Obviously you will need a plugin for that. I already use a format for sending the time of when PMs where sent which you can easily use for that in the server extension and the plugin. I can't remember the method name, but I think it was one of the few methods of the RMXOS module.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on December 08, 2009, 04:48:09 AM
How do we detect if a variable is a string?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on December 08, 2009, 03:12:41 PM
Code: [Select]
variable.is_a?(String)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on December 08, 2009, 06:06:59 PM
Thanks it worked, but these popped in my head as well.
How do we check to see if its a boolean, integer, integer with decimal and array?
I think array is this
Code: [Select]
variable.is_a?(Array)Not sure about the others though
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on December 08, 2009, 07:10:18 PM
Code: [Select]
variable.is_a?(Float) # Float = decimal number
variable.is_a?(Integer)
variable.is_a?(Numeric) # any number
variable.is_a?(FalseClass) # or just variable == false
variable.is_a?(TrueClass) # or just variable == true
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on December 08, 2009, 10:58:55 PM
in short you can tell if a object is an instance of any class with

Code: [Select]
object.is_a?(Class)
also

Code: [Select]
object.kind_of?(Class)
dose the same thing

it is worth noting that the is_a? and the kind_of? methods return true even if the object is only an instance of a subclass of Class

the

Code: [Select]
object.instance_of?(Class)
method is slightly different in that it only returns true if it is a direct instance of Class

ie.

Code: [Select]
module Foo
end
class Boo < Object
  include Foo
end
class Goo < Boo
end

obj = Goo.new
p obj.is_a? Goo       # true
p obj.is_a? Foo      # true
p obj.is_a? Boo      # true
p obj.is_a? Object  # true
p obj.is_a? Hash    # false
p obj.instance_of? Goo  # true
p obj.instance_of? Boo  # false
p obj.instance_of? Object  # false
p obj.instance_of? Foo  # false

Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on December 09, 2009, 02:47:05 AM
Question. How do I, if possible, alias a method between the method. That made no sense.
Example:
So example here's some code.
Code: [Select]
Class Test
  def main
    stuff_here
    more_stuff_here
  end
end
But I want to add stuff to that method in between stuff_here and more_stuff_here.
Code: [Select]
Class Test
  def main
    stuff_here
    other_stuff_here
    more_stuff_here
  end
end
Is it possible to accomplish that by aliasing?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on December 09, 2009, 09:31:48 AM
Not possible. Aliasing goes before or after and you can't put it in between.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on December 09, 2009, 08:31:23 PM
thanks for the answer blizzard

I'm making a title screen for GAX. And he wants the map as the background. Done. But he also wants events to execute while its on the map. How would I do this?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Jackolas on December 09, 2009, 08:38:31 PM
Quote
I'm making a title screen for GAX. And he wants the map as the background. Done. But he also wants events to execute while its on the map. How would I do this?

got also as far to add a map in the background. but failed to get stuff going on the map.
so if you figure it out can you plzz share it?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on December 09, 2009, 08:49:09 PM
I figured it out. I'm going to ask GAX first if he cares if its publically released. I think a map as background would be interesting. Eh give me a few hours so I ca ask him when he gets on.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on December 09, 2009, 10:15:04 PM
Better use a map as title screen. Seph made a script like that.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on December 09, 2009, 10:18:08 PM
Its okay Blizz, I already got it. Shows map as background, and events work and everything.
And ew, Seph's stuff uses SDK.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on December 09, 2009, 11:12:22 PM
Then make it better / an SDK-free version. xD
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Aqua on December 10, 2009, 12:18:45 AM
Code: [Select]
# By Murasame assassin
begin
 $data_actors        = load_data("Data/Actors.rxdata")
    $data_classes       = load_data("Data/Classes.rxdata")
    $data_skills        = load_data("Data/Skills.rxdata")
    $data_items         = load_data("Data/Items.rxdata")
    $data_weapons       = load_data("Data/Weapons.rxdata")
    $data_armors        = load_data("Data/Armors.rxdata")
    $data_enemies       = load_data("Data/Enemies.rxdata")
    $data_troops        = load_data("Data/Troops.rxdata")
    $data_states        = load_data("Data/States.rxdata")
    $data_animations    = load_data("Data/Animations.rxdata")
    $data_tilesets      = load_data("Data/Tilesets.rxdata")
    $data_common_events = load_data("Data/CommonEvents.rxdata")
    $data_system        = load_data("Data/System.rxdata")
  $defaultfonttype = "Tahoma"
  $defaultfontsize = 22
  $game_temp          = Game_Temp.new
    $game_system        = Game_System.new
    $game_switches      = Game_Switches.new
    $game_variables     = Game_Variables.new
    $game_self_switches = Game_SelfSwitches.new
    $game_screen        = Game_Screen.new
    $game_actors        = Game_Actors.new
    $game_party         = Game_Party.new
    $game_troop         = Game_Troop.new
    $game_map           = Game_Map.new
    $game_player        = Game_Player.new
    $game_party.setup_starting_members
    $game_map.setup($data_system.start_map_id)
    $game_player.moveto($data_system.start_x, $data_system.start_y)
    $game_player.refresh
    $game_map.autoplay
    $game_map.update
    $scene = Scene_Map.new
  Graphics.freeze
  while $scene != nil
    $scene.main
  end
  Graphics.transition(20)
rescue Errno::ENOENT
  filename = $!.message.sub("No such file or directory - ", "")
  print("File #{filename} not found.")
end

Tada...
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on December 10, 2009, 12:20:40 AM
I already have it made >__> why werent you on an hour ago XD
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on December 16, 2009, 05:17:35 AM
Okay I'm making a mouse plugin for Babs, really what I need to know is how to detect if the mouse is on an impassible area or an event
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on December 16, 2009, 11:28:50 AM
Better check the sprite. Or you can translate the mouse coordinates into pixel coordinates * 4 and using $game_map.display_x and $game_map.display_y you can match it with event real_x and real_y considering that an event side is 128x128 in that case.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Jackolas on December 16, 2009, 01:48:00 PM
how can I check the exp that was needed for the current lvl.
example:

Character is lvl 25
got a total of 500 exp

I want to know how I can check how much exp was needed to get to lvl 25 (for example 475 exp)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on December 16, 2009, 04:49:09 PM
This has the EXP needed for that level.

Code: [Select]
@exp_list[level] # inside Game_Actor
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Jackolas on December 16, 2009, 05:18:46 PM
probably because of my crap scripting skills:

undefined method '[]' for nil:NilClass
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on December 16, 2009, 05:22:14 PM
place this code in your script
Code: [Select]
class Game_Actor
  attr_accessor :exp_list
end
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Jackolas on December 16, 2009, 05:31:46 PM
did not work :S
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on December 16, 2009, 05:39:00 PM
Works for me. You have to place this in a new script or in yours.
Code: [Select]
class Game_Actor
  attr_accessor :exp_list
end
Call the actors exp with this
Code: [Select]
$game_actors[id].exp_list[level]
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Jackolas on December 16, 2009, 05:41:14 PM
nvm.. just noob scripting on my part
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on December 19, 2009, 09:46:37 AM
I know we can use dll's in RGSS but can we use dll's coded in c#? If so how do we call the dll and call a method? I want to experiment with something.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on December 20, 2009, 04:31:34 PM
You need to "Add a reference" in your C# project to the DLL.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on January 14, 2010, 02:59:26 PM
ok im trying to move the placement of the minimap in  blizz-ABS i moved it before but cant remember how

edit:might have helped to say it was blizz-ABS minimap
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on January 18, 2010, 11:15:18 AM
Change x and y coordinates in the class Minimap.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on January 18, 2010, 07:35:33 PM
redo post: ok i have a question i see how you can windows visible depending on a command windows index
like this @item_window1.visible = (@equip.index == 0) (so now @item_window1 is only visible when @equip.index == 0) can you use this to change @help_window.set_text depending on the command window or do i just need to use the case branch
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on January 24, 2010, 05:19:51 AM
is
Code: [Select]
x = Sprite.src_rect.xthe same thing as
Code: [Select]
x = Sprite.ox
and is
Code: [Select]
Sprite.src_rect.x = xthe same as
Code: [Select]
Sprite.ox = x
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on January 24, 2010, 11:43:16 PM
Having some troubles with this sprite class. Here's the code I have for the update method.
Code: [Select]
    self.bitmap.clear
    width = self.bitmap.width
    height = self.bitmap.width
    twidth = self.bitmap.text_size(@text).width
    self.bitmap.font.color.set(255, 255, 255)
    self.bitmap.fill_rect(self.x, self.y, width, height, Color.new(0, 0, 0))
    if @over
      color = Color.new(0, 0, 200)
      self.bitmap.fill_rect(self.x+1, self.y+1, width, height, color)
    else
      color = Color.new(255, 255, 255)
      self.bitmap.fill_rect(self.x+1, self.y+1, width, height, color)
    end
    self.bitmap.font.color = Color.new(0, 0, 0)
    self.bitmap.draw_text(0, 16, width, height, @text, 0)
It draws the blue rectangle if @over is true. And a white rectangle if @over is false. It does what its supposed to do. The only problem is it doesn't draw the text. Any ideas?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on January 25, 2010, 01:45:29 PM
Code: [Select]
height = self.bitmap.width
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: SorceressKyrsty on February 06, 2010, 03:34:43 PM
out the top of my head
can be wrong tough because I'm no scripter :P

Code: [Select]
class Window_Battlernames < Window_Base

  def initialize
    super(0, 320, 640, 160)
    self.contents = Bitmap.new(width - 32, height - 32)  
    refresh
  end

  def refresh
    self.contents.clear
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      actor_y = i * 32 + 4
      draw_actor_name(actor, 0, actor_y)
   end
end


make sure that in "Scene_Battle 1" you add where you call out the windows:
Code: [Select]
@Name_window = Window_Battlernames.new
and under "# Dispose of windows" add
Code: [Select]
@Name_window.dispose
and under "# Update windows" add
Code: [Select]
@Name_window.update

I asked for this code a long time ago but I couldn't get this to work. I got a syntax error, and the game started up when I added another end to the code, but no window showed up.
This is the LAST thing I need to finish the coding for my game. Other than Limit Break but I can't get that to work at all. Oh well.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Trainer Zydragon on February 12, 2010, 12:40:39 AM
Horizontal menus?

How would I go about making one? (I'm getting bored of vertical selectable menus)
And how would I make them images rather than text?
And lastly, how would I change the size of the image selected, so it LOOKS like it zooms in?
And I'm a noob so any help would be appreciated :)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on February 12, 2010, 06:16:03 AM
take a look at my collapsing cms or asantear battle system both contain a horizontal menu class so you can see how it is done
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Trainer Zydragon on February 12, 2010, 12:41:53 PM
Wow my eyes hurt now >.<
I'll have to have a major sift through the horizontal setup sections and see whats what
Cheers tho :D
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on February 13, 2010, 06:53:46 PM
Code: [Select]
[code]Its not really help I need its just a matter of which one is more efficient?
[code]
loop do
    Graphics.update
    Input.update
    update
    if $scene != self
        break
    end
end
or
Code: [Select]
while $scene == self
    Graphics.update
    Input.update
    update
end

The 2nd one is shorter and so far it seems to be working the same as the other one.[/code][/code]
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on February 14, 2010, 12:43:34 PM
I prefer the first way because I can add more abort-loop conditions more nicely. It's pretty much the same in the end.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Trainer Zydragon on February 14, 2010, 06:58:32 PM
Any way to center text within a menu/command window?
Any help would be appreciated :D
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on February 14, 2010, 07:00:32 PM
Code: [Select]
draw_text(x, y, width, height, text, 1)
Example, I'll draw "Hello". It'll center it between the width.
Code: [Select]
draw_text(0, 32, 320, 32, "Hello", 1)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Trainer Zydragon on February 14, 2010, 07:18:26 PM
And that works in a command menu?
Where would I put it in main? thats IF i put it in main.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on February 14, 2010, 07:22:52 PM
you would put it in here like this this

change ur call in main from @command_window = Window_Command.new to
@command_window = Window_Command2.new


Code: [Select]
#==============================================================================
# ** Window_Command
#------------------------------------------------------------------------------
#  This window deals with general command choices.
#==============================================================================

class Window_Command2 < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     width    : window width
  #     commands : command text string array
  #--------------------------------------------------------------------------
  def initialize(width, commands)
    # Compute window height from command quantity
    super(0, 0, width, commands.size * 32 + 32)
    @item_max = commands.size
    @commands = commands
    self.contents = Bitmap.new(width - 32, @item_max * 32)
    refresh
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    for i in 0...@item_max
      draw_item(i, normal_color)
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #     color : text color
  #--------------------------------------------------------------------------
  def draw_item(index, color)
    self.contents.font.color = color
    rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    self.contents.draw_text(rect, @commands[index],1)
  end
  #--------------------------------------------------------------------------
  # * Disable Item
  #     index : item number
  #--------------------------------------------------------------------------
  def disable_item(index)
    draw_item(index, disabled_color)
  end
end
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Trainer Zydragon on February 14, 2010, 07:31:22 PM
you would put it in here like this this

change ur call in main from @command_window = Window_Command.new to
@command_window = Window_Command2.new


Code: [Select]
#==============================================================================
# ** Window_Command
#------------------------------------------------------------------------------
#  This window deals with general command choices.
#==============================================================================

class Window_Command2 < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     width    : window width
  #     commands : command text string array
  #--------------------------------------------------------------------------
  def initialize(width, commands)
    # Compute window height from command quantity
    super(0, 0, width, commands.size * 32 + 32)
    @item_max = commands.size
    @commands = commands
    self.contents = Bitmap.new(width - 32, @item_max * 32)
    refresh
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    for i in 0...@item_max
      draw_item(i, normal_color)
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #     color : text color
  #--------------------------------------------------------------------------
  def draw_item(index, color)
    self.contents.font.color = color
    rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    self.contents.draw_text(rect, @commands[index],1)
  end
  #--------------------------------------------------------------------------
  # * Disable Item
  #     index : item number
  #--------------------------------------------------------------------------
  def disable_item(index)
    draw_item(index, disabled_color)
  end
end

I actually define my menu window IN main like so:

Code: [Select]
   s1="Items"
    s2="Skills"
    s3="Equip"
    s4="Status"
    s5="Options"
    s6="Quit"
    s7="Cancel"
    @menu_win=Window_Command.new(120, [s1, s2, s3, s4, s5, s6, s7])
    @menu_win.x=260
    @menu_win.y=60
    @menu_win.height=260
    @menu_win.index=@menu_index

Any way to change it from inside that?



EDIT::
Nevermind, I realise what you did there lol, thanks for the help again :)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on February 18, 2010, 05:26:42 AM
How do we round floats up or down?

I'm aware of the .round method, but if its below .5 it'll round down. If its above 0.5 it'll round up. There are certain times where I want it to just round down, or round up.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: winkio on February 18, 2010, 05:32:07 AM
try .floor and .ceiling.  Those should be the terms.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on February 18, 2010, 05:35:36 AM
The ceiling one didn't work but floor did.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on February 18, 2010, 05:50:15 AM
loot in the rmxp help file at the number classes there is quite a lot of info there.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on February 18, 2010, 05:52:05 AM
Ah found it. It was .ceil

Also can someone explain what .abs actually does? Maybe give me some examples?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Aqua on February 18, 2010, 05:53:25 AM
It's .ceil

Don't you know what absolute value is? O.o
It'll return the positive value of a number... in simplest terms :P
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on February 18, 2010, 07:35:20 AM
Code: [Select]
(1).abs     #1
(-1).abs    #1
(10).abs    #0
(-10).abs   #10
the absolute value of X (or |X|) is simply the positive distance from 0 on the number line
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on February 19, 2010, 04:41:37 AM
Quick file question.
I'm using this to read all lines from a text file.
Code: [Select]
lines = []
file = File.open('Data.txt')
file.each_line{|line| lines.push(line)
file.close
for i in lines
  p i
end

Which works and prints all 5 lines. Except the first 4 lines print the line plus \n. Anyway to remove this?

I also did another test with it with integers.
Code: [Select]
lines = []
file = File.open('Data.txt')
file.each_line{|line| lines.push(line.to_i)
file.close
for i in lines
  p i
end

And this time it just printed the numbers with no \n. Any idea?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on February 19, 2010, 06:37:29 AM
\n is the new line char. try using gsub! to remove it
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on February 19, 2010, 09:42:05 AM
Code: [Select]
file = File.open('Data.txt', 'r')
lines = file.readlines
file.close
lines.each {|line| p line}

:)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on February 19, 2010, 02:59:30 PM
Both ways worked. xD

However blizz is the simplest. I'm gonna have to go with his. However *double level's up*
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: fugibo on February 19, 2010, 03:30:01 PM
There's also
Code: [Select]
s.chomp! # removes whitespace at end of string
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on February 19, 2010, 03:42:37 PM
lstrip / rstrip / strip can be useful as well. :3 I'm just not sure if they are named the same in Ruby as in other languages.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on February 20, 2010, 07:41:19 PM
ok im trying to make a small script def that you will give it the current exp of a passive type skill and will return the lvl and exp needed i baes my code off this
Harder than I thought it was gone be :^_^':
best i could do i a short time.

To calculate exp needed to lvl:
L= LVL
B= Base
I= Inflation
E= EXP

E = B * ((L + 4) ^ (2,4 + I / 100)) / (5 ^ (2,4 + I / 100))

so the exp needed from lvl 5-6 when base and inflation are both 10 is:
10*((5+4)^(2,4+10/100))/(5^(2,4+10/100)) = 56,56854
looking in the rmxp actor exp table it says 56

yes i know they are a litle bid off...
but i think that RMXP is not calculating with numbers behind the ,
so it will always round the numbers down
im getting a syntax error on this  @e = 25 * ((lvl + 4) ^ (2,4 + 35 / 100)) / (5 ^ (2,4 + 35 / 100))
Code: [Select]
 def get_lvl(lvl,exp,expneeded)
    @e = 25 * ((lvl + 4) ^ (2,4 + 35 / 100)) / (5 ^ (2,4 + 35 / 100))
    if exp >= @e
      lvl += 1
    end
    expneeded = @e - exp
    return lvl,expneeded
  end

Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on February 22, 2010, 09:36:44 AM
In programming you never use a decimal comma. You ALWAYS use a decimal dot.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: fugibo on February 22, 2010, 04:27:39 PM
In programming you never use a decimal comma. You ALWAYS use a decimal dot.

silly europeans, not following america's vastly superior lead :V
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Trainer Zydragon on February 22, 2010, 04:38:58 PM
I dont see the logic in a decimal comma, surely thats only meant to be used for thousands and millions like 9,999,999... The people like us 'silly europeans' would be confused when you say 9,999 is actually 9.999  :haha:
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on February 22, 2010, 05:25:55 PM
k fixed that but now im having another problem the lvl is increasing to much when lvl 1 you need 25 exp but when i make exp 25 the lvl goes up to 5 & expneeded  goes to 10

edit got it to work

Code: [Select]
class Bitmap
 
  def get_lvl(exp,x,y)
    lvl = 1
    while exp >= get_exp_list(lvl)
      lvl += 1
    end
    slvl = lvl - 1
    expneeded = get_exp_list(lvl) - exp
    self.draw_text(x, y, 120, 32, slvl.to_s)
    self.draw_text(x, y+32, 120, 32, exp.to_s+'/'+get_exp_list(lvl).to_s)
  end
  def get_exp_list(lvl)
    @exp_list = Array.new(101)
    @exp_list[1] = 0
    pow_i = 2.4 + 35 / 100.0
    for i in 2..100
      if i > 99
        @exp_list[i] = 0
      else
        n = 25 * ((i + 3) ** pow_i) / (5 ** pow_i)
        @exp_list[i] = @exp_list[i-1] + Integer(n)
      end
    end
    return @exp_list[lvl]
  end
end
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: fugibo on February 22, 2010, 05:33:27 PM
I dont see the logic in a decimal comma, surely thats only meant to be used for thousands and millions like 9,999,999... The people like us 'silly europeans' would be confused when you say 9,999 is actually 9.999  :haha:

For writing, I stand by this as the proper form:
Quote
1 234 567.89
which should read as one-million, two-hundred and thirty-four thousand, five-hundred and sixty-seven and eighty-nine hundredths.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Trainer Zydragon on February 22, 2010, 06:03:04 PM
I dont see the logic in a decimal comma, surely thats only meant to be used for thousands and millions like 9,999,999... The people like us 'silly europeans' would be confused when you say 9,999 is actually 9.999  :haha:

For writing, I stand by this as the proper form:
Quote
1 234 567.89
which should read as one-million, two-hundred and thirty-four thousand, five-hundred and sixty-seven and eighty-nine hundredths.

See us British would write that as 1,234,567.89 :)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: fugibo on February 22, 2010, 08:48:01 PM
I dont see the logic in a decimal comma, surely thats only meant to be used for thousands and millions like 9,999,999... The people like us 'silly europeans' would be confused when you say 9,999 is actually 9.999  :haha:

For writing, I stand by this as the proper form:
Quote
1 234 567.89
which should read as one-million, two-hundred and thirty-four thousand, five-hundred and sixty-seven and eighty-nine hundredths.

See us British would write that as 1,234,567.89 :)

I'm American. We do, too. I prefer 1 234 567.89, though. The commas are used for readability. Spaces work just as well.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on February 22, 2010, 10:36:05 PM
ok im any help on the most effective way to make passive type (mining,fishing,etc... )skills i thought about sort of a copy of game actor but not sure 
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on February 23, 2010, 09:14:31 AM
In programming you never use a decimal comma. You ALWAYS use a decimal dot.

silly europeans, not following america's vastly superior lead :V

Lulz
That's because you had the first computers and you said it's gonna be a dot. xD
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Zeriab on February 23, 2010, 02:05:37 PM
Code: [Select]
file = File.open('Data.txt', 'r')
lines = file.readlines
file.close
lines.each {|line| p line}

:)

I suggest using a block since File provides error handling in that case. It for example ensures that the file stream will be closed.
Code: [Select]
File.open('Data.txt', 'r') {|file|
  lines = file.readlines
  lines.each {|line| p line}
}

*hugs*
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on February 23, 2010, 03:20:08 PM
I prefer begin-rescue blocks since you can catch the error. :3
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Zeriab on February 23, 2010, 08:19:40 PM
You can perfectly fine still catch the error.
It still raises errors it gets.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on February 26, 2010, 04:23:09 PM
ok im trying to figure out how i should set up my skill script right now it wait 5 then takes the base stat & multiplies it my the number of times it loops then adds the atk so ur weapon so ur weapon effects the speed  till it equals the given amount but what im what i need is by how much should the base stat increase each lvl right now it starts at 50 than increases by 5 every lvl
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on March 25, 2010, 08:26:11 PM
ok i managed to get the path finder from Blizz-ABS with creates an array of directions to get to the targeted x & y my problem is figuring out how to get the player to move using each command in the array i tried casing the direction to move in the correct direction then i shifted the array to remove the already moved direction from the array the problem is it goes through the array to fast i need it to wait for the move to be completed remove it from the array then do the next 1

edit: figured it out just had to check if player was moving if he wasn't then call the method again
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on March 29, 2010, 06:05:28 AM
I'm assuming this just has to do with math because it most likely does. What I want is to draw an area around the player like in a tactic battle system. Something like this.

(click to show/hide)

That area would be drawn if the player's move count was 3. The red square is the player and the blue squares are where he can walk.
I'm trying to figure out an equation to draw so many squares like that according to move count.

If anyone could help I would be very thankful. Its for a small mini-game I'm working on.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: winkio on March 29, 2010, 06:49:02 AM
that area is defined by abs(a.x-o.x) + abs(a.y-o.y) <= r, where a is a tile, o is the center, and r is the radius.  One way to do it is using that equation.

Another way is to go from one end to the other, increasing the amount of tiles by 2 each time until you hit the center, then decreasing by 2 each time.  it's simpler and doesn't need an equation.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on March 31, 2010, 05:13:08 PM
is there a way to check if a message is being displayed from the show text command in Interpreter ?
edit: found it $game_temp.message_window_showing
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on April 02, 2010, 02:35:09 AM
Okay how would we use a dll made in C# in a script? I'm trying a few things out. Any help is appreciated.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on April 06, 2010, 05:02:41 PM
You can't. Ruby can only use libraries made in C (AFAIK) and C# DLLs are bound to .NET so you can't use them out of two reasons.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Jragyn on April 08, 2010, 07:08:15 AM
Congratulations, Blizzard on retiring from rmXP!
Hope life goes in the way you want, away from this game making software lol.

But, erhm, to whomever can answer:

Whats the difference between this:

Code: [Select]
if $game_system.save_disabled
      # Disable save
      @command_window.disable_item(4)
    end

and this:...?

Code: [Select]
@command_window.disable_item(4) if $game_system.save_disabled
Is the First like...bad coding?
I've personally discovered that using the latter when possible seems easier to manage...
but does it...really make a difference in some way?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on April 08, 2010, 08:39:41 AM
There is no difference. It's just in the first statement you can add more commands under that conditional branch while in the second you can't.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: momentai1018 on April 10, 2010, 09:42:59 PM
Hi i was wondering if anyone can make this script compatible with blizz abs cause  i can't seem to get it. it's not mine but i want to be able to use it, it's a swimming script and it worked before i added blizz abs


(click to show/hide)

Added code and spoiler tags ~ G_G
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: WhiteRose on April 10, 2010, 09:51:59 PM
I'm afraid I can't help, as I'm not much of a scripter, but I do have a few recommendations that will make sure your request is filled quicker:
1. Make sure you use the "Search" function before you post; I don't know if you did already, but I do recall a swimming script being mentioned before. I don't remember if it worked or not, though.
2. Once you have confirmed that there is no solution already available, start a new thread clearly outlining what scripting work you would like completed. In this case, sorting out the compatibility between your swimming script and Blizz-ABS.
3. Use code tags. It'll make your script easier to read, use and edit.

If you follow these things, I'm sure that one of our expert scripters such as Ryex or Game_Guy will come give you a hand. :)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on April 12, 2010, 08:46:55 AM
This is a topic for scripters and GENERAL scripting questions. If you have problems with a specific script, post it in the Script Troubleshooting section.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Jackolas on April 13, 2010, 02:32:56 PM
question.... (kinda got myself in over my head again:S)
I want kinda create a rather complicated array (think that's it called)

for example:
random for specific actor at a level must return a number

so I will end up wit:
Code: [Select]
for actor A
  on lvl 1 return 2
  on lvl 2 return 6
  etc...
for actor B
  etc...

now I want a way that I configure this (as small as poss) and than read it from some point in my script
I hope I make sense :S

i seen scripts that use it the configure this way:
Code: [Select]
 something = {
  1 => [  [1,2],[2,6],[3,8],[4,10],[etc],
       ],
  2 => [  [1,3],[2,5],[3,7],[4,9],[etc],
       ],
  } #end
what I kinda like because its small (not a lot of lines)
but I know no way to read it. (and the script I found this in is incomplete, accidental removed a part and can't find the script any more :S)
ofc it doe's not have to be like that 1... as long as its 1 that works
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: (Hexamin) on April 13, 2010, 05:14:28 PM
Hmmm... something like...
Code: [Select]
$game_party.actors[0] = index
Random_Stuff[index] = player_lvls
player_lvls[index.level] # returns random number

or...

Code: [Select]
Random_Stuff[$game_party.actors[0]][$game_party.actors[0].level] # returns random number

Maybe?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Jackolas on April 13, 2010, 05:27:54 PM
hmm.. think its my lack of explaining skill :S

retry:

I want somehow in a script a predetermined number that fist at a specific lvl and actor.

Code: [Select]
for example of the following config:
  something = {
  1 => [  [1,2],[2,6],[3,8],[4,10],[etc],
       ],
  2 => [  [1,3],[2,5],[3,7],[4,9],[etc],
       ],
  } #end
if I than ask for lvl 3 in actor 1 I need to get 8 in return (as an example)
hope that makes it more clear

atm i'm trying to work around it by something like:
Code: [Select]
 def self.something(id)
    case id
      when 1: return [2,6,8,10,etc...]
      when 2: return [3,5,7,9,etc...]
      end
    return [0]
  end
and than somehow request the 4th number when ID is 1 (witch will result in 10 ofc)
atm am failing :S

Edit:
Nvm... fixed it myself
Code: [Select]
something(id)[place] = numberso
Code: [Select]
something(01)[4] = 10
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Valdred on April 13, 2010, 09:55:01 PM
I got a question. How do I show an Animation trough scripting?
I don't mean the charset/stop animation way. You know the animations like "hit" and so.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on April 13, 2010, 10:39:13 PM
charactor.animation_id = the animation id caractor is the charactor so say $game_player.animation_id = 1 would use the animation 1 on the player

edit: i think ruby doesn't like me how does @players.any? {|key, value| value.username == value.username} = false?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on April 13, 2010, 11:38:56 PM
question.... (kinda got myself in over my head again:S)
I want kinda create a rather complicated array (think that's it called)

for example:
random for specific actor at a level must return a number

so I will end up wit:
Code: [Select]
for actor A
  on lvl 1 return 2
  on lvl 2 return 6
  etc...
for actor B
  etc...

now I want a way that I configure this (as small as poss) and than read it from some point in my script
I hope I make sense :S

i seen scripts that use it the configure this way:
Code: [Select]
  something = {
  1 => [  [1,2],[2,6],[3,8],[4,10],[etc],
       ],
  2 => [  [1,3],[2,5],[3,7],[4,9],[etc],
       ],
  } #end
what I kinda like because its small (not a lot of lines)
but I know no way to read it. (and the script I found this in is incomplete, accidental removed a part and can't find the script any more :S)
ofc it doe's not have to be like that 1... as long as its 1 that works

Like this.
Code: [Select]
array = Random_stuff[actor_id]
# array then = [  [1,2],[2,6],[3,8],[4,10] ]
Then go from there.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Jackolas on April 13, 2010, 11:46:30 PM
got it already fixed Game_guy.
could not solve it one way so I approached the problem from an other side.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Valdred on April 14, 2010, 05:49:58 PM
charactor.animation_id = the animation id caractor is the charactor so say $game_player.animation_id = 1 would use the animation 1 on the player

edit: i think ruby doesn't like me how does @players.any? {|key, value| value.username == value.username} = false?

It's probably just me being stupid, but I'm not sure what you mean. I pasted the first one, it did nothing  :haha:.
Then I tried the second one, it crashed. Note that it's called from inside the Game_Player class.


EDIT: Just me being stupid as I said. Solved it.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on April 15, 2010, 03:20:18 AM
what would be the best way to see if a hash has changed
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: ForeverZer0 on April 15, 2010, 03:30:26 AM
Quote
what would be the best way to see if a hash has changed

Just make an event with the script call

Code: [Select]
p NAMEOFHASH[KEY]
That should work.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on April 15, 2010, 07:12:51 AM
not exactly what i ment i wanted to update somthing everytime the hash changed
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on April 15, 2010, 08:55:08 AM
Store a copy of the hash (via .clone) and compare it to the original. If they are not equal, the hash has changed. Store the new hash and execute your additional code.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on April 15, 2010, 02:53:22 PM
i tryed storing in a var but didn't use .clone i will try that

edit that worked thx

i have a new question im trying to open a store a defined class in an array but i keep getting a undefined method push for nil class before you ask yes i did turn my array into an array

Code: [Select]
def window(obj)
  s = obj.new
  window.push(s)
end
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Valdred on April 26, 2010, 04:33:15 PM
I have a little question. How do I read the name of an event? I know it's somewhere in the datafiles, and I have tried printing them to see if I find what I need. However, I did not find it. Anyone knows?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on April 27, 2010, 01:32:39 PM
if you want to read the name of an event use say $game_map.events[the id of the event].name
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on April 27, 2010, 02:01:54 PM
Won't work because Game_Event instances don't have name defined. The contained class RPG::Data_Event in Game_Event#event has the name.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Valdred on April 27, 2010, 04:30:59 PM
So, for example: $game_map.events[2].RPG::Data_Event.name
?

Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on April 27, 2010, 04:53:10 PM
I remember useing
Code: [Select]
$game_map.events[2].namebefore but if it doesn't work try this


Code: [Select]
$game_map.events[2].event.namebut in order for that to work you need
Code: [Select]
class Game_Event
  attr_reader    :event
end

to define access to the event's data
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Fantasist on April 28, 2010, 03:48:55 PM

i have a new question im trying to open a store a defined class in an array but i keep getting a undefined method push for nil class before you ask yes i did turn my array into an array

Code: [Select]
def window(obj)
  s = obj.new
  window.push(s)
end

So basically, what is window in window.push(s)? You didn't declare an array window. It should be something like:

Code: [Select]
@window = []
def window(obj)
  s = obj.new
  @window.push(s)
end

I'm guessing you will be using that method to call new windows and keep track of them?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on April 29, 2010, 01:40:44 AM
I need to know a better way to shorten this code. .__.
If possible of course.
Code: [Select]
    if mx > px
      if my > py
        tx = mx - px
        ty = my - py
        if tx > ty
          @direction = 6
        else
          @direction = 2
        end
      end
    end
    if mx < px
      if my < py
        tx = px - mx
        ty = py - my
        if tx > ty
          @direction = 4
        else
          @direction = 8
        end
      end
    end
    if mx > px
      if my < py
        tx = mx - px
        ty = py - my
        if tx > ty
          @direction = 6
        else
          @direction = 8
        end
      end
    end
    if mx < px
      if my > py
        tx = px - mx
        ty = my - py
        if tx < ty
          @direction = 2
        else
          @direction = 4
        end
      end
    end
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Aqua on April 29, 2010, 01:49:40 AM
You don't need to repeat mx > px & mx < px O.o
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on April 29, 2010, 01:56:01 AM
Thanks to Aqua I managed to cut off 4 lines. THanks ^^
Now to try and find a way to shorten it more.
Code: [Select]
    if mx > px
      if my > py
        tx = mx - px
        ty = my - py
        if tx > ty
          @direction = 6
        else
          @direction = 2
        end
      end
      if my < py
        tx = mx - px
        ty = py - my
        if tx > ty
          @direction = 6
        else
          @direction = 8
        end
      end
    end
    if mx < px
      if my < py
        tx = px - mx
        ty = py - my
        if tx > ty
          @direction = 4
        else
          @direction = 8
        end
      end
      if my > py
        tx = px - mx
        ty = my - py
        if tx < ty
          @direction = 2
        else
          @direction = 4
        end
      end
    end
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Aqua on April 29, 2010, 02:22:39 AM
You repeat tx = mx - px for the if mx > px & do the same for the ys in the y if
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: ForeverZer0 on April 29, 2010, 03:22:57 AM
Code: [Select]
       
        if tx > ty
          @direction = 6
        else
          @direction = 2
        end
You can shorten these this way:
Code: [Select]
@direction = (tx > ty ? 6 : 2)
Do that to all of them.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on April 29, 2010, 03:52:01 AM
Thanks FZ I knew that but I didn't think about using it. *lv's up aqua and FZ*
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on April 29, 2010, 01:24:59 PM
sorry i forgot to say i figured it out it was because i had @win becoming an array in def initialize but wasn't calling in with the super method so i moved it to main
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Jragyn on April 30, 2010, 09:17:54 AM
Please bear with me, I'm struggling to push myself to write some script, but...
Umm, the language of RGSS & RGSS2 is essentially...both Ruby, right?

So with that in mind, are these the same?
Code: [Select]
dropped_items = []
dropped_items << $data_items[i.item_id]
Code: [Select]
dropped_items = []
dropped_items.push($data_items[i.item_id])

I am trying to rip apart a script so I can understand scripting in general, better.
However, I am assuming the << is the .push() into the array of dropped_items?

Is there a better of these two? X_X
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on April 30, 2010, 04:02:59 PM
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
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on April 30, 2010, 06:03:02 PM
You're talking about <. << is an operator and when used on an array is does the same as push.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Valdred on May 05, 2010, 08:32:29 PM
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?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: ForeverZer0 on May 05, 2010, 11:38:57 PM
Quote
You 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.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on May 14, 2010, 05:50:15 AM
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.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on May 14, 2010, 06:53:29 AM
well for one thing you need the mysql.so file and include it or what ever. also if you get SciTE (http://www.scintilla.org/SciTE.html) 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.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on May 14, 2010, 08:31:59 AM
Check out RMXOS.rb and Data/Server.rb. And possibly Data/Client.rb
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Valdred on June 05, 2010, 06:56:36 PM
How do I set what page of an event is currently running?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Hellfire Dragon on June 06, 2010, 04:55:00 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.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Aqua on June 06, 2010, 05:06:58 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:
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on June 06, 2010, 05:09:15 PM
I sent him a script, and it'll do what he wants.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Hellfire Dragon on June 06, 2010, 06:14:39 PM
Thanks G_G

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:
Quote
That'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
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on June 21, 2010, 11:44:09 PM
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!
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on June 22, 2010, 12:27:46 AM
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 ?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on June 22, 2010, 01:34:00 AM
I'm not doing left, up, right, and down stuff. I'm using a whole 360 degrees.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on June 22, 2010, 01:43:29 AM
i was wondering about that
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: winkio on June 22, 2010, 01:56:26 AM
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 (http://en.wikipedia.org/wiki/Atan2)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on June 22, 2010, 02:05:25 AM
this also might help

(click to show/hide)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on July 15, 2010, 02:52:56 PM
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.
Code: [Select]
C:/Users/Ronnie/Documents/RPGXP/Project1
C:/Users/Ronnie/Documents/RPGXP/Project2

Then I have this.
Code: [Select]
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.
Code: [Select]
Invalid Argument - C:/Users/Ronnie/Documents/RPGXP/Project1Its referring to dir1, it doesnt do it for dir2 however. I'll comment this line
Code: [Select]
containts2 = Dir.new(dir1).entriesAnd my app will continue on just fine.

Help please :S
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Dragoon on August 14, 2010, 11:51:06 PM
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?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Hellfire Dragon on August 22, 2010, 12:35:01 AM
Anyone know if there's a way to continue to show the player's total experience after they reached the max level? I'm not using levels in my game but I'm using experience for something else. If you open the menu you can see "E   CURRENT_EXP/EXP_TO_NEXT_LEVEL" but when you reach the max level you see "E    ---/---"
I looked at the script and only found how to remove the "/EXP_TO_NEXT_LEVEL" part.

Any help would be appreciated :)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Sacred Nym on August 23, 2010, 06:38:14 PM
@Hellfire

In Game_Actor look for this code:
Code: [Select]
  def exp_s
    return @exp_list[@level+1] > 0 ? @exp.to_s : "-------"
  end
Replace or comment out the middle line and replace it with:
Code: [Select]
return @exp.to_s
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Hellfire Dragon on November 07, 2010, 02:01:02 AM
I'm a bit late but thanks Nym :) Another question, anyone know how to remove all skills from an actor?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: ForeverZer0 on November 07, 2010, 02:22:57 AM
Code: [Select]
(1...$data_skills.size).each {|i| $game_party.actors[ACTOR_INDEX].forget_skill(i) }

Can't remember if "forget_skill" is the correct method name. Look in the Game_Actor class and find something along them lines if it doesn't work.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Hellfire Dragon on November 07, 2010, 05:11:34 PM
That worked perfectly, ty Zer0 ;)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: ForeverZer0 on November 22, 2010, 07:29:30 PM
How can one make it so that a Graphics.transition affects more than the standard 640x480 window. I ask because it is the last thing I need to finish a Custom Resolution script I made, one that is about as Plug & Play as a script of this nature can be.

I kind of created a cheated method, using the screenshot.dll from the custom transitions script floating around the forum, but this is only good for a standard transition with a simple fade from one screen to another, not for using actual transitions in the game folder.

I already messed around trying to reset the default viewport size returned and about everything else, but apparently the graphic is not loaded like other bitmaps are. The script works perfect, but during transitions, only a 640x480 box is transition, then the rest will just instantly change when the transition is done.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on November 22, 2010, 09:45:30 PM
You will have to implement the transitioning manually. :/ I don't think there's a way to make it affect the whole screen just like that.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: ForeverZer0 on November 22, 2010, 10:10:35 PM
Damn. I figured. Just hoping I wouldn't have to...   :<_<:

EDIT:

Okay, these transitions are just straight pissing me off now. How exactly is the graphic used to get the effect seen on screen. I obviously don't mean the basics of the lighter/darker shades, etc, etc. I can't seem to get to work using a graphic, just the simple fade that you see if no transition name is passed as an argument. I do know the image is not loaded through the Bitmap class, which I image means it is using a function from the library I do not know about, but how can I achieve the same effect using Ruby?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on November 24, 2010, 09:45:17 PM
I was pretty sure that the graphic WAS loaded through the bitmap class and then bitmap.get pixel to get the color of a pixel and if it matched the color of gray it was transitioning that point in the loop it would do so.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: ForeverZer0 on November 24, 2010, 10:47:45 PM
I don't think. I tried aliasing Bitmap, Sprite, and Viewport to print the arguments passed to them before doing the normal thing, and nothing happened at all. No output when the graphics transitioned.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on November 24, 2010, 11:52:55 PM
It's a transitioning effect with using the transition image as alpha threshold map to determine the timing of the pixel transitions (but you know that). I don't think you can fake it in a quick/efficient way without having to edit the raw render engine (which you pretty much can't do). But there might be a way... If you used a similar way like the screenshot DLL does to get the screen caption and if you could force a transition manually over DirectX using that image combined with the black/white transition map, then it could work out. Of course, this would probably be more of a hassle than the end result would be worth. That would be the first thing to pop into my mind.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: ForeverZer0 on November 25, 2010, 12:02:01 AM
This may have to just be a sacrifice I have to make. I really wanted to maintain high compatibility and as little "pain-in-the-ass" as possible. Until this, the entire script, with the exception of window sizes etc. in scenes is plug & play. Like I said, I have the standard simple transition implemented well, but I may have to cut out the graphical ones, with the exception of course of the ones from th Transition Pack, since that is already the key for them working.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on December 31, 2010, 07:22:23 AM
How do you access special folders in ruby? e.g. AppData, current user, etc...
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: ForeverZer0 on December 31, 2010, 08:14:15 AM
How do you access special folders in ruby? e.g. AppData, current user, etc...

ENV['TEMP'] and ENV['TMP'] i do believe.
That's for the AppData.

Code: [Select]
file = File.open('ENV.txt', 'wb')
ENV.each_key {|key| file.write("#{key}\r\n  #{ENV[key]}\r\n\r\n") }
file.close

Use that to see what it all got.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on December 31, 2010, 11:46:53 AM
ProgramData is the Win 7 equivalent of Win XP's Application Data folder. Use ENV['ALLUSERSPROFILE'] for that. You should put application specific stuff such as savegames into that folder. Since v1.2 CP saves the games and screenshots into "%ALLUSERSPROFILE%/Stormtronics/Lexima Legends IV - Chaos Project/%USERNAME%".
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Dundora on January 06, 2011, 11:37:46 PM
I would like to know how i call the shop with a call script command, i tried "$scene = Scene_Shop.new" but it gives an error.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on January 06, 2011, 11:46:55 PM
You would also need to manually set up the shop items first.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Dundora on January 06, 2011, 11:48:48 PM
wow that was a fast reply, do i do that with a cal script to ? or can i just use the event.

how do i do that?:P
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on January 06, 2011, 11:54:41 PM
Yeah, I'm online right now so this can happen.

If you are calling the shop via script call, you probably want to use a script call here as well. First you need to call this:

Code: [Select]
$game_temp.shop_goods.clear
This makes sure the items from the last shop don't appear in the new one. Then use this template to add items into the shop:

Code: [Select]
$game_temp.shop_goods.push([TYPE, ID])
For TYPE you can use 0, 1 or 2 which is for item, weapon or armor respectively and the ID is the database ID of the item, weapon or armor.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Dundora on January 07, 2011, 12:01:35 AM
Oh ok, Thanks a bunch :D thats really helpfull :)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Dundora on January 07, 2011, 12:07:46 AM
Hmm, I just tested it, and it turns out im doing something wrong.

(click to show/hide)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on January 07, 2011, 12:22:33 AM
Code: [Select]
I'm not sure why you would want to, but here you go.

set up the shop goods
[code]
$game_temp.shop_goods = [
[0,1], [1,1], [2,1]
]
pattern goes
Code: [Select]
[TYPE,ID], [TYPE,ID], [TYPE,ID]where type is 0, 1 or 2 meaning item, weapon, or armor respectively and ID is the items id in the database.
then call the shop
Code: [Select]
$scene = Scene_Shop.new

EDIT: darn blizz beat me to the punch. ah well my example is slightly different[/code]
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Dundora on January 07, 2011, 12:26:27 AM
well i gues i shouldhv just said this in the first place, but i was hoping i could call it during batle,....why didnt i say that in the first place.....

anywya if i cant call it during a battle i gues ill need to find someone to make me a script.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on January 07, 2011, 12:34:20 AM
when you call Scene_Shop and you want to make it custom call it like this
$scene = Scene_Shop.new([[0,1]]) if you made that some kind of global variable could add to it when ever you wanted say using $game_variables[1] first you need to make it an array  $game_variables[1] = []
now you can just use $game_variables[1].push([0,1]) and call it like this $scene = Scene_Shop.new($game_variables[1]) that should work
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on January 07, 2011, 12:40:53 AM
when you call Scene_Shop and you want to make it custom call it like this
$scene = Scene_Shop.new([[0,1]]) if you made that some kind of global variable could add to it when ever you wanted say using $game_variables[1] first you need to make it an array  $game_variables[1] = []
now you can just use $game_variables[1].push([0,1]) and call it like this $scene = Scene_Shop.new($game_variables[1]) that should work

don't listen to him, Scene_Shop dose not take any arguments so this will only give you errors.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on January 07, 2011, 12:42:11 AM
use ryex's code it should work  :^_^':
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on January 07, 2011, 12:44:40 AM
And especially don't use $game_variables for that kind of thing.

If "$game_temp.shop_goods.clear" is giving you an error, use "$game_temp.shop_goods = []" instead.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on January 07, 2011, 12:48:35 AM
y not ? Does it really mater what use the $game_variables for ?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Dundora on January 07, 2011, 01:02:28 AM
Thanks all off you guys :D

after some tries i got it workign like this:
(click to show/hide)

now to see if i cn call this during battle.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on January 07, 2011, 09:21:24 AM
If you call it during battle, it will abort the battle and restart it after you return to the battle scene.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Dundora on January 07, 2011, 11:52:08 AM
Yeah your right, its alright though i already firgured somethign else out :)
thanks again.

Edit: i  now need an other piece of script thoug, i need one that makes the player use an item that is in the inventory without actually going to the menu, so its used when talking to an event for example.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on January 08, 2011, 09:18:56 PM
ok i using array.each{|word|text.gsub!("#{word}") {replace}} the only problem is i want it to remove the word no matter how its capitalized in the text 
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: ForeverZer0 on January 08, 2011, 09:53:16 PM
array.each{|word|text.downcase.gsub!("#{word}") {replace}}

Define the words as all lower case words.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on January 08, 2011, 10:10:42 PM
That won't work. The original text will never be modified but only the copy that gets returned by downcase.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on January 08, 2011, 10:26:34 PM
i figured out a way the entire word gets replaced so if crap is filtered fcrap gets replaced too but i can live with that because i added the non_filtered array to fix words so that you can put scrap
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: ForeverZer0 on January 08, 2011, 10:26:35 PM
That won't work. The original text will never be modified but only the copy that gets returned by downcase.

I didn't think of that. You ay have to go with Regular Expressions.
Do the old [Cc][Rr][Aa][Pp].
This is going to hamper performance a bit though, especially if it is checking for a lot of words.

Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on January 08, 2011, 10:46:42 PM
Actually it's a lot simpler than that. Use a regular expression with the word as exact sequence and just turn on the option for case insensitive. I'm not sure, but I think it was \i or /i. Check out Z's tute on regex.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: ForeverZer0 on January 08, 2011, 11:19:24 PM
Actually it's a lot simpler than that. Use a regular expression with the word as exact sequence and just turn on the option for case insensitive. I'm not sure, but I think it was \i or /i. Check out Z's tute on regex.

I figured there was an easier way than what I showed, but I couldn't remember. I never did memorize all the commands and syntaz of regexpr. I always just looked up what I needed for any given situation.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on January 08, 2011, 11:41:18 PM
I don't know all possibilities of regex by memory either. I know the general stuff and look up the details when I need them.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Zeriab on January 11, 2011, 10:25:32 PM
I don't remember either  :shy:
The reference part of my tut I actually wrote for myself. >_>

*hugs*
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on March 01, 2011, 05:50:58 AM
It wouldn't be too possible to have a console open and type in script calls and have it execute through RMXP would it? Or can it be done through win32api calls and stuff.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Aqua on March 01, 2011, 05:56:04 AM
RMX-OS's chat system handles script thingies...
Sooo maybe?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on March 01, 2011, 06:01:50 AM
fairly simple I should think. use Zer0's console script and try getting input from it.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on March 01, 2011, 06:02:10 AM
I meant like an actual console cmd per say.

@Ryex: I'll take a look at it
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Zeriab on March 01, 2011, 08:49:30 AM
The eval command makes it a matter of allowing text input and retrieving that. (Unless you want some sort of auto-complete like there is in cmd)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on March 01, 2011, 08:52:23 AM
well what I meant was I have a console open, (the command prompt) and you can type in script calls which then gets sent to the RGSS player which then gets executed.

Wait...I have an idea, is there anyway to copy and retrieve a class from the clipboard?
Code: [Select]
class EvalCmd
    attr_accessor :cmd
end
Maybe I can have the console create a new class, set the command, copy it to the clipboard, have rmxp retrieve it, execute the command, and clear the clipboard. Is that all possible?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on March 01, 2011, 09:37:15 AM
A way it could be done would be through a file.
You make a Ruby script that allows you to enter text all the time. Then you make it append the text each time to a file. Let RMXP repeatedly (every frame) check for the file. If the file isn't empty, it should executed what's inside and then empty it. You would only have to be careful about concurrent access. This is a rather dirty solution and I suggest you simply use a console script.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on March 01, 2011, 10:26:20 AM
ya as I said find out how to get input from the console and the use an eval in a begin except finally block. you might be able to figure out how to redirect standard input
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on March 01, 2011, 03:31:09 PM
Thanks guys, this'll be way cooler then a floating textbox in the middle of my screen F0 :V
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: ForeverZer0 on March 01, 2011, 07:09:07 PM
You should be able to fuse the console debugger and the script caller I wrote to solely use the console.

Link the console to stdin instead of it being stdout only. Then all you have to do is run an "eval" method on the line. I was going to do this originally, but if I remember correctly I was encountering a few issues. My knowledge of pointers, etc was in its infancy at the time. I ended up splitting them and just released both seperate scripts at the same time.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: KoenLemmen on March 20, 2011, 11:32:14 AM
Hi people,

I am new here on the forums.
I've got one question about RMX-OS script!
Is it possible to post your game on your server (a site NOT your own PC) and run it with your PC off.
PM me pleas. I need to find a way to run my online game without keeping my pc on the hole time!  :wacko:

Koen

PS Maybe I typ bad English I am dutch.  8)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: ForeverZer0 on March 20, 2011, 11:48:58 AM
Yes, its possible. You will likely need to pay a small amount for whatever company hosts it. I don't know any off-hand, but I'm sure google will help you out.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: KoenLemmen on March 20, 2011, 11:55:24 AM
Quick answer thanks!   :D
I know about the pay part.
I hope anybody still can help me with how to make my online game setup on a site and keep it running without having my PC on.
But thanks already!

Koen
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on March 20, 2011, 05:13:43 PM
Actually, I'm pretty sure its almost impossible, you'd need a host that runs Ruby. Not Ruby on Rails but Ruby.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: KoenLemmen on March 20, 2011, 05:14:35 PM
Hmm oke... Thats bad to know.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on April 16, 2011, 12:13:25 AM
Anyway to stop the blinking of the cursor? Ya know, that annoying flashing like effect the rectangle has when selecting choices.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: ForeverZer0 on April 16, 2011, 12:30:42 AM
Probably a little bit tricky, since it is in the hidden Window class. You can reference the cursor_rect from the class, but I don't know how that can really help you change the opacity. I think that the cursor is its own sprite, but is private to the class.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on April 16, 2011, 07:21:14 AM
Which effect would be better? Zooming the battle back so it fits? Or stretching it? Stretching of course is easier but I think zooming would be the nicer way to go. Plus I need help calculating this equation. I think I'm on the right track.

Code for Zoom
Code: [Select]
if width < 640
  sprite.zoom_x = 1.0 + width / 640
end
if height < 480
  sprite.zoom_y = 1.0 + height / 480
end
I think I'm on the right track but haven't had any real time to test it out.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: ForeverZer0 on April 16, 2011, 07:31:00 AM
Code: [Select]
sprite.zoom_x = 640.0 / sprite.bitmap.width
sprite.zoom_y = 480.0 / sprite.bitmap.height

I think that is all you should need.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on April 16, 2011, 09:47:45 AM
Anyway to stop the blinking of the cursor? Ya know, that annoying flashing like effect the rectangle has when selecting choices.

Set Window#active to false.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on April 21, 2011, 12:57:34 AM
What module is the method "raise" under? Same with "print"? Would like to make some modifications to the methods reguarding an error log system I have in plan.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: ForeverZer0 on April 21, 2011, 01:00:25 AM
They are both in the Kernel.
Just make methods outside of a class at top-level to change them.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on April 25, 2011, 04:37:38 AM
Thanks F0. Another question, when you run into a general error like
Undefined Method
No method "clear"
Does "raise" get called? This is very crucial to my logging and debugging system for beta testers. Any errors that occur would be saved into a log that they can just post and I can go and fix.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: ForeverZer0 on April 25, 2011, 05:08:38 AM
I believe so, but I can't say 100% sure. If you need to log errors, you simply need to keep an eye on one global variable: $!

This will be nil until an Exception is raised, then it will be the copy of that Exception, where you can log the message and backtrace information.
What I have done to log errors in Ruby is something simple like this:

In your entry point in Main where looping starts...
Code: [Select]
require 'script'
require 'another_script'

$program_started = true

begin
  while $program_started
    # Some type of loop
  end
rescue
  file = File.open('ErrorLog.txt', 'a+b')
  file.write(Time.now + "\r\n" + $!.message + "\r\n" + $!.backtrace)
  file.close
ensure
  # Anything you want to log or do no matter how it closes
end


EDIT:
Here, use these. They were invaluable to me when learning to script, and I still use them to look up various things.

Ruby 1.8.6 Documentation (http://dl.dropbox.com/u/20787370/Scripts/Ruby-1.8.6-core.chm), which I use when writing for RMXP.
Ruby 1.9.1 Documentation (http://dl.dropbox.com/u/20787370/Scripts/Ruby-1.9.1-core.chm), for every other time.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on April 25, 2011, 08:17:13 PM
Check out my mod of the main script in RMX-OS. I added a nice way of logging errors.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: LazyViking on May 24, 2011, 11:49:36 PM
Hi  :) i dont know if this is the rght place to post, but i'll take a dive  :P

My question Is as following: Is ruby scripting and RGSS two different things?

if yes: Do i need basic ruby knowlege to start RGSS scripting?


edit*: I forgot to add something: i have done a little bit of java, and then i used eclipse, is there a similar program for RGSS? :D


thank you for your time   :D


       -lazyV
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: ForeverZer0 on May 24, 2011, 11:54:30 PM
RGSS is the set of scripts that make RMXP what it is. It is basically a "framework" of a basic game, that can be built upon. They are written in Ruby, and use Ruby to execute.

And, no, you don't need to learn Ruby first. By learning to write code for RMXP, you are in fact learning Ruby. The actual Ruby language is much more expansive than what it used in RMXP, so in my opinion, it is actually easier to start with RGSS, and then built upon that knowledge to learn Ruby, though they each will allow you to learn the other.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: LazyViking on May 24, 2011, 11:56:59 PM
Thanks for the quick reply :)

and do i just use RMXP as my "eclipse" for RGSS coding? :P


         -lazyV
     
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: ForeverZer0 on May 25, 2011, 12:16:17 AM
Pretty much.

Although using an external IDE has a lot better features than the RMXP script editor, it is way too much of a hassle to be constantly porting the files back and forth for playtesting. It would be neat to create a little thing that actually read/writes the Scripts.rxdata from an external IDE, such as VS, Eclipse, or NetBeans.

* starts thinking of ways to accomplish this....
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: LazyViking on May 25, 2011, 12:41:43 AM
thank you so much for the answer :)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on May 25, 2011, 07:58:07 AM
Small correction: RGSS was made in C++, but it was interfaced with Ruby so the whole framework can be used with Ruby in RMXP.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on June 03, 2011, 09:47:22 AM
I've seen it done somewhere and I can't remember where I found the code. I basically want to create "events" when scripting. Events as in when x happens do y. Like .NET forms, when Form loaded, call this method. How would I go doing this?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on June 25, 2011, 03:10:51 AM
im trying to get the a map locations autotile bitmap location with the tile_id im making my own minimap and i got it to display all the maps graphics fine except for the autotiles i cant figure out how to get the location in the autotile graphic for the specific x,y
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on June 25, 2011, 03:24:39 AM
Take a look at this post here. Everything is explained in there.
http://forum.chaos-project.com/index.php/topic,9104.msg140240.html#msg140240
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on June 25, 2011, 01:43:58 PM
Explain this please. The 2 lines in Main.
Code: [Select]
filename = $!.message.sub("No such file or directory - ", "")
  print("Unable to find file #{filename}.")
I finally looked at it instead of glancing. I don't see the point in it really. To me it looks like their just making their own custom error message. Or is there a deeper meaning?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on June 25, 2011, 02:58:17 PM
their own custom error message.

This.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: nathmatt on June 25, 2011, 03:22:49 PM
@Blizzard thx worked perfectly

edit: never mind its messed up somewhere else
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: maniak on March 26, 2012, 01:52:04 AM
I want a script to recheck "Data/MapInfos.rvdata" when a game save is loaded. What would this look like?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: element on March 28, 2012, 10:48:23 AM
Hey guys, need some help with my first ever rgss script.

Basically I'm making a skill button combo system addon for Blizz-abs.
Everything works fine, but now I have come to the part where I need to unleash the skills.

I tried searching in Game_battleaction and in scene_battle and also in the blizz-abs scripts.
But I cant seem to figure out how to unleash a skill through a script command.

All that it needs to do is simply use a skill with blizz-abs.


Hope you guys can help :)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on April 07, 2012, 09:34:28 PM
I made a script "Ryex's Weapons Unleash skills" you can use the code there to lean if you want. I even made a BABS plugin for it so barrow away."
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: element on April 08, 2012, 12:45:33 AM
It was thanks to your script that I actually tried to script this :D
Though I still cant seem to figure out how you did it.
I'll try to look into it more though.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: KK20 on April 08, 2012, 01:39:30 AM
Have you forgotten your thread?  :huh:
http://forum.chaos-project.com/index.php/topic,11571.0.html (http://forum.chaos-project.com/index.php/topic,11571.0.html)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Calintz on April 15, 2012, 11:59:33 AM
i know that the majority of scripters at CP work with RGSS because of XP, but i have some general questions that i think would apply to all versions of the RGSS, and i am personally working with RGSS3. anyway, my first question is when you're working with windows, the arguments that you decide to implement on that window's initialization is completely up to you, right? depending on what kind of window you'd like to create?

def initialize (i'm talking about the values that go here)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on April 17, 2012, 03:22:55 PM
i know that the majority of scripters at CP work with RGSS because of XP, but i have some general questions that i think would apply to all versions of the RGSS, and i am personally working with RGSS3. anyway, my first question is when you're working with windows, the arguments that you decide to implement on that window's initialization is completely up to you, right? depending on what kind of window you'd like to create?

def initialize (i'm talking about the values that go here)

I merged your original topic with this one, since its more of a general topic already. As for your question, I don't really get what you're asking. If you're creating your own window, the arguments needed to pass are completely up to you. Just be sure that you use the "super" method and follow the parent classes arguments. Example...
Code: [Select]
class Window_MyWindow < Window_Base
  def initialize(arg1, arg2, etc...)
    super(x, y, width, height)
    # do your stuff here
  end
end
Whenever you have a class inherit another one, always remember to call its parent initialization method and use the proper arguments it comes with, if that makes any sense.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Calintz on April 18, 2012, 09:44:41 AM
that is okay, and yes, that was my question. thank you.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: bigace on February 25, 2013, 04:29:14 PM
How would you turn the actors name vertical instead of horizontal?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Ryex on February 25, 2013, 09:07:57 PM
you would have to invent a method to draw a name vertically.

here's some pseudo code not tested or guaranteed to work
Code: (ruby) [Select]
# set color, size, font-family before call
def draw_vertical_text(bitmap, text, x, y, align=0)
    y_off = 0
    text.each_char do |c|
        rect = bitmap.text_size(c)
        rect.x = x
        rect.y = y + y_off
        bitmap.draw_text(rect, c, align)
        y_off += rect.height
    end
end

if you get it to work I would like a screenshot just to see how it works
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: bigace on February 25, 2013, 09:28:35 PM
quick verify, this is done in bitmap right?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: KK20 on February 25, 2013, 10:08:48 PM
As in a method that should be added to the Bitmap class? From what I'm seeing, no. You could do that by removing 'bitmap' as a parameter and using 'self' in its place.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: bigace on March 13, 2013, 02:30:10 AM
quick question, is Does Game_Event have any effect on the player as I created a script that has two switches: One that stops the player and the other one to stop NPC's. I got the player one to just stop the player, but the one that stops the NPC stops the player as well. So back to the orignial question, Should what I've done to Game_Event effected the player.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: KK20 on March 13, 2013, 03:14:59 AM
Game_Player and Game_Event are both a subclass of Game_Character. From what I'm seeing, and guessing off of intuition, you might have made your "NPC stop switch" to apply to certain Game_Character traits, which in turn affects Game_Player.

You can always do something like
Code: [Select]
unless self.is_a?(Game_Player)
  #process code
end
within the Game_Character methods/whatever it is you changed.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: bigace on March 13, 2013, 08:31:41 AM
nope still didn't work,
 :facepalm: Nevermind, got it to work, I didn't realize the wait command was haulting the characters movements. :facepalm:
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: bigace on March 19, 2013, 12:16:56 AM
Okay so I've created a window that list all of the troops in the game. When you click on one of the troops how do you initiate a battle with said troops?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: KK20 on March 19, 2013, 01:13:27 AM
Weren't you able to accomplish something like this in your bestiary script?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: bigace on March 19, 2013, 01:19:35 AM
 :<_<: oh ya, I guess I'll adjust some settings.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: bigace on March 29, 2013, 01:32:32 AM
Anyone know how to change the text alignment for the help window in RMVXA. Unlike in XP/VX where it's obvious, Enterbrain decided to move/remove it.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: bigace on April 06, 2013, 08:49:25 AM
Anyone know how to change the text alignment for the help window in RMVXA. Unlike in XP/VX where it's obvious, Enterbrain decided to move/remove it.

Along with the previous question that which I'm bumping, has anyone ever figured out how to change the text message speed in RMXP and/or RMVXA? I was going have an option to change the text in RMXP for my option system and RMVXA for a game I'm making (slow, medium, fast).
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Zexion on April 06, 2013, 07:48:26 PM
Have you tried looking at an AMS to see how they do it? Dubealex AMS is the easiest to read for this.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Blizzard on April 06, 2013, 08:54:55 PM
@bigace: Find a window where the alignment is not set to left and you should be able to easily figure out how it's done.
As for the text speed, check the window class responsible for that and maybe its refresh method (I remember it being Window_Message in RMXP).
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: bigace on April 07, 2013, 12:04:28 AM
The problem with VXA is that it does all this confusing stuff inside of Window_Base, that finding where the alignment is almost impossible. I'll keep looking. As for the text speed in VXA, there is no refresh method in Window_Message and the only option that exist is the ability to instantly have the image appear, but nothing on its speed. I'll keep looking on XP though.

Edit:
Have you tried looking at an AMS to see how they do it? Dubealex AMS is the easiest to read for this.
Thanks for that, just notice that there was a speed function in there. Now just have to figure out how to configure into my option system?
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: KK20 on April 07, 2013, 08:42:58 PM
Without a message system script, there is no such thing as text speed in RMXP.

The alignment problem could be solved if the text wasn't drawn character-by-character.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: bigace on April 07, 2013, 09:07:31 PM
Without a message system script, there is no such thing as text speed in RMXP.

The alignment problem could be solved if the text wasn't drawn character-by-character.
Or VXAce for that matter, I guess I"ll have to make one.

I don't know why enterbrain did that but, until someone figures that out. The alignment is stuck that way. Or I guess I can just create a new help window.  :P
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: KK20 on April 07, 2013, 10:44:32 PM
You are aware RMXP just shows the entire message at once, not by character, right? Hence why I said it doesn't exist--it's not even possible to begin with :P I thought I got somewhere by using wait(int) in VXA, but the "Input C to display entire message" wasn't working.

Yeah, you have to make edits to the classes anyways. Alignment is only made through draw_text so you would have to manually add the parameter to the class methods.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: bigace on April 08, 2013, 03:37:04 AM
Ya the problem with the message script I'm having is that the game I'm remaking has a option in the menu like in Pokemon where you have three text speeds. Enterbrain does make things more difficult than they need to don't they.  :facepalm:

Edit: Pokemon Essential has a text speed option. However everything so confusing thats it's hard to work through and figure out how it works.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on April 12, 2013, 02:13:04 PM
Pokemon Essentials has it's own custom messaging system.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: bigace on April 12, 2013, 11:49:23 PM
Pokemon Essentials has it's own custom messaging system.
Ya I know I've already stated that in the post above yours.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: G_G on April 13, 2013, 12:01:54 AM
Sorry, I just misunderstood what you were saying. xD
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: bigace on May 16, 2013, 01:23:51 AM
what does "LocalJumpError occurred. no block given." mean? I was writing a script and got this when I tried to load the game from the title screen.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: KK20 on May 16, 2013, 01:50:59 AM
what does "LocalJumpError occurred. no block given." mean? I was writing a script and got this when I tried to load the game from the title screen.
A quick Google search says that it occurs when no block is given to a method that requires a block. What's a block? It looks like this
Code: [Select]
some_array.each {|array_element| do_some_stuff_here }
One of your methods is using 'yield' instead of 'return'.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: bigace on May 16, 2013, 04:55:31 AM
I have never used yield before so that's strange. I think I know what I need to rewrite though.
Title: RMXP Help
Post by: bigace on May 17, 2013, 10:23:22 AM
Okay well nothing seems to fix this issue. The error seems to stem from when I use this
Code: [Select]
24.times.max_by {|i| do_some_stuff_here(i) }
This is the code that gives the error from my save system script.

Code: [Select]
module ACE
module SaveManager
#--------------------------------------------------------------------------
# * Maximum Number of Save Files
#--------------------------------------------------------------------------
def self.savefile_max
return 24
end
#--------------------------------------------------------------------------
# * Get Update Date of Save File
#--------------------------------------------------------------------------
def self.savefile_time_stamp(index)
File.mtime(make_filename(index)) rescue Time.at(0)
end
#--------------------------------------------------------------------------
# * Get File Index with Latest Update Date
#--------------------------------------------------------------------------
def self.latest_savefile_index
savefile_max.times.max_by {|i| savefile_time_stamp(i) }
end
even if I do it the original way RMXP had it:
Code: [Select]
#--------------------------------------------------------------------------
# * Get File Index with Latest Update Date
#--------------------------------------------------------------------------
def self.latest_savefile_index
#savefile_max.times.max_by {|i| savefile_time_stamp(i) }
$game_temp = Game_Temp.new
# Timestamp selects new file
$game_temp.last_file_index = 0
latest_time = Time.at(0)
savefile_max.times.max_by do |i|
filename = make_filename(i)
if FileTest.exist?(filename)
file = File.open(filename, "r")
if file.mtime > latest_time
latest_time = file.mtime
$game_temp.last_file_index = i
end
file.close
end
end
end
I still get the same error, removing the max_by just puts the cursor at the bottom of the list instead of at the last updated save file.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: KK20 on May 17, 2013, 08:18:25 PM
Not to mention, the method 'max_by' doesn't even exist in Ruby 1.8.1, which I believe is the version RMXP uses.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: bigace on May 17, 2013, 08:31:07 PM
Not to mention, the method 'max_by' doesn't even exist in Ruby 1.8.1, which I believe is the version RMXP uses.
:facepalm: Wow, this whole time I've been looking at 1.8.7. Okay that explains why this doesn't work.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: Kiwa on January 02, 2014, 04:38:24 PM
Hey fellas.

since i've felt like such a piece of turd for always having to depend on you all for coding help. i have spent nearly every hour of my week vacation studying (i know its not a lot of time but it has truly helped) coding in RGSS.

i have discovered that the language is not so different than things i remember in other languages such as VB, Action script, and some C. but ...more simple.
but the real trouble i have in this language is finding what is threaded through other classes or modules and borrowed into the new one.

so in the end someing like...
actor  or game_actor and Game_Actors can be really confusing. the dot commands "self.content.font.size" can also be confusing... what is part of ruby or what is part of rmxp.

anyway thanks for listening to that rant. next is the question.



So im trying to make basic windows for a start. i've managed more or less. sizing, positioning, fonts, font size, ect... i managed to get icons aswell but i think i need to use another method if i want only icons and no text.. but for now the text way is what im looking for.

so what i want to add is attributes of the item. such as atk, str, pdef, ect.. to the text box
looking in the scripts i see alot of actor.str but thats not the item its self its the actors. looking at the code i would expect to see something like

ATKbonus = actorATK - EquipdWEP + NEWwep.
NewATK = actorATK + NEWwep.

or something.

but i find no such thing. only things like:
Code: [Select]
draw_actor_parameter(@actor, 4, 32, 0)
or
Code: [Select]
if @new_atk != nil
      self.contents.font.color = system_color
      self.contents.draw_text(160, 32, 40, 32, "->", 1)
      self.contents.font.color = color_choose(@actor.atk, @new_atk)
      self.contents.draw_text(200, 32, 36, 32, @new_atk.to_s, 2)

so how could i display lets say atk or str from the wep onto the display box?

here is what i have. please critique.

Code: [Select]
class Item_Window < Window_Base
   
  def initialize
    super(0,0,300,100)  #   taken from Window_Base:  super( x, y, width, height)
    actor = $game_actors[$activecharid]
    self.contents = Bitmap.new(width-32, height-32)
    self.contents.font.name = "Arial"
    self.contents.font.size = 24
    #self.contents.draw_text( 0, 0, 200, 32, "It's a trap")
    self.draw_item_name($data_weapons[1], 0, -5)
   
  end
 
end
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: KK20 on January 02, 2014, 07:12:31 PM
First tip: Read the Manual (F1). There's a good amount of help for learning Ruby syntax as well as hidden classes and methods you may not find in the default scripts.

Following that, you can see there's a RPG::Weapon class with the variable atk.
Code: [Select]
self.contents.draw_text(0, 0, 30, 24, $data_weapons[1].atk.to_s)
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: whitespirits on January 17, 2014, 08:52:16 PM
Hi all im running into a couple of problems on my RMX-OS game,

1st is that when I try to teleport to other maps using an event i just shoot to another spot on the same map?? I have no idea how or what to do to fix this!

2nd is that when i use RMXOS global variables and switches i get stuck on the receiving just after u login for example i see title screen and  receiving 17/17 and nothing happend?

please help thanks !
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: bigace on April 16, 2015, 02:43:27 AM
Engine: RGSS3

So i was trying to count the amount of files in the movie folder:

Code: [Select]
module ACE_Manger
def self.folder_size(dir)
Dir.glob(File.join(dir, '**', '*')).select { |file| File.file?(file) }.count
end
end

class Scene_Title
 alias :ace_start :start
def start
ace_start
puts ACE_Manger.folder_size("/Movies")
end
end

but when I start the game up it says I have 0 files in the folder when there is actually 4. However if I change the directory name to this:

Code: [Select]
class Scene_Title
 alias :ace_start :start
def start
ace_start
puts ACE_Manger.folder_size("D:/Dropbox/Last Bible I - Revelations The Demon Slayer/Game Mechanics/Title Scene/Movies")
end
end

Then the game will print that there is 4 files within the folder. Can anyone figure out why this happens.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: KK20 on April 16, 2015, 03:17:33 AM
How about not putting a forward slash and just do ("Movies")

EDIT: Confirmed. Heck, all I did was see how graphics were loaded into the cache. It goes ("Graphics/FOLDER").
Note that when you start with a forward slash, it looks into the local disk wherever your project is on. In your case, it was looking for D:\Movies.
Title: Re: General RGSS/RGSS2/RGSS3 Help
Post by: bigace on April 16, 2015, 04:46:08 AM
Thanks that does makes sense, I forgot that Graphics doesn't have the forwards slash in front of it.