In some IDEs it allows you to hover your mouse over a variable name in the code which creates a tooltip which contains the current value of that variable at run time.
Is this something that would be possible in AGS? It's damn usefull when debugging by stepping through the code.
@Calin: I think it would be enough to include a variable lookup table as part the debug ionfo and some functions that would allow them to be looked up by name and displayed at runtime. Anyone then could devise a debug gui that suited their particular needs.
It would be a bonus if the same could be done with functions. You know at runtime type in a function name and it's parameters and then execute it...
A lookup table would, of course, do the job perfectly well.
The only reason I suggested the tooltip is that i'd seen it done before and its very convenient to just hover the mouse over a variable since the variable you are interested in is likely to be in the function you are looking at when you break out of the game.
I asked for this several months ago, and someone told me that this will require many changes in script editor, or something like that.
I know it's a bit off-topic but the run-time scripting is possible via the LUA plugins (both editor and run-time plugins are required for this functionality AFAIK). I was actually also looking into providing some functionality for this via a script module but parsing scripts without regex support is annoying. :P I did get it so you could move the player around and display simple (non-formatted) messages from a textbox at run-time (using actual scripting methods). Might be easier to implement a limited set of methods via a simplified language but I'm too lazy to be bothered. ::)
@ontopic: CJ has said before that this is something he'd like to implement but IIRC he said it wasn't something he considered a high-priority due to the benefit-cost ratio.
The tried and true solution of an IDE based watcher would be very useful.
(http://www.ibm.com/developerworks/data/library/techarticle/dm-0707johnson/watch.jpg)
I've gone beyond display() values and made a simple UI that prints out what I want to any of the 6 UI slots I've set up. Some of the prints come from global repEx (like player XY) and some are placed in room specific repEx to get the data I need for that specific room. It's not elegant but it gets the job done.
One drawback is that you have to have debug prints placed in many different scripts when it comes to getting room specific values.
(http://img33.imageshack.us/img33/5820/crappywatch.jpg)
Using a debug gui is a pretty standard way of doing it but it cant give you value within a game loop since the label will only update at the end of every loop.
I thought about making a variable watcher thingy using the IDE plugin interface but im not sure if all the information is available to the plugin api... plus i suck at stuff like that.
That wouldn't work Calin because the variables don't have any value assigned until run-time. Although the script debugger allows the editor to inter-operate with the debug run-time EXE, there's no exposed methods in the plugin API to extend that functionality (of which I'm aware).
I think, without being 100% sure, that RickJ once created the BluBox, the ultimate AGS testbed or bead..?
I think it offered variables monitoring. It's not a bad suggestion, in fact sometimes I really wish for it when my game crashes, but I think Chris will take his chances with this later..
Quote from: monkey_05_06 on Wed 24/02/2010 22:15:29
That wouldn't work Calin because the variables don't have any value assigned until run-time. Although the script debugger allows the editor to inter-operate with the debug run-time EXE, there's no exposed methods in the plugin API to extend that functionality (of which I'm aware).
I kinda thought that would be the case.
Quote from: Calin Leafshade on Wed 24/02/2010 22:01:49
Using a debug gui is a pretty standard way of doing it but it cant give you value within a game loop since the label will only update at the end of every loop.
I get instant, accurate feedback on anything using this debug GUI. I just jam something like this command in wherever I need and it works great.
gDebugLabel3.Text = (String.Format("cupTrans = %d", oCupOverlay.Transparency));
That is what I was saying though, it's troublesome sometimes to sort through your scripts to clean out those debug prints when they can appear in any script, any loop, any function, anywhere.
Its not instant, Its at the end of that game loop.
Your method works fine for alot of things but would not work if you were stepping through a while loop for example.
Quote
I think, without being 100% sure, that RickJ once created the BluBox, the ultimate AGS testbed or bead..?
I created and released a very simple version. It used a predefined GUI and some extender functions that allowed one to easily define and pump data to the GUI via script commands.
I then made a much nicer and refined version where all the functions were defined in a module. But it was lost to the great bit bucket in the sky before I took the time to release a copy. That was about a1.5 years ago.
Since then I have recreated the enhanced version and refined it a little further. I'm still working on it and so haven't released it yet. But there is a copy available online of what I have so far. I have used it to test the MODOX module (Module Documentation Extractor) I am also working on. A new version of Modox is eminent, as soon as I document the templating language and make a ZIP it will be done.
Anyway you can download a working copy of BluBox from the modox link given in this thread:
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=39512.0
=================
The only draw back with this is that in order to watch a variable the script must be changed, compiled and tested. If it were possible to access a variable via a text string reference at runtime then it would be possible to make changes to the debug GUI without recompiling etc.
Calin's scenario is easily implemented with a pause instruction. I don't recall if BluBox currently has specific provisions for this. However, I think the AGS debugger allows one to single step through a loop and define break points. I do recall that implementing a "trap" Led Indicator function that turns on and stays on if the variable it is monitoring ever becomes non-zero.
[edit]
Is it possible to write a plugin that would allow runtime access to variables via a string reference?
I second both the variable monitoring via hovering and the watcher.
I can't count the number of times I put a breakpoint, breaked, and hover my mouse on a variable just to remember that AGS doesn't have this functionality yet... This would be very welcome indeed.
And while we're on the subject of useful things other IDEs have and AGS still doesn't have (AFAIK), are:
1. Search for a string in all the project, not just the selected file.
2. Search for all occurrences of a string in file/project.
3. Find all Usages/References for object/character/variable/etc.
Quote from: tzachs on Wed 24/02/2010 23:43:28
1. Search for a string in all the project, not just the selected file.
2. Search for all occurrences of a string in file/project.
3. Find all Usages/References for object/character/variable/etc.
Global searches would rock. Hovering is a total luxury, and I'm certain that's a much more involved implementation. Sure I'd love to have it too, but a watcher would serve the purpose on a more basic scale.
While we're making a wishlist, how about "Step Over" in the debugger!
Quote from: Calin Leafshade on Wed 24/02/2010 23:03:36
Its not instant, Its at the end of that game loop.
After stepping thru a while loop with a wait(1) command, I see what you mean. Definitely NOT instant.
By the way, my DeNGVaT/Ultravariables module does give you real-time variable tracking, but only on variables declared using the module, rather than built-in ones.
Yes a Watch window would be really useful, it has been requested before but is non-trivial to implement and is on the long list of things that I want to add to AGS when I get some time.