Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Pixelton on Wed 20/07/2011 16:36:53

Title: A one cursor type control state.
Post by: Pixelton on Wed 20/07/2011 16:36:53
I'm trying to use one cursor type to control everything (like the anyclick type kind of function)

I've looked over the global script and while I have spotted the different curser type states I couldn't spot anything involving the any click type. Essentially I want the main Move cursor to control everything, from object interaction and movement. As it stands, when I add an OnAnyclick function to an object in my scene this works for all the different cursor types except for the walk cursor type.

Is there a way to include the walk cursor to this?

I could have probably explained that alot better.

Any help is much appreciated.
Title: Re: A one cursor type control state.
Post by: Khris on Thu 21/07/2011 10:39:31
That's hard-coded; the walk cursor doesn't trigger "any click on".

Just use the interact cursor and make the player walk if they click on eLocationNothing. (GetLocationType())
Title: Re: A one cursor type control state.
Post by: Pixelton on Thu 21/07/2011 23:22:56
thanks Khris

I'm abit simple in regards to scripting, how do I go about turning the interact cursor into the move? I'm not too sure where that single line of scipt goes...I'm guessing somewhere within the Globalscript file?
Title: Re: A one cursor type control state.
Post by: Khris on Fri 22/07/2011 00:14:54
Yeah, find on_mouse_click and in there the part where it says
 else if (button == eMouseLeft) {
   ProcessClick(mouse.x, mouse.y, mouse.Mode);
 }


Change it to this:
 else if (button == eMouseLeft) {
   if (GetLocationType(mouse.x, mouse.y) == eLocationNothing) ProcessClick(mouse.x, mouse.y, eModeWalkto);
   else ProcessClick(mouse.x, mouse.y, eModeInteract);
 }

Title: Re: A one cursor type control state.
Post by: Pixelton on Fri 22/07/2011 00:50:05
Hey Khris, thanks for the quick repsonses, I really appreciate it.

I had a look atthe script and made the changes you suggested but I get a compile error, 'undefined symbol 'eModeWalk'

am I missing somthing - I'm probably just being stupid here?
Title: Re: A one cursor type control state.
Post by: Khris on Fri 22/07/2011 01:42:03
Sorry, my bad, it's "eModeWalkto".
Title: Re: A one cursor type control state.
Post by: Pixelton on Fri 22/07/2011 19:40:30
hmm, now I'm back home from work I can have a play!

I've made the changes but I'm still getting an error, I'm assuming what what I'm trying to do (whcih should be quite simple really) is actually more complicated than I thought.


  else if (button == eMouseLeft) {
//   ProcessClick(mouse.x, mouse.y, mouse.Mode );
    if (GetLocationType(mouse.x, mouse.y) == eLocationNothing) ProcessClick(mouse.x, mouse.y, "eModeWalkto");
    else ProcessClick(mouse.x, mouse.y, eModeInteract);
  }


I'm now getting an error:
GlobalScript.asc(225): Error (line 225): Type mismatch: cannot convert 'const string' to 'int'

I'm stumped and may have to rethink how I want my controls to work...
Title: Re: A one cursor type control state.
Post by: Yeppoh on Fri 22/07/2011 20:40:18
You just betrayed yourself that you simply copy-pasted what Khris wrote. =P
Remove the quotes and it should work fine. Enums are basically ints with a name representing them (roughly said), and putting them into quotes convert them into strings. Hence your compilation error.
Title: Re: A one cursor type control state.
Post by: Pixelton on Fri 22/07/2011 20:43:16
yeah, I know how to do pretty simple things in AGS but in regards to doing quite interesting things with the code it just goes over my head to be honest! I'm envious of people that have that kind of understanding with code and scripting.

Yeah I actually played around and fied it since. I'm getting there slowely haha.

Cheers.
Title: Re: A one cursor type control state.
Post by: Khris on Sat 23/07/2011 04:51:33
Right, WITHOUT THE QUOTES.

Weeeeeee. :P