Error handling in VBScript /Error in Simple Menu Plugin

This forum is meant for requesting technical support or reporting bugs.

Moderators: time-killer-games, Vengeance66, Candle, reneuend, GM-Support

Error handling in VBScript /Error in Simple Menu Plugin

Postby tribalxdude » Wed Nov 02, 2005 1:10 am

One of the basic elements to VB or any language is the ability to handle exceptions. I redesigned the Simple Menu Plug-in by eliminating the static buttons and allow the user to load an image from the Hotspot images path (4). The thing work wonderfully until I wrote a script to go to another frame. Then I get:

Message Box : ?Control Array element (1) does not exists?

Then Adventure Maker goes to the intended frame

I thought that I may have made a mistake and then I tested the original Simple Menu Plug-in and discovered it also suffered from the same error when using the action.gotoframe (?Name?)

I went back to VB6 and added Error handling to the OCX. Then commenced to write error handlers in the procedures. When Click Apply I don?t get yelled at for

On Error resume next

But do get a nasty message box when I use:

On error goto err
?code
Err:
Exit sub


Even with the ?On error resume next? I still throw the same exception ?

?Control Array element (1) does not exists?

This happens in both controls my menu plug-in and the Simple-Menu Plug-in downloaded from www.adventuremaker.com

Is error handling in the VB Script engine not included? If not why.

It would certainly be a determining factor in my decision to buy the commercial edition.
stuffs getting better, stuffs getting better everyday.
tribalxdude
Member
 
Posts: 38
Joined: Sat Jun 12, 2004 3:58 am

Error not in Simple Menu Control

Postby tribalxdude » Wed Nov 02, 2005 3:07 am

Sorry, but I think it has to do with the frame that the action.gotoframe is pointing not part of the runtime merging. Error handling would be nice.

So, every frame has to have the runtime merging?
stuffs getting better, stuffs getting better everyday.
tribalxdude
Member
 
Posts: 38
Joined: Sat Jun 12, 2004 3:58 am

Merged frames got me

Postby tribalxdude » Wed Nov 02, 2005 3:32 am

I figured out I was calling the texbox of a merged frame from a procedure where there was no merged frame. fixed it.

Anyway if anyone wants a version of the Simple Menu That load images dynamically I'll send it to GM

I had:

Code: Select all
sub CheckStats()
   If PC_HP <=0 Then
 
'bad move      
Action.GoToFrame "Dead",0.8,1
      
   
      StrBuffer="Astrial" & vbcrlf
      strBuffer=StrBuffer & "Life: " & PC_HP & vbcrlf
      strBuffer=StrBuffer & "Armor: " & PC_HR & vbcrlf
      strBuffer=StrBuffer & "Damage: " & PC_Dam & vbcrlf
      strBuffer=StrBuffer & "Gold: " & PC_Gold & vbcrlf
      strBuffer=StrBuffer & vbcrlf
      strBuffer=StrBuffer & "Strength: " & PC_STR & vbcrlf
      strBuffer=StrBuffer & "Intellegence: " & PC_Int & vbcrlf
      strBuffer=StrBuffer & "Dexterity: " & PC_Dex & vbcrlf
      strBuffer=StrBuffer & vbcrlf
      strBuffer=StrBuffer & "Weapon: " & PC_Weapon & vbcrlf
      strBuffer=StrBuffer & "Armor: " & PC_Armor & vbcrlf
      strBuffer=StrBuffer & vbcrlf
      strBuffer=StrBuffer & "Frame : " & GetCurrentFrameName() & vbcrlf

      
'no textbox
      i = Action.GetMergedTextIndex
      Text(i).Caption=strbuffer
   End If

   
End Sub


FIX:

Code: Select all
sub CheckStats()
   If PC_HP <=0 Then
      Action.GoToFrame "Dead",0.8,1
      Exit Sub
   Else
      StrBuffer="Astrial" & vbcrlf
      strBuffer=StrBuffer & "Life: " & PC_HP & vbcrlf
      strBuffer=StrBuffer & "Armor: " & PC_HR & vbcrlf
      strBuffer=StrBuffer & "Damage: " & PC_Dam & vbcrlf
      strBuffer=StrBuffer & "Gold: " & PC_Gold & vbcrlf
      strBuffer=StrBuffer & vbcrlf
      strBuffer=StrBuffer & "Strength: " & PC_STR & vbcrlf
      strBuffer=StrBuffer & "Intellegence: " & PC_Int & vbcrlf
      strBuffer=StrBuffer & "Dexterity: " & PC_Dex & vbcrlf
      strBuffer=StrBuffer & vbcrlf
      strBuffer=StrBuffer & "Weapon: " & PC_Weapon & vbcrlf
      strBuffer=StrBuffer & "Armor: " & PC_Armor & vbcrlf
      strBuffer=StrBuffer & vbcrlf
      strBuffer=StrBuffer & "Frame : " & GetCurrentFrameName() & vbcrlf

      

      i = Action.GetMergedTextIndex
      Text(i).Caption=strbuffer
   End If

   
End Sub
stuffs getting better, stuffs getting better everyday.
tribalxdude
Member
 
Posts: 38
Joined: Sat Jun 12, 2004 3:58 am

Postby Imari » Wed Nov 02, 2005 7:46 pm

Hi Tribalxdude,
This sounds very interesting, and your example looks as though you may even be using AM for some sort of RPG (?!). Could you please give an example for how this might be used. I'm no coder, so it's hard for me to understand unless I have an example.
Thanks.
~C
User avatar
Imari
VIP
 
Posts: 872
Joined: Fri Jun 20, 2003 4:49 pm
Location: Virginia, USA

Adventures In Adventure Making

Postby tribalxdude » Wed Nov 02, 2005 9:48 pm

Sure. I was a avid d&d player when I was a kid and now my kids want me to make a game for them in Adventure Maker. I thought long and hard about how to approach this. Adventure maker is a great program but does not allow for much code design freedom because of the lack of code implementation (the language is very limited and no OOP (would be killer if we had classes), ability to call the main sound mixer, or dll support).

I have not coded in VB6 since 2001 (Because of the release of VB.Net) and have to re-learn the language to use Adventure Maker.

Don?t get me wrong I love the program.

Anyway, Using adventure maker I have learned that it?s power is in it?s frames. You can use them for video (Adventure maker lacks power here as well) or conditional statements.

I don?t like to spend 400 hours rendering images so I decided to make the game like the old D&D games with a top view map that you travel and areas that are mixed with 2d, 3d perspective and isometric renderings. Kind of a mix of all. There is no need for characters that move just an image of them. Let the player use their imagination a little.

I thought long and hard how to create a battle system and though I have not tested it I think it will work fairly well for my purposes.

Make a folder in the frames explorer and call it ?Ogre? find a nice picture of a d&d miniature online and apply virtual painter to it or you can render some images of the monster attacking or what ever. Use a variable that stores the name of the frame the PC came from and send him to the ogre frames. Use the Ogre frames to your advantage.

The first frame could have the fight, run, use magic .

If your press the fight hotspot run a script to determine initiative then send the PC to the proper frame (Monsters turn or PC?s turn).

Whatever frame write a script that handles the turn then automatically adjust: If the PC is dead send him to the dead frame, If he missed send him to the missed frame, If he hit send him to the hit frame where damage is calculated, and if the PC Killed the monster send him to the awards frame then send him back to where he was.


Same with Dexterity: If there is a place where the PC has to climb. Check his dexterity and send him to the appropriate frame. 1-He fell , 2-he made it.

It takes a lot of frames but like I said Adventure Maker?s Real power is in the use of it?s frames to pass judgment.

Many time I thought I had to write a bunch of code and then found out later that if I had made 10 frames to handle whatever I was doing it ran better.

The PC_HP and other variables are just to store the players stats.

Sorry it was so long.

if you are into top view I used a 3x3 800x600 grid in PSP to produce these images:

Image
Image
stuffs getting better, stuffs getting better everyday.
tribalxdude
Member
 
Posts: 38
Joined: Sat Jun 12, 2004 3:58 am

Postby Imari » Thu Nov 03, 2005 12:59 am

Okay, I understand now. What a clever use of AM!

I really like your screens, wonderful textures and nice color schemes. Nice that you're doing it for your children too. (Currently my son is keeping me busy making skydomes and textures for a 3D RPG game that he's trying to make. :P )
User avatar
Imari
VIP
 
Posts: 872
Joined: Fri Jun 20, 2003 4:49 pm
Location: Virginia, USA


Return to Adventure Maker Technical Support and Bug Reports

Who is online

Users browsing this forum: No registered users and 0 guests