Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
  • 0
Sign in to follow this  
Kadyaknight

Scripting Tutorial Problem

Question

Alright, so I know just shy of nothing about scripting, and so I'm trying to learn some stuff. I'm currently looking/working this tutorial:

CMS Tutorial

 

I followed the instructions and got the window to appear, with the text, but when trying to add the cancel at: "Lesson 3 - Adding Controls to your Scene"

it keeps giving me an error (SyntaxError) on line 46 in my " Scene_ShowWindow " when launching the game.

 

#==============================================================================
# * Scene_ShowWindow
#==============================================================================

class Scene_ShowWindow
 #--------------------------------------------------------------------------
 # * Main Processing
 #--------------------------------------------------------------------------
 def main
   #call the window
   @window = MyCustomWindow.new
   # Execute transition
   Graphics.transition
   # Main loop
   loop do
     # Update game screen
     Graphics.update
     # Update input information
     Input.update
     # Frame update
     update
     # Abort loop if screen is changed
     if $scene != self
       break
    end
   end
   # Prepare for transition
   Graphics.freeze
   # Dispose of windows
   @window.dispose
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
   # Update windows
   @window.update
   # If B button was pressed
   if Input.trigger?(Input::B)
     # Play cancel SE
     $game_system.se_play($data_system.cancel_se)
     # Switch to Menu screen
     $scene = Scene_Menu.new
     return
   end
 end

 

Sorry for such a noobish problem, but help would be greatly appreciated.

Share this post


Link to post
Share on other sites

8 answers to this question

Recommended Posts

  • 0

Alright, so I know just shy of nothing about scripting, and so I'm trying to learn some stuff. I'm currently looking/working this tutorial:

CMS Tutorial

 

I followed the instructions and got the window to appear, with the text, but when trying to add the cancel at: "Lesson 3 - Adding Controls to your Scene"

it keeps giving me an error (SyntaxError) on line 46 in my " Scene_ShowWindow " when launching the game.

 

Sorry for such a noobish problem, but help would be greatly appreciated.

 

Did you copy and replace the "def update" section with the one provided in the tutorial? That might be a part of the problem.

For other people who know more about scripts than me, posting the section or line of code that is giving you trouble (ie. 46)

can help them to figure out what went wrong, if they decide to help. :)

Share this post


Link to post
Share on other sites
  • 0

Did you copy and replace the "def update" section with the one provided in the tutorial? That might be a part of the problem.

For other people who know more about scripts than me, posting the section or line of code that is giving you trouble (ie. 46)

can help them to figure out what went wrong, if they decide to help. :)

 

Yes I did replace it, that's when it gives me the error. Without that bit it ends on line 39 and works to create the box with text.

Oh right, forgot about that, I'll edit the first post to show the script.

Share this post


Link to post
Share on other sites
  • 0

Okay, try this and let me know how it works out.

 

 

 

#==============================================================================
# * Scene_ShowWindow
#==============================================================================

class Scene_ShowWindow
 #--------------------------------------------------------------------------
 # * Main Processing
 #--------------------------------------------------------------------------
 def main
   #call the window
   @window = MyCustomwindow.new
   # Execute transition
   Graphics.transition
   # Main loop
   loop do
     # Update game screen
     Graphics.update
     # Update input information
     Input.update
     # Frame update
     update
     # Abort loop if screen is changed
     if $scene != self
       break
    end
   end
   # Prepare for transition
   Graphics.freeze
   # Dispose of windows
   @window.dispose
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
   # Update windows
   @window.update
   # If B button was pressed
   if Input.trigger?(Input::B)
     # Play cancel SE
     $game_system.se_play($data_system.cancel_se)
     # Switch to Menu screen
     $scene = Scene_Menu.new
     return
   end
 end
end

 

 

 

Also, Im pretty sure this needs to be in there somewhere, just not sure.

 

 

 

     if $scene != self
       break
     end
   end

 

 

 

Anyone else got any ideas? I'm completely new to scripting myself.

Share this post


Link to post
Share on other sites
  • 0

Okay, try this and let me know how it works out.

 

 

 

#==============================================================================
# * Scene_ShowWindow
#==============================================================================

class Scene_ShowWindow
 #--------------------------------------------------------------------------
 # * Main Processing
 #--------------------------------------------------------------------------
 def main
   #call the window
   @window = MyCustomwindow.new
   # Execute transition
   Graphics.transition
   # Main loop
   loop do
     # Update game screen
     Graphics.update
     # Update input information
     Input.update
     # Frame update
     update
     # Abort loop if screen is changed
     if $scene != self
       break
    end
   end
   # Prepare for transition
   Graphics.freeze
   # Dispose of windows
   @window.dispose
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
   # Update windows
   @window.update
   # If B button was pressed
   if Input.trigger?(Input::B)
     # Play cancel SE
     $game_system.se_play($data_system.cancel_se)
     # Switch to Menu screen
     $scene = Scene_Menu.new
     return
   end
 end
end

 

 

 

Also, Im pretty sure this needs to be in there somewhere, just not sure.

 

 

 

     if $scene != self
       break
     end
   end

 

 

 

Anyone else got any ideas? I'm completely new to scripting myself.

 

 

I tried your version, the extra end on line 47 allows the game to launch, however it gives another error when activating the item/window scene.

Error is as follows:

Script 'Scene_ShowWindow' line11 NameError occured.

uninitialized constant Scene_ShowWindow::MyCustomWindow

 

 

As for the

     if $scene != self
       break
     end
   end

I don't know if thats supposed to be in again, I'ts already on lines 23-26 and according to the tut, will still work because of the

$scene = Scene_Menu.new

on line 43.

Share this post


Link to post
Share on other sites
  • 0

Hmm.. yeah, doesnt look like the break part of it needs to be in there another time.

I cant figure out the Scene_ShowWindow line 11 problem though. Seems like its having

trouble initializing the whole thing, but I know next to nothing about what to do about it.

Sorry I couldnt help you more.

Share this post


Link to post
Share on other sites
  • 0

I'ts not a huge deal, I just wanted to do the tut correctly so I'd learn it right.

Anyways, thanks for your help.

Share this post


Link to post
Share on other sites
  • 0

Thanks Marked, I'll let you know how it turns out.

 

Well, I don't know what it is, but I'ts not working, thanks though.

 

{EDIT!} Woot It's working now, I'm not sure what it is, I'm going to carefully examine what the difference is so that we know how to get it right. I think that the new version had something different, then I tacked on the extra end that totalsticks tried for the old one, and now it works.

 

I found it, the version that totalsticks gave me, the one with the extra end was actually right, aside from one capitalization.

his line 11 read like this: @window = MyCustomwindow.new

It needed to have the Capital W in Window

 

Anyways, thanks totalsticks, Marked, for helping me solve this Problem.

 

Lol, I just found the reason his version didn't have the capital W, something to do with the formatting of the way posting a code turns out, it changed the W to a w, wierd.

 

All you have to do to the code is make sure line 11 has those caps.

 

Working Scene_ShowWindow

 

#==============================================================================
# * Scene_ShowWindow
#==============================================================================

class Scene_ShowWindow
 #--------------------------------------------------------------------------
 # * Main Processing
 #--------------------------------------------------------------------------
 def main
   #call the window
   @window = MyCustomWindow.new
   # Execute transition
   Graphics.transition
   # Main loop
   loop do
     # Update game screen
     Graphics.update
     # Update input information
     Input.update
     # Frame update
     update
     # Abort loop if screen is changed
     if $scene != self
       break
    end
   end
   # Prepare for transition
   Graphics.freeze
   # Dispose of windows
   @window.dispose
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
   # Update windows
   @window.update
   # If B button was pressed
   if Input.trigger?(Input::B)
     # Play cancel SE
     $game_system.se_play($data_system.cancel_se)
     # Switch to Menu screen
     $scene = Scene_Menu.new
     return
   end
 end
end

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...