Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Help with something new

You need AVI Movie Player. I made a script called Helper. It looks in yourgame/Movies folder to see if there is an avi file. If Helper can find it says "true" if not it says "false". It helps out to see if you made a mistake in the code or you don’t have the avi file. I want to add more to Helper to make it a class but I don’t know what to add, and how to add the updates. I want it to be well a helper. So it will help newbie’s like me. Could some one help? Thanks, Charles D.

Here is my script.
Past this above main:

Code:
module ScriptCall

def self.print_messages1
   # Show Message enabled determinant
   # Check if Intro.avi exist
   # If enabled, make @showmessage_enabled true; if disabled, make it false
   p "Does Intro.avi exist?"
   @showmessage_enabled = false
   if FileTest.exist?("Movies/Intro.avi")
     @showmessage_enabled = true
   end
   # If Show Message is enabled, print yes
   # If Show Message is disabeld, print no
   if @showmessage_enabled
     p "Yes!"
   else
     p "No!"
   end
   end
   end

To call it make a new event and us the script command and past this:

Code:
ScriptCall.print_messages1
 

Nava

Member

you shouldt have the # signs those make the game skip over those parts of the script means that they dont do anything. I dont kno if you meant to put them there or not
dont understand what you are trying to ask is there a question or are you just posting your script where its not suppsed to be?
 

Tdata

Sponsor

I'm guessing you want to create an error handling system?

Nava:
We use # to place comments explaining our scripts to end-users. It helps to clarify the script.
 
Yes I do want to create an error handling system. I put the "#" for notes so other can add to the script or rip some parts out. Just makes it easier to find things in a full script. I want to add more to helper so it can do more than just tell you if the avi file is there or not. Like when you get an error. I want helper to tell the person what they mite need to change to fix the problem.
 

Nava

Member

if you want your scritp to do that its gonna be like 100x longer than what you have there because, if you think about it there are soo many diff things that coud come up as a problem in the game that there is gonna be more script than you might want to create. i mean think about it, that a lot of script!!! but dont get me wrong im not trying to discourage you im just tellin you the facts :) good luck on your script!
 
I just started thinking about that after I posted. I think I mite be going ahead of myself. I want to change print into a message window without the whit out line. Kind of like in the beginning of a game with the press start. All you see is press start and the background. That’s the first thing I need help with. Thanks for getting me on track, Charles D.
 
I don't really see the point in all of that why not just use Exception Handling

an example
Code:
begin
  {3 => 5,, 4=> 7}
rescue SyntaxError
  print("Hash was setup incorrectly")
end

Code:
begin
 code here
rescue <Exception Object>
 code here
end

but I really don't see the point of scripting something like that, unless you are reading data from some outside source
 
I mean something like this:

Code:
def initialize
   super(0, 0, 160, 96)
   self.contents = Bitmap.new(width - 32, height - 32)
   self.contents.draw_text(x, y, width, height, text)
   refresh
 end
But i cant get it to work. Do you know how?
 
Please Use the Edit button and do not double post

An Exception is thrown when an error occurs. Division by Zero, File Not Found, Undefined Method, SyntaxErrors are just a few of errors that can occur. Each error has its own Exception class for example Syntax Errors exception class is SyntaxError, Division by Zero is ZeroDivisionError, File Not Found is Errno::ENOENT

if the begin statement is running and a Exception is thrown and if a rescue clause was given it will try to trap the Exception if no Exception class was given in the rescue statement then it will try to catch all subclasses in the StandardError class (see RMXP help file for more information) if the Exception was caught then it will except the statements after the rescue statement

in my previous example the Syntax Error in the hash was caught and the line
Hash was setup incorrectly was printed
 

Nava

Member

Im willing to help anytime with anything i can just ask and ill tell you if i kan help! lol but dont be dissapointed if i dont kno how to do it all. and could you explain your question again? im not sure i understand what you are trying to do this time.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top