A one cursor type control state.

Started by Pixelton, Wed 20/07/2011 16:36:53

Previous topic - Next topic

Pixelton

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.
Please follow our progress on IndieDB!

<a href="http://www.indiedb.com/games/dustbowl-a-wasteland-adventure" title="View Dustbowl - A Wasteland Adventure on Indie DB" target="_blank">Dustbowl - A Wasteland Adventure</a>

Khris

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())

Pixelton

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?
Please follow our progress on IndieDB!

<a href="http://www.indiedb.com/games/dustbowl-a-wasteland-adventure" title="View Dustbowl - A Wasteland Adventure on Indie DB" target="_blank">Dustbowl - A Wasteland Adventure</a>

Khris

#3
Yeah, find on_mouse_click and in there the part where it says
Code: ags
  else if (button == eMouseLeft) {
    ProcessClick(mouse.x, mouse.y, mouse.Mode);
  }


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


Pixelton

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?
Please follow our progress on IndieDB!

<a href="http://www.indiedb.com/games/dustbowl-a-wasteland-adventure" title="View Dustbowl - A Wasteland Adventure on Indie DB" target="_blank">Dustbowl - A Wasteland Adventure</a>

Khris

Sorry, my bad, it's "eModeWalkto".

Pixelton

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.

Code: ags

  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...
Please follow our progress on IndieDB!

<a href="http://www.indiedb.com/games/dustbowl-a-wasteland-adventure" title="View Dustbowl - A Wasteland Adventure on Indie DB" target="_blank">Dustbowl - A Wasteland Adventure</a>

Yeppoh

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.

Pixelton

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.
Please follow our progress on IndieDB!

<a href="http://www.indiedb.com/games/dustbowl-a-wasteland-adventure" title="View Dustbowl - A Wasteland Adventure on Indie DB" target="_blank">Dustbowl - A Wasteland Adventure</a>

Khris

Right, WITHOUT THE QUOTES.

Weeeeeee. :P

SMF spam blocked by CleanTalk