Scrolling rooms and on_mouse_click weirdness.

Started by Happyhelmet, Thu 27/05/2004 16:18:40

Previous topic - Next topic

Happyhelmet

essentially here is the script that i have for my on_mouse_click
Code: ags

if (button==LEFT) 
{
 if (GetLocationType(mouse.x,mouse.y)==1) //hotspot
 {
Ã,  MoveCharacter(GetPlayerCharacter(),(GetHotspotPointX(GetHotspotAt(mouse.x,mouse.y)),GetHotspotPointY(GetHotspotAt(mouse.x,mouse.y)));
Ã,  while(character[GetPlayerCharacter()].walking)
Ã,  {
Ã,  Ã, Wait(1)
Ã,  Ã, }
Ã,  Ã, RunHotspotInteraction(GetHotspotAt(mouse.x,mouse.y),GetCursorMode());
}


here's what happens: in a scrolling room, where the character has to walk to the hotspot and the screen scrolls a little, the character arrives at the hotspot and does not do any interaction. If the screen doesn't have to scroll, the character will perform the interaction. I tried replacing the RunHotspotInteraction with ProcessMouseClick and that didn't work either.

now if I put this in the repeatedly_execute script under the scrolling room:

Code: ags
if ((GetHotspotAt(mouse.x,mouse.y)==2) && (IsButtonDown(LEFT)==1)) {
 if (PlayerInteraction(GetHotspotPointX(GetHotspotAt(mouse.x,mouse.y)),GetHotspotPointY(GetHotspotAt(mouse.x,mouse.y)))==1)
 {
Ã,  RunHotspotInteraction(2,GetCursorMode());
 }
} //(this example working if hotspot is 2)


this works! of course you can see that it will be a pain in the ass to script this for a bunch of hotspots in a room.

another solution is that i can just enable "Walk to hotspot in Look mode".

another side note, i attempted to use the "SmartScrolling" script to see if it would fix my problem and it didn't help either so I wonder if this has to do with some way AGS handles this particular thing.

just for shits i added a kindof check dohicky on the first code to see how it handles this operation:

Code: ags

Display("Running interaction");
RunHotspotInteraction(GetHotspotAt(mouse.x,mouse.y),GetCursorMode());
Display("Ran interaction");


and in both instances it will display "Running interaction" and "Ran interaction" before it even runs the Interaction! Interesting :)

i really want to figure this out though because if i can get it to work i can add a globalvar and have both walk to and don't walk to hotspot in a variety of modes.

any help with trying to solve this would be greatly appreciated! :)

EDIT: I believe it might have to do with the fact that as the room scrolls, the does not stay where the person clicked so when the RunHotspotInteraction tries to run it can't find the hotspot because the mouse has changed position. let me know what you guys think
*<@: ) ("Clown Hat, Curly Hair, Smiley-Face" - Cartman, South Park)

SSH

You are right... you need to store the hotspot number and cusror mode in variables and then use the variables once you have got there. Take a look at Proskrito's FOA template and see how he does it...
12

SMF spam blocked by CleanTalk