Scripting, Code & Interaction: Difference between revisions
→AGS Pointers for Dummies (A reference for the rest of us!)
Line 283: | Line 283: | ||
''So what exactly are pointers, and how do I use them?'' | ''So what exactly are pointers, and how do I use them?'' | ||
The basic idea of a pointer is that instead of creating a new variable in the memory, you are just going to | The basic idea of a pointer is that instead of creating a new variable in the memory, you are just going to ''point'' to one that is already stored there. This can have several uses, and in AGS even has some special ones. | ||
AGS has certain ''managed'' types that you can not create an instance (variable declaration) of. All of the variables of managed types are | AGS has certain ''managed'' types that you can not create an instance (variable declaration) of. All of the variables of managed types are 'managed'' by AGS. These include the types: <a href=http://www.bigbluecup.com/manual/Room%20_%20Screen%20functions.htm>Room</a>, Game, Parser, File, InventoryItem, Overlay, DynamicSprite, GUI, Label, Button, Slider, TextBox, InvWindow, ListBox, Character, GUIControl, Hotspot, Region, Maths, DateTime, and Object. | ||
However, you can work with these managed types through pointers. You define a pointer by typing the variable type, i.e. GUI, then a space, an asterik (*), and finally the name of the pointer. So, to create a pointer named GUIPointer to point to the GUI object named gMygui, you could type: | However, you can work with these managed types through pointers. You define a pointer by typing the variable type, i.e. GUI, then a space, an asterik (*), and finally the name of the pointer. So, to create a pointer named GUIPointer to point to the GUI object named gMygui, you could type: |