Author Topic: MODULE: DebugHelper - Set/get object/char/hotspot values at runtime  (Read 2159 times)

cat

  • Mittens Baronet
    • cat worked on one or more games that won an AGS Award!
    •  
    • cat worked on one or more games that was nominated for an AGS Award!
Use this module to read and set the values of objects, characters and hotspots while executing the game.

Press F12 and click on any object/character/hotspot to view the properties. You can even change some of them.
Or you can click a button and view a list of all characters and objects in the current room.



You need to import the script and the two GUIs to make this work. The GUIs will not import additional sprites so it's easy to delete afterwards.

This is an alpha version!

I plan to add regions too. I also consider implementing Setter methods so readonly properties can be used too (but lots of typing, please tell me if this would be really useful).
Any other suggestions?



Download latest version here (AGS 3.2.1 or higher required)

ADDED:
- Gui Controls
- Guis
- Inventory Items
- Now, you can tick away and back in, all the types from the drop down list
- Added transparency to the UIs


OLDER VERSIONS

Download Version 0.1 (AGS 3.2.1 or higher required)

« Last Edit: 29 Jul 2012, 12:57 by Dualnames »

monkey0506

  • SEND PIZZA.
    • Best Innovation Award Winner 2017, for his work to help AGS games reach the widest possible audience - through popular distribution platforms (Steam, Galaxy) as well as other operating systems (Android, Linux)
    • monkey0506 worked on one or more games that won an AGS Award!
    •  
    • monkey0506 worked on one or more games that was nominated for an AGS Award!
I also consider implementing Setter methods so readonly properties can be used too (but lots of typing, please tell me if this would be really useful).

Haven't checked it out yet, but I'm a bit confused by what you mean here... Just FYI, any readonly members of a struct cannot be modified in AGS. You'd have to make changes to the engine and/or the built-in script headers to change readonly properties (and every non-writable property of the built-in structures is readonly). If you meant instead that you wanted to provide readonly attributes or writeprotected members for your module's exposed script structure then that would make sense...

Edit: I was just looking over the code, and bloody hell cat, I have to commend you. Aside from Khris' code snippets he posts all the time, your code is one of the very few examples I can think of where I have seen another programmer's code actually maintaining consistent formatting (aside from cases of course where the IDE goes total dictator mode, like MSVC#).

One thing you might consider doing is adding a macro to your module. Something like:

Code: Adventure Game Studio
  1. // DebugHelper.ash
  2.  
  3. #define DEBUGHELPER_ENABLED
  4.  
  5. // DebugHelper.asc
  6.  
  7. #ifdef DEBUGHELPER_ENABLED
  8.  
  9. // YOUR MODULE SCRIPT HERE
  10.  
  11. #endif

That way instead of having to delete the module and both GUIs, all I have to do is comment out one line in the module header to disable debug mode for your module. It might not seem like a lot, but the less I have to do as the end-user to disable this for release, the better (less steps to remember, etc.).

Other than that I'd say it looks like you're off to a good start with this. :)
« Last Edit: 22 Jul 2012, 08:11 by monkey_05_06 »

cat

  • Mittens Baronet
    • cat worked on one or more games that won an AGS Award!
    •  
    • cat worked on one or more games that was nominated for an AGS Award!
Haven't checked it out yet, but I'm a bit confused by what you mean here... Just FYI, any readonly members of a struct cannot be modified in AGS. You'd have to make changes to the engine and/or the built-in script headers to change readonly properties (and every non-writable property of the built-in structures is readonly). If you meant instead that you wanted to provide readonly attributes or writeprotected members for your module's exposed script structure then that would make sense...
Actually I meant that some properties cannot be set directly (like Character.NormalView). I could call Character.ChangeView instead to set the value. Now I just ignore such properties.

Quote
Edit: I was just looking over the code, and bloody hell cat, I have to commend you. Aside from Khris' code snippets he posts all the time, your code is one of the very few examples I can think of where I have seen another programmer's code actually maintaining consistent formatting (aside from cases of course where the IDE goes total dictator mode, like MSVC#).

We have very strict coding guidelines at work, here I've been quite lazy (not a single line of comment :P)

Quote
One thing you might consider doing is adding a macro to your module. Something like:
...

Good idea. I also thought about checking game.debug_mode.

Quote
Other than that I'd say it looks like you're off to a good start with this. :)

Thanks! I hope this module is going to be useful to someone.

monkey0506

  • SEND PIZZA.
    • Best Innovation Award Winner 2017, for his work to help AGS games reach the widest possible audience - through popular distribution platforms (Steam, Galaxy) as well as other operating systems (Android, Linux)
    • monkey0506 worked on one or more games that won an AGS Award!
    •  
    • monkey0506 worked on one or more games that was nominated for an AGS Award!
Haven't checked it out yet, but I'm a bit confused by what you mean here... Just FYI, any readonly members of a struct cannot be modified in AGS. You'd have to make changes to the engine and/or the built-in script headers to change readonly properties (and every non-writable property of the built-in structures is readonly). If you meant instead that you wanted to provide readonly attributes or writeprotected members for your module's exposed script structure then that would make sense...

Actually I meant that some properties cannot be set directly (like Character.NormalView). I could call Character.ChangeView instead to set the value. Now I just ignore such properties.

Ahhh, yes, that makes perfect sense then. I'd say for completeness sake, you could consider it, but I wouldn't bother unless (until) someone actually says they want or need it. ;)

I hope this module is going to be useful to someone.

Yes, that's always the dream! :) I often wonder whether anyone actually makes any use of the time I've devoted to writing the modules (and other things) that I've authored. It's nice to hear someone mention that they're using it, but if I was doing it for the (individual) recognition then I'd honestly have to say that I've been doing it for the wrong reasons. :P I myself just enjoy coding, and the rest is just gravy/icing/[name your topping here].

tzachs

  • Parking Goat- games that goats like!
    • I can help with translating
    • tzachs worked on one or more games that won an AGS Award!
    •  
    • tzachs worked on one or more games that was nominated for an AGS Award!
Great module, very useful!  :)

Comments:
- This is similar in concept and execution to the God Mode module, with different functionalities that complement each other.
Perhaps joining forces to bring the ultimate debug tool?
- Your module only supports 320x200. My game is at 640x480 and everything looked very odd, I had to change sizes and alter the code that hides/shows the UI. The best thing to do is have the UI dynamically change sizes and its inner control based on the game resolution. An alternative would be having multiple GUIs for import (that's how it works in the god module).
- Instead of checking game.debug_mode you can go with #ifdef DEBUG (not a big deal, but slightly better since less code actually gets compiled when it's not in debug, I think).
- Maybe add GUIs to the list of items?
- I'm thinking there should be a master list with Characters, Objects, Hotspots, GUIs, etc, and each will lead to the appropriate list of items. Maybe not needed for smaller games, but my game has a lot of items and it's hard to navigate.
- Maybe also adding a search box could help with the navigation.
- I used with your module along with the god mode module. It gave me the ability to drag your GUIs around and put them where I wanted too, so I could see both of them in the same time. It then became very annoying that every time I selected a character the list gets hidden and I have to click on it again to show it.
- Maybe adding a bit of transparency to the GUI so that you could see what lies beneath it.

Dualnames

  • Local Moderator
  • Pretty Badass
    • Dualnames worked on one or more games that won an AGS Award!
    •  
    • Dualnames worked on one or more games that was nominated for an AGS Award!
I hope I'm not intrusive, but I bothered working on this a bit. So, this is an unofficial version, if cat is not okay with this, i have no problem removing it.

http://duals.agser.me/Files/DebugHelperv02.rar

ADDED:
- Gui Controls
- Guis
- Inventory Items
- Now, you can tick away and back in, all the types from the drop down list
- Added transparency to the UIs
No more military army stuff. I'm alive and back.

cat

  • Mittens Baronet
    • cat worked on one or more games that won an AGS Award!
    •  
    • cat worked on one or more games that was nominated for an AGS Award!
Thanks for you comments, tzachs and Dualnames!
tzachs: I'm not familiar with the God Module, can you link it for me? Dualnames already mentioned in the chat that different sizes depending on the resolution would be needed. Now that there are two people who want that I guess I should do it  ;)
I'll think about the navigational things - do you really have that many characters and objects per room?
Dualnames: Great that you worked on that! I'll take a look at it in the evening.

tzachs

  • Parking Goat- games that goats like!
    • I can help with translating
    • tzachs worked on one or more games that won an AGS Award!
    •  
    • tzachs worked on one or more games that was nominated for an AGS Award!
I'm not familiar with the God Module, can you link it for me?
God Mode

I'll think about the navigational things - do you really have that many characters and objects per room?
Oh, yes!
AGS Footballer has two teams, each with 11 footballers. Currently each footballer has 2 characters, one for himself and one for his shadow.
This already counts for 44 characters.
Now add to that the fact that I'm currently working on splitting each footballer to about ~5 characters so that I could compose more kinds of footballers, I will go berserk without a search box...


cat

  • Mittens Baronet
    • cat worked on one or more games that won an AGS Award!
    •  
    • cat worked on one or more games that was nominated for an AGS Award!
Sorry for not replying earlier. The new additions are great Dualnames, there is mayby just some cleanup on the Gui needed. Let's declare your version the new official one?

Dualnames

  • Local Moderator
  • Pretty Badass
    • Dualnames worked on one or more games that won an AGS Award!
    •  
    • Dualnames worked on one or more games that was nominated for an AGS Award!
Alright, edited the first post to reflect that.
No more military army stuff. I'm alive and back.