Adventure Game Studio

Community => Adventure Related Talk & Chat => Topic started by: monkey0506 on Tue 03/01/2006 02:19:18

Title: AGS Pointers for Dummies - Update 17 October 2006
Post by: monkey0506 on Tue 03/01/2006 02:19:18
It's been a while since I wrote the first version of this "tutorial-kind-of-thing," and I felt it was time for an update. Some revisions, some new content, and a cover image!

(http://img242.imageshack.us/img242/6929/pointerdummieswm0.gif) (http://americangirlscouts.org/agswiki/AGS_Pointers_for_Dummies)

Feel free to comment or ask any questions!
Title: Re: AGS Pointers.
Post by: Gilbert on Tue 03/01/2006 03:39:12
Actually this fits either of the Tech forums I think, and due to the usefulness of this, it may go to the Tech. Archive as well.
Title: Re: AGS Pointers.
Post by: SSH on Tue 03/01/2006 07:02:46
Not to mention the wiki
Title: Re: AGS Pointers.
Post by: Ubel on Tue 03/01/2006 12:24:18
Wow, monkey_05_06. Before this I had never really understood what pointers are or what you can use them for! Thank you very much for sharing this tutorial-kind-of-thing! It really helped me. :)
Title: Re: AGS Pointers.
Post by: Babar on Tue 03/01/2006 12:43:44
I hate pointers. With all their "special status" asterisk markers, that confuzzle and their "relieve the burden" attitude, that leaves you wondering what their doing.

:= Thanks for the tutorial. It helped a bit. Now if only I could remember why I needed them...
Title: Re: AGS Pointers for Dummies - A "tutorial-kind-of-thing".
Post by: monkey0506 on Tue 03/01/2006 22:25:59
In AGS you need pointers to find out what InventoryItem, GUI, GUIControl, Character, Hotspot, Region, or Object is at coordinates (X, Y) on the screen (with the function *.GetAtScreenXY(X, Y)).  Also if you want to have any background speech you might want a pointer to the Overlay that is created by that function so you can prematurely remove the text from the screen.  Furthermore you will need pointers if you plan to work with files (File), dynamic sprites (DynamicSprite), and the date and/or time (DateTime).

And, like I said, what pointers really do is "point" to a variable stored in the memory.  Basically they just store the address of the variable, and then when you use them it finds that point in the memory and accesses that variable (which is why if you try to work with a pointer improperly, such as if it is null, you will get dastardous results).  So in essence you are just creating a new alias for an existing variable...if that helps explain it.
Title: Re: AGS Pointers for Dummies - A "tutorial-kind-of-thing".
Post by: Ashen on Tue 03/01/2006 23:51:34
I agree with SSH, this should be Wiki'd. I'd do it myself, if I could figure out how.
Title: Re: AGS Pointers for Dummies - A "tutorial-kind-of-thing".
Post by: monkey0506 on Wed 04/01/2006 01:09:36
Yay!!!

Wiki (http://americangirlscouts.org/agswiki/index.php/Scripting%2C_Code_%26_Interaction#AGS_Pointers_for_Dummies_.28A_reference_for_the_rest_of_us.21.29)

I did it!  It took me a while to get used to the Wiki code, but I got the page up.  Also, I added some stuff...In fact, I forgot the most important use of pointers!!!  Well, one of the most important ones anyway.  Just scroll down to "*** NEW AS OF 3 JANUARY 2006 ***" and continue reading from there. :=

I'm so excited about everyone's responses!  I just can't help but smile!!! ;D ;D ;D

[EDIT:]

I changed the link from a direct address to a hyperlink (because it was stretching the page out).

Also, I have been unleashed upon the AGS Wiki!!!  No article is safe from my editing!  Actually I've just been editing some of the scripting articles with relevant information.

[EDIT:]

It only took me 16 edits to get the Wiki entry for this correct!  w00tage!!! :P  Stupid history...:D
Title: Re: AGS Pointers for Dummies - A "tutorial-kind-of-thing".
Post by: Elliott Hird on Wed 04/01/2006 16:18:17
Mmm, I'm gonna make a full “AGS for Dummies” and I think I'll link to this.
Title: Re: AGS Pointers for Dummies - A "tutorial-kind-of-thing".
Post by: monkey0506 on Wed 04/01/2006 22:45:30
Well...a "full 'AGS for Dummies'" would take quite some time to write.  I mean, to define it as "AGS for Dummies" would imply that it will teach you...at the very least...all of the basics of AGS.  Don't take this to mean that I think you can't/won't do it...I'm just saying it would be a large project.  Good luck with it! ;)
Title: Re: AGS Pointers for Dummies - Update 17 October 2006
Post by: monkey0506 on Tue 17/10/2006 19:24:55
I've been incredibly bored lately. And I decided that this could use some work. I've even gone so far as to make a mock-up cover image.

I've revamped the organization, added some new content, and actually rewritten most of the article.

~Cheers everyone!
Title: Re: AGS Pointers for Dummies - Update 17 October 2006
Post by: Pumaman on Wed 18/10/2006 21:28:21
Looks good!

The only suggestion I'd make is to remove the bit about null being equivalent to 0, since it isn't. You can't compare a pointer to 0 and mentioning it in the tutorial is probably just going to confuse people.

Good work :)
Title: Re: AGS Pointers for Dummies - Update 17 October 2006
Post by: monkey0506 on Thu 19/10/2006 05:17:34
The reason I say that is because...er...well...that's the only way to make an optional pointer parameter ATM... :o.....and....er...okay. :'(

I actually added disclaimers when I put that to the effect that in most cases null should be used, not 0...but...you can't initialize a pointer to null in a function prototype. Import. Whichever. So...uh...can you make it so we can initialize our pointer parameters then? Please?

[EDIT:]

Okay, I removed the bit professing that they're equal...because obviously they aren't and I'm just a n00b...but regarding optional parameters, how does this sound?:

QuoteThough it is not normally recommended (and in most cases won't work), we can substitute the value 0 for null in this case.

I just think people should know you can make pointer parameters optional...though the means are a bit different to normal pointer usage.

And, no complaints about the section on Strings then? To be honest that's the section I was most worried about. Talking about char*s...

Also I never said thanks. So, thanks Chris. :)