Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

4 Pages V  < 1 2 3 4 >  
Reply to this topicStart new topic
> [Scripting][Series]RGSS: Windows - Lesson 1: An Introduction to Windows
Daldraeic
post Feb 25 2008, 10:06 PM
Post #41



Group Icon

Group: Member
Posts: 4
Type: None
RM Skill: Undisclosed




[Show/Hide] My first RGSS lesson.


I tried to make two windows but ran into a problem...
I tried renaming the "class Window_First" part on one of them to "class Window_Second" both in their own separate scripts at different coordinates. It worked fine except after a couple seconds one of the windows disappears on its own. How do I fix this?
Go to the top of the page
 
+Quote Post
   
ccoa
post Feb 25 2008, 10:20 PM
Post #42


Storm Goddess
Group Icon

Group: Revolutionary
Posts: 989
Type: Scripter
RM Skill: Masterful




QUOTE (S_n_a_k_e @ Feb 21 2008, 02:09 PM) *
Nice tutorial (Y)

i have a question.. if you would want to remove the window, when you press a button, lets say C, how would you script that? ^^
If you wouldn't want to wait 80 frames and then the window is removed automaticlly, but make it so that the player can press a button to remove it himself..

i hope you understand what i mean ^^
Thx.


Well, if you wanted to do it through events like this, you could add a parallel process that listens for a button press and dispose the window when it's found. However, the better way would probably be to build it into the scene.


QUOTE (Daldraeic @ Feb 25 2008, 10:13 PM) *
[Show/Hide] My first RGSS lesson.


I tried to make two windows but ran into a problem...
I tried renaming the "class Window_First" part on one of them to "class Window_Second" both in their own separate scripts at different coordinates. It worked fine except after a couple seconds one of the windows disappears on its own. How do I fix this?


I'm not sure what the problem is. I'd have to see what you're doing.


__________________________
Go to the top of the page
 
+Quote Post
   
Daldraeic
post Feb 25 2008, 10:51 PM
Post #43



Group Icon

Group: Member
Posts: 4
Type: None
RM Skill: Undisclosed




First Window...
CODE
class Window_First < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(384, 224, 256, 256)
self.contents = Bitmap.new(width - 32, height - 32)

refresh
end

#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear

self.contents.draw_text(0, 0, 256, 32, "A B C D E F G H I J K L M")
self.contents.draw_text(0, 25, 256, 32, "N O P Q R S T U V W X Y")
self.contents.draw_text(0, 50, 222, 32, "1", 1)
self.contents.draw_text(0, 75, 222, 32, "2", 2)
self.contents.draw_text(0, 100, 256, 32, "0", 0)
self.contents.draw_text(0, 125, 256, 32, "I used 25 height spacing")
self.contents.draw_text(0, 150, 256, 32, "for each line.")
self.contents.draw_text(0, 200, 256, 32, "...oh and Z.")
end
end


And second...
CODE
class Window_Second < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 256, 256)
self.contents = Bitmap.new(width - 32, height - 32)

refresh
end

#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear

self.contents.draw_text(0, 0, 256, 32, "test")
end
end


they are each in their own part in the script editor, I wouldn't know how or if I should put them in the same one. If theres anything else you need to know let me know.

Oh and, if it matters, the way I brought them up was
CODE
$window = Window_First.new;
$window = Window_Second.new

I tried putting them in separate events, but it didn't change anything. Its always the lower right (first) one that disappears.

This post has been edited by Daldraeic: Feb 25 2008, 10:55 PM
Go to the top of the page
 
+Quote Post
   
ccoa
post Feb 26 2008, 06:14 AM
Post #44


Storm Goddess
Group Icon

Group: Revolutionary
Posts: 989
Type: Scripter
RM Skill: Masterful




It's because you named the variables exactly the same thing. If you assign a variable a new value, the old one will be garbage collected (removed), because there's no longer any references to it.

Try naming the second variable $window2.


__________________________
Go to the top of the page
 
+Quote Post
   
Daldraeic
post Feb 26 2008, 03:04 PM
Post #45



Group Icon

Group: Member
Posts: 4
Type: None
RM Skill: Undisclosed




I see. Thank you. Yeah lots of monday details with this stuff I suppose laugh.gif
Go to the top of the page
 
+Quote Post
   
S_n_a_k_e
post Feb 27 2008, 10:07 AM
Post #46



Group Icon

Group: Member
Posts: 4
Type: Scripter
RM Skill: Beginner




QUOTE
Well, if you wanted to do it through events like this, you could add a parallel process that listens for a button press and dispose the window when it's found. However, the better way would probably be to build it into the scene.


yeah, i would like to build it into the scene, but i can't quite figure out how to do it. huh.gif
If it's not to much, can you please show me how to do it? rolleyes.gif

Thanks
//Gando
Go to the top of the page
 
+Quote Post
   
ccoa
post Feb 27 2008, 10:54 AM
Post #47


Storm Goddess
Group Icon

Group: Revolutionary
Posts: 989
Type: Scripter
RM Skill: Masterful




That's planned on being part of the next lesson (selectable and command windows), which I'm hoping to have done by Friday. If it's not done Friday, it will probably not be ready until Wednesday of next week.


__________________________
Go to the top of the page
 
+Quote Post
   
S_n_a_k_e
post Feb 27 2008, 12:46 PM
Post #48



Group Icon

Group: Member
Posts: 4
Type: Scripter
RM Skill: Beginner




Okaay, that sounds good, thanks ^^
Go to the top of the page
 
+Quote Post
   
Someonation
post Mar 5 2008, 08:01 AM
Post #49


Level 8
Group Icon

Group: Revolutionary
Posts: 111
Type: None
RM Skill: Beginner




Wait i have a question.....
you said that
CODE
self.contents = Bitmap.new(width - 32, height - 32

is for text and images.....so how do i put an image?

This post has been edited by Someonation: Mar 5 2008, 08:04 AM
Go to the top of the page
 
+Quote Post
   
HeroOfHyla
post Mar 8 2008, 10:46 PM
Post #50


Twirling towards freedom
Group Icon

Group: +Gold Member
Posts: 2,791
Type: Scripter
RM Skill: Advanced




What would I need to change in this to make it RGSS2 compatible? I'm getting a blank window.

CODE
class Window_First < Window_Base
  def initialize
    super(0, 0, 256, 96)
    self.contents = Bitmap.new(width - 32, height - 32)
  end
  def refresh
    self.contents.clear
    
    self.contents.draw_text(0, 0, 256, "Hello World")
  end
end


It's just the original code from the tutorial pretty much, but uncommented.


__________________________
Asexual - Arizonan - Atheist
I've got a gmail account and a yahoo mail account under this name, if you need to contact me.
You can find me on facebook too. facebook.com/heroofhyla . If you send me a friend request, tell me who you are so I don't get confused.

PlagueRPG SITE IS WORKING! (if you see "test page," hit ctrl+f5)
Latest update: New battle system demo, April 19, 2010

http://heroofhyla.deviantart.com/ ----- http://heroofhyla.livejournal.com/ ----- http://thatonecomic.smackjeeves.com
Go to the top of the page
 
+Quote Post
   
storymasterq
post Mar 9 2008, 12:17 AM
Post #51


Level 7
Group Icon

Group: Member
Posts: 91
Type: Developer
RM Skill: Skilled




I think you need to call refresh from inside initialize as well.

Cheers,
SQ


__________________________
Current Skills: Writing(Str) Lv. 4, Writing(Evt) Lv. 4, Scripting Lv. 3, Mapping Lv. 1, Spriting Lv. 0, Composing Lv. 0
Currently expanding: Scripting
[Show/Hide] My Personality

QUOTE (Arthur C. Clarke)
We have to abandon the idea that schooling is something restricted to youth. How can it be, in a world where half the things a man knows at 20 are no longer true at 40 - and half the things he knows at 40 hadn't been discovered when he was 20? (link)
Go to the top of the page
 
+Quote Post
   
HeroOfHyla
post Mar 9 2008, 09:03 AM
Post #52


Twirling towards freedom
Group Icon

Group: +Gold Member
Posts: 2,791
Type: Scripter
RM Skill: Advanced




QUOTE (storymasterq @ Mar 9 2008, 12:24 AM) *
I think you need to call refresh from inside initialize as well.

Cheers,
SQ



Well call me a monkey's uncle. It worked. Thanks a lot for your help.


__________________________
Asexual - Arizonan - Atheist
I've got a gmail account and a yahoo mail account under this name, if you need to contact me.
You can find me on facebook too. facebook.com/heroofhyla . If you send me a friend request, tell me who you are so I don't get confused.

PlagueRPG SITE IS WORKING! (if you see "test page," hit ctrl+f5)
Latest update: New battle system demo, April 19, 2010

http://heroofhyla.deviantart.com/ ----- http://heroofhyla.livejournal.com/ ----- http://thatonecomic.smackjeeves.com
Go to the top of the page
 
+Quote Post
   
LOD
post Mar 17 2008, 07:20 AM
Post #53


Level 3
Group Icon

Group: Member
Posts: 34
Type: Writer
RM Skill: Intermediate




dammit what happened? i followed all the steps by copying the scripting and all i get is a message of error saying that an error ocurred on Window_First!


__________________________
" The entire world is a script. The problem is that God is a mapper."

Go to the top of the page
 
+Quote Post
   
storymasterq
post Mar 17 2008, 07:43 AM
Post #54


Level 7
Group Icon

Group: Member
Posts: 91
Type: Developer
RM Skill: Skilled




QUOTE (LOD @ Mar 17 2008, 09:27 PM) *
dammit what happened? i followed all the steps by copying the scripting and all i get is a message of error saying that an error ocurred on Window_First!


Can you be specific and tell us what the error was?

Cheers,
SQ


__________________________
Current Skills: Writing(Str) Lv. 4, Writing(Evt) Lv. 4, Scripting Lv. 3, Mapping Lv. 1, Spriting Lv. 0, Composing Lv. 0
Currently expanding: Scripting
[Show/Hide] My Personality

QUOTE (Arthur C. Clarke)
We have to abandon the idea that schooling is something restricted to youth. How can it be, in a world where half the things a man knows at 20 are no longer true at 40 - and half the things he knows at 40 hadn't been discovered when he was 20? (link)
Go to the top of the page
 
+Quote Post
   
Fieryarts
post Apr 11 2008, 04:17 PM
Post #55



Group Icon

Group: Member
Posts: 2
Type: None
RM Skill: Undisclosed




QUOTE (LOD @ Mar 17 2008, 09:34 AM) *
dammit what happened? i followed all the steps by copying the scripting and all i get is a message of error saying that an error ocurred on Window_First!


You placed the script in the wrong area.. notice in the left pane where Window_Base is located? If your script is above that, then the call to it as a super will not work. Best to move your scripts down to the section called Materials, where the ( Insert here ) is at.
Go to the top of the page
 
+Quote Post
   
Tenchu-San
post Jun 2 2008, 12:30 AM
Post #56


Scribe & Defender of RRR.
Group Icon

Group: Revolutionary
Posts: 265
Type: Developer
RM Skill: Skilled




Okay, I've managed to tinker around with this on VX but I can only manage to make a window that says something that I've already put in the script menu. I'm totally lost as to figuring out how to call a window through an event and input what it says in there. Halp!

Mainly because I don't want to have to make a script page for EVERY time the player completes a Quest Objective ^^;


__________________________

I'm not arrogant, I'm confident.
"Only the wicked shall fear my blade, for the grace of God shall defend the innocent from my wrath."
^ A quote that popped into my head during a hot summer night.
Come visit my devblog for my RMVX project: Exile of the Sun. Or check out the Topic here at RRR!
[Show/Hide] Genius, pure genius.

Go to the top of the page
 
+Quote Post
   
woratana
post Jun 2 2008, 12:41 AM
Post #57


Looking for scripter to hire? PM me *O*
Group Icon

Group: +Gold Member
Posts: 1,038
Type: Scripter
RM Skill: Undisclosed




You can create new window with Window_Base by call script biggrin.gif

CODE
$win = Window_Base.new(x, y, width, height)


__________________________
Check out my NEW blog!!!



MVP (Most Valuable Poster) Award 2008


Go to the top of the page
 
+Quote Post
   
Tenchu-San
post Jun 2 2008, 12:51 AM
Post #58


Scribe & Defender of RRR.
Group Icon

Group: Revolutionary
Posts: 265
Type: Developer
RM Skill: Skilled




When I try to use that (and put in values) it says:

QUOTE
Script 'Window_Base' line 45: RGSSError occurred.

failed to create bitmap


Syntax is so confusing @_@

Oh! I must have put in bad values, because when I tried some of the values that the other people used, I got a window! Now to move on to figuring out how to put text in it o.o!!


__________________________

I'm not arrogant, I'm confident.
"Only the wicked shall fear my blade, for the grace of God shall defend the innocent from my wrath."
^ A quote that popped into my head during a hot summer night.
Come visit my devblog for my RMVX project: Exile of the Sun. Or check out the Topic here at RRR!
[Show/Hide] Genius, pure genius.

Go to the top of the page
 
+Quote Post
   
woratana
post Jun 2 2008, 02:52 PM
Post #59


Looking for scripter to hire? PM me *O*
Group Icon

Group: +Gold Member
Posts: 1,038
Type: Scripter
RM Skill: Undisclosed




You may want to check my script called 'Character Textbox', that may give you an idea about that. smile.gif


__________________________
Check out my NEW blog!!!



MVP (Most Valuable Poster) Award 2008


Go to the top of the page
 
+Quote Post
   
Tenchu-San
post Jun 2 2008, 02:55 PM
Post #60


Scribe & Defender of RRR.
Group Icon

Group: Revolutionary
Posts: 265
Type: Developer
RM Skill: Skilled




I'll definitely do that! Thanks a lot for your help biggrin.gif


__________________________

I'm not arrogant, I'm confident.
"Only the wicked shall fear my blade, for the grace of God shall defend the innocent from my wrath."
^ A quote that popped into my head during a hot summer night.
Come visit my devblog for my RMVX project: Exile of the Sun. Or check out the Topic here at RRR!
[Show/Hide] Genius, pure genius.

Go to the top of the page
 
+Quote Post
   

4 Pages V  < 1 2 3 4 >
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 18th May 2013 - 10:20 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker