Cursor Question with looking and interaction

Started by Lionheart, Mon 20/06/2005 02:29:00

Previous topic - Next topic

Lionheart

I noticed in the MAGS game War Stars you could interact with things by clicking the left mouse button and look at things by clicking the right, getting rid of the need for hand, eye, mouth cursors etc.

i was wondering how this is accomplished

and also i was wondering if i didn't have the gui bar, and there is no exit button, how does a player exit the game? is there a way to add QUIT to one of the F keys?

Thanks in advance.

monkey0506

1.  Read the manual.
2.  Read the BFAQ.
3.  Search the forums.
4.  Realize how simple your feeble minded questions really are. :=
5.  Ask them only as a last resort.

In the manual, look up:

1.  on_mouse_click
2.  on_key_press

If you're using AGS 2.62:

Code: ags
/* inside of on_mouse_click */
if (button == LEFT) {
  ProcessClick(/* I don't remember the exact parameter list, you'll have to look it up.  Process the mouse mode as MODE_INTERACT or something like that. */);
  }
else if (button == RIGHT) {
  ProcessClick(/* Process this as MODE_LOOKAT or whatever it's called */);

/* inside of on_key_press */
if (keycode == /* don't know the keycode for F5 off the top of my head.  But I know it's in the manual.  Look it up. */) QuitGame(1 /* replace 1 with 0 to remove prompt */);



If you're using 2.7:

Code: ags
/* inside of on_mouse_click */
if (button == eMouseLeft) {
  /* see the above 2.62 interactions.  I don't believe this has changed.  Except you would pass the mode as eModeInteract instead of MODE_INTERACT */
  }
else if (button == eMouseRight) {
  /* This would be eModeLookat instead of MODE_LOOKAT */
  }

/* inside of on_key_press */
/* the code would be exactly the same as the above */


I hope this helps.

Lionheart

#2
Well i would have used the manual, but it is not working in my AGS program, and if i was to search the forums i would have no idea what key words i should use, or know what i would be looking for in an FAQ, so thats why i asked here. 

Ok so i see you have provided the script, so what do i do with it..

i go to script and go to on mouse click, do i delete the entire script under mouseclick and just paste that one in, or what?


monkey0506

Actually, if you read over it, you'll see that you'll have to look up some things in the manual.  Except you say your manual isn't working.  I'd look it up for you, but I just had to format my HD last night, so I've only just gotten it back up and running, and I'm still working on re-installing stuff (system stuff).

But you should probably just add the code in the appropriate sections, i.e. in on_mouse_click, add the ProcessClick function in the appropriate area, i.e. if (button == LEFT) or whatever.

Also, now that I think about it, I think the parameter list is something like:

ProcessClick(int x, int y, int /* CursorMode in 2.7 */ mode);

Not 100% sure, but like I said, I too don't have access to the help manual ATM.

SMF spam blocked by CleanTalk