Author Topic: Cursor changing above region  (Read 322 times)  Share 

Cursor changing above region
« on: 17 Oct 2012, 08:09 »
« Last Edit: 23 Oct 2012, 11:05 by Caracal »

slasher

  • Stare deep into the darkness of your mind...
    • I can help with AGS tutoring
    •  
    • I can help with scripting
    •  
    • I can help with story design
    •  
    • I can help with web design
    •  
Re: Cursor changing above region
« Reply #1 on: 17 Oct 2012, 12:16 »
One way, and I know there are other ways that may be better suited, anyhow, for a quicky until then:

Mouse moves over hotspot way when in Look mode.

1: Draw a hotspot area much bigger than you need where you want the mouse image to change (above region)
2: Draw a much smaller hotspot area inside the bigger hotspot area.
3: Use 'Mouse moves over hotspot' in the smaller hotspot events pane.
4: In the hotspot events pane where you want cursor to change put:
Code: Adventure Game Studio
  1. mouse.ChangeModeGraphic(eModeLookat, 1241); // change 1241 to your arrow sprite.

5: To change mouse back to default Lookat put this in the bigger hotspot events pane mouse over:
Code: Adventure Game Studio
  1. mouse.ChangeModeGraphic(eModeLookat, 233); // image of you default Lookat sprite

This example works only if you are using the Look Mode.

Don't forget to give the smaller hotspot  description a name ie Exit... Leave the larger hotspot description blank.

You could of course use an object and control on / off instead.

Meanwhile wait for the bullets to fly  (laugh)


« Last Edit: 17 Oct 2012, 13:58 by slasher »
Don't aim to be the best, just do your best ;)

Khris

  • Evil Dark Emperor Death-Kill
    • Lifetime Achievement Award Winner
    •  
    • I can help with play testing
    •  
    • I can help with scripting
    •  
    • I can help with translating
    •  
http://whathaveyoutried.com/

The other day on yahoo answers:
"Can you print colored images with black ink? If so tell me how please Thanx Kimberly"

Re: Cursor changing above region
« Reply #3 on: 18 Oct 2012, 18:05 »
@ slasher:
The idea is really good, i havent thought of a Hotspot. I would totally do this since its really easy enought for me. BUT... i am using the "ultimate cursor" which is making it kind of difficult. Hence the cursorimage wont change. -_-

@ Khris:
Where do i put this code? Into the global script? (i still have a problem with imported functions just as i have trouble setting up the "death-scene" function in my game)

slasher

  • Stare deep into the darkness of your mind...
    • I can help with AGS tutoring
    •  
    • I can help with scripting
    •  
    • I can help with story design
    •  
    • I can help with web design
    •  
Re: Cursor changing above region
« Reply #4 on: 18 Oct 2012, 18:37 »
I think Khris referred :-[

global.asc, inside repeatedly_execute... try it and see

No doubt he will clear things up for you  :P
Don't aim to be the best, just do your best ;)

Re: Cursor changing above region
« Reply #5 on: 19 Oct 2012, 08:41 »
"undefined token old_e = e;"
:-(
Just entering/copying the code seems not to work.

Khris

  • Evil Dark Emperor Death-Kill
    • Lifetime Achievement Award Winner
    •  
    • I can help with play testing
    •  
    • I can help with scripting
    •  
    • I can help with translating
    •  
Re: Cursor changing above region
« Reply #6 on: 19 Oct 2012, 09:03 »
The code I linked you to uses hotspots, and no, you can't use it without getting a little bit into what it does.

Code: Adventure Game Studio
  1. // above repeatedly_execute
  2.  
  3. Region* old_r;
  4.  
  5. // inside repeatedly_execute
  6.  
  7.   Region*r = Region.GetAtRoomXY(GetViewportX() + mouse.x, GetViewportY() + mouse.y);
  8.   if (r != old_r) {   // mouse moved over region or left one
  9.     old_r = r;
  10.      
  11.     int i = ??;   // determine if region is exit or used for something else
  12.     if (r == 0 || i == 0) mouse.ChangeModeGraphic(mouse.Mode, DEFAULT_SLOT);  // default walkto cursor graphic
  13.     else {
  14.       mouse.ChangeModeGraphic(mouse.Mode, FIRST_EXIT_ARROW_SLOT_MINUS_ONE + i);  // change to arrow
  15.     }
  16.   }

The only thing left to do is find some way of setting i to the exits direction / to 0 if the region isn't also an exit.
You could add a function that uses lots of ifs:

Code: Adventure Game Studio
  1. int GetRegionExit(int id) {
  2.   if (player.Room == 2) {
  3.     if (id == 1) return 1;  // north
  4.     if (id == 2) return 4; // west
  5.   }
  6.   ...
  7. }
Then use int i = GetRegionExit(r.ID);.

There are nicer ways, e.g. room_Load could set a global struct array:
Code: Adventure Game Studio
  1. function room_Load() {
  2.   SetRegionExit(1, eExitNorth);
  3.   SetRegionExit(2, eExitWest);
  4. }
Cleaner and tidier but you also need a struct definition.
http://whathaveyoutried.com/

The other day on yahoo answers:
"Can you print colored images with black ink? If so tell me how please Thanx Kimberly"