General RGSS/RGSS2/RGSS3 Help

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

Previous topic - Next topic

samsonite789

Quote from: Fantasist on November 16, 2009, 01:58:57 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!

G_G

November 16, 2009, 11:16:33 pm #341 Last Edit: November 16, 2009, 11:20:18 pm by game_guy
@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

nathmatt

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


SorceressKyrsty

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.
The sound of a bubble popping.

Jackolas

November 21, 2009, 09:38:04 am #344 Last Edit: November 21, 2009, 11:14:54 am by Jackolas
out the top of my head
can be wrong tough because I'm no scripter :P

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:
@Name_window = Window_Battlernames.new


and under "# Dispose of windows" add
@Name_window.dispose


and under "# Update windows" add
@Name_window.update

G_G


Ryex

I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Blizzard

Works for sprites only, not for bitmaps.
Check out Daygames and our games:

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


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

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

Holyrapid

May i take a guess? bitmap.angle = value
Am i right? Have i learned anything about scripting?

Blizzard

No, it doesn't work for bitmaps. using .angle or .angle= on a bitmap will cause an undefined method for Bitmap class error.
Check out Daygames and our games:

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


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

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

Ryex

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?
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Blizzard

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.
Check out Daygames and our games:

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


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

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

G_G

How do we detect if a variable is a string?

Blizzard

Check out Daygames and our games:

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


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

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

G_G

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
variable.is_a?(Array)

Not sure about the others though

Blizzard

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
Check out Daygames and our games:

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


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

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

Ryex

in short you can tell if a object is an instance of any class with

object.is_a?(Class)


also

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

object.instance_of?(Class)


method is slightly different in that it only returns true if it is a direct instance of Class

ie.


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

I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

G_G

Question. How do I, if possible, alias a method between the method. That made no sense.
Example:
So example here's some code.
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.
Class Test
  def main
    stuff_here
    other_stuff_here
    more_stuff_here
  end
end

Is it possible to accomplish that by aliasing?

Blizzard

Not possible. Aliasing goes before or after and you can't put it in between.
Check out Daygames and our games:

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


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

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

G_G

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?