Author Topic: General RGSS/RGSS2/RGSS3 Help  (Read 111634 times)

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6585
  • LV: 407
  • Gender: Male
    • View Profile
General RGSS/RGSS2/RGSS3 Help
« 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.
« Last Edit: April 17, 2012, 03:16:01 PM by game_guy »

Offline Landith

  • Astral Trancist
  • *****
  • Posts: 947
  • LV: 59
  • Gender: Male
    • View Profile
Re: General RGSS/RGSS2/RGSS3 Help
« Reply #1 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

Offline Fantasist

  • Lexima Warrior
  • *******
  • Posts: 2222
  • LV: 146
  • Gender: Male
    • View Profile
    • Blog
Re: General RGSS/RGSS2/RGSS3 Help
« Reply #2 on: March 04, 2009, 02:06:39 PM »
How's your update method like? Could you post it?
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)

The best of freeware reviews: Gizmo's Freeware Reviews



Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6585
  • LV: 407
  • Gender: Male
    • View Profile
Re: General RGSS/RGSS2/RGSS3 Help
« Reply #3 on: March 04, 2009, 04:34:27 PM »
(click to show/hide)

(click to show/hide)

Offline Fantasist

  • Lexima Warrior
  • *******
  • Posts: 2222
  • LV: 146
  • Gender: Male
    • View Profile
    • Blog
Re: General RGSS/RGSS2/RGSS3 Help
« Reply #4 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
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)

The best of freeware reviews: Gizmo's Freeware Reviews



Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19929
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: General RGSS/RGSS2/RGSS3 Help
« Reply #5 on: March 04, 2009, 04:50:26 PM »
Code: [Select]
    if @coordinate.visible
      update_coordinate
    end

Optimized. :P
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


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

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

Offline fugibo

  • World Conqueror
  • Chaos User
  • ******
  • Posts: 1966
  • LV: 44
    • View Profile
Re: General RGSS/RGSS2/RGSS3 Help
« Reply #6 on: March 04, 2009, 06:41:34 PM »
Ha. Both of ya is wrong.

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

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 19929
  • LV: 642
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: General RGSS/RGSS2/RGSS3 Help
« Reply #7 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.
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


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

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

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6585
  • LV: 407
  • Gender: Male
    • View Profile
Re: General RGSS/RGSS2/RGSS3 Help
« Reply #8 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.

Offline Tazero

  • Blows jobs for custom titles
  • Chaos User
  • ******
  • Posts: 1179
  • LV: -45
  • Gender: Male
  • Asleep but flying high
    • View Profile
Re: General RGSS/RGSS2/RGSS3 Help
« Reply #9 on: March 05, 2009, 01:32:39 AM »
Should 2 &'s be there?


If you were a fish...

Offline fugibo

  • World Conqueror
  • Chaos User
  • ******
  • Posts: 1966
  • LV: 44
    • View Profile
Re: General RGSS/RGSS2/RGSS3 Help
« Reply #10 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.

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6585
  • LV: 407
  • Gender: Male
    • View Profile
Re: General RGSS/RGSS2/RGSS3 Help
« Reply #11 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.

« Last Edit: March 05, 2009, 02:30:14 AM by game_guy »

Offline fugibo

  • World Conqueror
  • Chaos User
  • ******
  • Posts: 1966
  • LV: 44
    • View Profile
Re: General RGSS/RGSS2/RGSS3 Help
« Reply #12 on: March 05, 2009, 04:37:36 AM »
What folder is the picture in?

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6585
  • LV: 407
  • Gender: Male
    • View Profile
Re: General RGSS/RGSS2/RGSS3 Help
« Reply #13 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?

Offline winkio

  • Epiq
  • Administrator
  • Guardian of Chaos
  • *****
  • Posts: 4506
  • LV: 199
  • Gender: Male
  • I am lying.
    • View Profile
Re: General RGSS/RGSS2/RGSS3 Help
« Reply #14 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...

Offline fugibo

  • World Conqueror
  • Chaos User
  • ******
  • Posts: 1966
  • LV: 44
    • View Profile
Re: General RGSS/RGSS2/RGSS3 Help
« Reply #15 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)

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6585
  • LV: 407
  • Gender: Male
    • View Profile
Re: General RGSS/RGSS2/RGSS3 Help
« Reply #16 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.
« Last Edit: March 05, 2009, 05:52:09 AM by game_guy »

Offline fugibo

  • World Conqueror
  • Chaos User
  • ******
  • Posts: 1966
  • LV: 44
    • View Profile
Re: General RGSS/RGSS2/RGSS3 Help
« Reply #17 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.

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6585
  • LV: 407
  • Gender: Male
    • View Profile
Re: General RGSS/RGSS2/RGSS3 Help
« Reply #18 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

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6585
  • LV: 407
  • Gender: Male
    • View Profile
Re: General RGSS/RGSS2/RGSS3 Help
« Reply #19 on: March 14, 2009, 06:58:10 AM »
*bump*