Hi, its me again ;D
Im sure this is going to be another "1question 1 answer" type thread...
I just want to know how to place a (I think its called a "pointer"?) inside a function parameter "thing" ---> ( ) (sorry, I dont know how to call this!) when its a cursor mode (like eModeLookAt, for example):
function cursorAnimOnOff(this CursorMode*, int iXcursor, int iAnimView, int iNoAnim )
{
if (mouse.GetModeGraphic(this) == iXcursor) //"x" cursored-out
{
if (cursorAnim == true)
{
mouse.ChangeModeView(this, iAnimView); //change to normal animated view
}
mouse.ChangeModeGraphic(this, iNoAnim); //normal cursor, no animation
}
}
When I previously tried "this GUI*" or "this Button*"....it worked...now I try "this CursorMode*" and it gives me an error:
GlobalScript.asc(913): Error (line 913): 'this' cannot be used with primitive types
Whats a primitive type? Im guessing Button* or GUI* arent "primitive types" since those worked and "CursorMode*" didnt?
Are those "pointers"...and most importantly, in the manual they explain what pointers are but is there a list of all "pointers" in AGS somewhere? I couldnt find it.
It's called enumeration (enum, in AGS).
You're actually using it wrong. It's supposed to be like this (I believe, haven't tested):
function cursorAnimOnOff(CursorMode theMode, int iXcursor, int iAnimView, int iNoAnim )
{
if (mouse.GetModeGraphic(theMode) == iXcursor) //"x" cursored-out
{
if (cursorAnim == true)
{
mouse.ChangeModeView(theMode, iAnimView); //change to normal animated view
}
mouse.ChangeModeGraphic(theMode, iNoAnim); //normal cursor, no animation
}
}
A pointer used for OBJECT, GUI, etc are just pointing to that particular item. But since CursorMode is a list of enumerations like: eModeLookat, eModeInteract, etc. You have to access it like it's a variable type.
So the variable theMode will only use the enumeration types of CursorMode.
AHHHHHhh!! (The Light turns on)
Well that works! Ok, so NOW I get it: CursorMode enumerates things in a list so its called an "enum", GUI or BUTTON are "objects". Wow, ok, that clarified a lot actually. Now I know how to use that :P
I just noticed I could have also have done:
function cursorAnimOnOff(int iMode, int iXcursor, int iAnimView, int iNoAnim )
but then Id have to remember the numbers of different modes instead of its name so the once you gave is much better.
Thanks once again Ryan :)
To elaborate, enums are ints.
You can assing initial values when declaring an enum, and you can do this:
Display("%d", eModeInteract);