MODULE: UltraVariables (formerly DeNGVaT) v1.10

Started by SSH, Tue 12/12/2006 17:48:08

Previous topic - Next topic

SSH

UltraVariables? Well, it gives you named global variables, that you don't need to worry about importing/exporting, etc. and that you can "alias" to a normal numbered AGS globalint and thereby set through dialog scripts, interaction editor, etc.

It also has named timers, like the AGS ones but as many as you like and with a memorable name.

It also has a debug GUI for these, which will also hopefully do more debug stuff too in future (see below for some suggestions).

UltraVariablesdocumentation
Download UltraVariableshere
DeNGVaT wiki page

Requires AGS 3.00

use the old DeNGVat 1.01 if you want to use AGS 2.72

12

RickJ

SSH, sounds like a good idea. 

  • How about adding the ability to modify and/or force values.   I guess the "modify" function is self explanatory.  The "force" function is similar to modify except that a forced value would not be overwritten.  So if you had a value being calculated in the script and written to a global int and then you forced it to a particular value, the script would no longer be able to overwrite and the forced value. The forced value would be retained until the force was removed.

  • How about adding the ability to add or remove individual variables from an on-screen display.  Possibly implemented using an overlay or gui.   

  • How about an on-screen display of mouse coordinates.  Perhaps if the mosue button was held down and the cursor moved then the display could show delta-x and delta-y.

  • How about a debug mouse mode where a right or center click would popup a display of the properties of the item under the cursor.  And wouldn't it be sweet if you could be able to select and modify said properties? 


    That's all I can think of now!   ;D

Rui 'Trovatore' Pires

I adore both SSH's original idea and RickJ's suggestion. I furthermore suggest that it would be an excellent module to pack alongside AGS, maybe as a part of any of the two templates it comes with. I add to this that I know I'm thinking too far ahead. I conclude I am ahead of my time.
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

SSH

Bump, to let you see the first cut of the module is out...
12

monkey0506

Named Timers huh? Oh well. I guess you got around to implementing infinity billion possible timers before I did. Good for you. :P

[EDIT:]

Waaaaiiiiiit a second....I actually took a look at the module's internals...and with the default settings you can only have up to 200 of these named timers. Increasing that may or may not even be possible (depending on how much memory other things use, I didn't look at it too extensively)...but...you clearly state "as many as you like". You LIEEEEE!!!! ;D I'm only making a big deal because your claims inspired me to write the Timer v2.0 module (which I'll be uploading shortly). Which does allow as many timers as you want! 8)

~Cheers

EnterTheStory (aka tolworthy)

Forgive the extremely stupid noob question, but...

how do I declare a new DeNGVaT-controlled string (or int) in the first place?

I can see the functions for getting and setting existing strings, but nothing for creating the string. I tried just setting a string in the hopes that it might be created automatically, but that wouldn't compile. Sorry for being so dense!

SSH

That should be how it works. What error did you get? Remember you need to put quotes around the names...
12

EnterTheStory (aka tolworthy)

Quote from: SSH on Sat 08/03/2008 09:59:29
Remember you need to put quotes around the names...

Ah...

now where is the icon for "extremely embarassed" or "hits head against brick wall"?

Fantastic module, BTW

EnterTheStory (aka tolworthy)

#8
DeNGVaT is fantastic! A real godsend. Thanks!

But I think I may have found a bug. I've tested this code on two different games (it goes in the keypress section) and it does the same weird stuff on both.

It's much simpler than it looks. I just save the string "rrrr1" or "cccc1" in a global called "woman and child_r1" or "woman and child_c1." Then reload and resave a few times. The second part (Ctrl-U) is identical to the first part (Ctrl-T) except that 'c' and 'r' have been swapped round.

Code: ags

	if (keycode==20) {														// Ctrl-T, test, temporary			
									
		Display("saving message called 'woman and child_c1' containing 'cccc1'");
		Global.Sets("woman and child_c1", "cccc1"); 
		
		String t = Global.Gets("woman and child_c1"); 
		Display("contents of 'woman and child_c1' is now '%s'", t);
		
		t = Global.Gets("woman and child_c1"); 
		Display("contents (again) of 'woman and child_c1' is now '%s'", t);
		
		Display("saving message called 'woman and child_r1' containing 'rrrr1'");
		Global.Sets("woman and child_r1", "rrrr1"); 
		
		t = Global.Gets("woman and child_r1"); 
		Display("contents of 'woman and child_r1' is now '%s'", t);
		
		t = Global.Gets("woman and child_c1"); 
		Display("contents of 'woman and child_c1' is now '%s'", t);		
		
		t = Global.Gets("woman and child_r1"); 
		Display("contents (once more) of 'woman and child_r1' is now '%s'", t);
		
									}									
	if (keycode==21) {														// Ctrl-U, another test, temporary			
									
		Display("saving message called 'woman and child_r1' containing 'rrrr1'");
		Global.Sets("woman and child_r1", "rrrr1"); 
		
		String t = Global.Gets("woman and child_r1"); 
		Display("contents of 'woman and child_r1' is now '%s'", t);
		
		t = Global.Gets("woman and child_r1"); 
		Display("contents (again) of 'woman and child_r1' is now '%s'", t);
		
		Display("saving message called 'woman and child_c1' containing 'cccc1'");
		Global.Sets("woman and child_c1", "cccc1"); 
		
		t = Global.Gets("woman and child_c1"); 
		Display("contents of 'woman and child_c1' is now '%s'", t);
		
		t = Global.Gets("woman and child_r1"); 
		Display("contents of 'woman and child_r1' is now '%s'", t);		// ********** now returns (null) ************
		
		t = Global.Gets("woman and child_c1"); 
		Display("contents (once more) of 'woman and child_c1' is now '%s'", t);
		
									}									


Ctrl-U returns a null bug if it is run first.

Ctrl-T works perfectly every time.

Ctrl-U works perfectly if Ctrl-T is run first.

Any idea what is happening here? I am guessing that this has something to do with the length of the strings? And DeNGVaT is scared of the letter 'r' for some reason? SSH did you have an old girlfriend who's name started with 'r' by any chance? :)

SSH

Ah, thanks for finding this. I missed a line out of the insertion code...

You can change in the module script:
Code: ags

	    this.name[i]=this.name[j];
	    this.val[i]=this.val[j];


to:

Code: ags

	    this.name[i]=this.name[j];
	    this.val[i]=this.val[j];
	    this.str[i]=this.str[j];


at around line 38. Or remove the module, download v1.01 and put that in (which comes to the same thing).

12

EnterTheStory (aka tolworthy)

Thanks! And sorry for giving such a long piece of code. I just narrowed it down to just a couple of lines, then came to upload the new code and you've already fixed it! Thanks again!

Rui 'Trovatore' Pires

Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

SSH

hajo hasn't restored my server yet. Go shout at him...  :(
12

EnterTheStory (aka tolworthy)

I've been using DangVIT/dungVET/DengXiouPing/WhAtEvEr for a week now and it is AWESOME!!! Far more useful than I ever imagined. My game is based on large amounts of dialog, and I've got to the stage of coding the endless conversations and "if-then" choices. DoNgVoTe is the only way to make my code usable. I can take anything complicated, give it a meaningfully named alias, and just shove it into its own function. Without DeNeroVT my code would be utterly unreadable and unmaintainable. Thanks, SSH!

EnterTheStory (aka tolworthy)

How fast is DeNGVaT? Does anyone have real-world experience of using thousands of DeNGVaT global strings? I'm thinking of rewriting my code so that around a thousand DeNGVaYT strings are assigned when the game starts, and some mouse clicks instantly search several hundred DeNGVaT strings. Is this likely to affect performance? Any ideas?

SSH

If you hit performance problems, I could probably write some code that loads initial values for a huge pile of variables in from a file, which may be quicker.
12

EnterTheStory (aka tolworthy)

Thanks! And now for a completely different question...

Is it possible to find the array index number of a DeNGVaT string? I often use DeNGVaT as a way to associate strings with unique numbers. At present I have to make up a unique number and assign it to the string, then search all the strings for that number to find the string I want. It would be extremely helpful if I could just refer to the DeNGVaT string by its index number.

SSH

So basically you want to have an array of strings?

DengVaT index numbers can change dynamically, so that wouldn't help. Perhaps what you want is really:

Code: ags

Global.SetS(String.Format("Myvar%d", number), "This is the string associated with that number");


12

EnterTheStory (aka tolworthy)

Thanks for the suggestion.  I'll have a look at that.

EnterTheStory (aka tolworthy)

Hi SSH! Is there a simple way to copy ALL the variables saved by Global.Gets() and Global.Get() ?

I'm writing a function to save data to a file between games. I don't want to just use "savegame" because I only want specific things. But one of things I want is globals saved through DeNGVaT. I could just run through all the variables I might have made, but it would be MUCH easier to just globally save them all to an array, then read that array back when the game is loaded again.

Is that possible?

SMF spam blocked by CleanTalk