SetCursorMode(8) bug?

Started by Nine Toes, Thu 19/02/2004 05:07:36

Previous topic - Next topic

Nine Toes

1. I put this in the global script, under game_start:
FollowCharacterEX(BODYA,HEADA,FOLLOW_EXACTLY,0);

It's two separate characters (a body and a head) drawn so that they look like they are connected using the FollowCharacterEX command.  Now, the command does exactly what it's supposed to, but... The body animates, the head doesn't.

Any ideas on how I can get the head to animate as it follows the body?

2. Any ideas on how I can script "when the mouse moves over the character... (do this)"?
Watch, I just killed this topic...

Squinky

#1
Maybe :
rep exec:
if (character[CHARID].animating==1){
  //animate the other character here?
}

or you might try using a while instead of if...not sure though...

and then fo rhte mouse thing:

if ((mouse.x==character[EGO].x-20)&&(mouse.x==character[EGO].x+20))
if((mouse.x==character[EGO].y-20)&&(mouse.y==character[EGO].x+20)){
// put your fancy code here
}

of course thats if your characters 40 pixels tall...you'll need to modify..

Nine Toes

#2
Code: ags
  FollowCharacterEx(HEADA, BODYA, FOLLOW_EXACTLY, 0);
    if (character[BODYA].animating==1){
      AnimateCharacter(HEADA,2,0,1);
    }


*AND*

Code: ags
  if ((mouse.x==character[BODYA].x-31)&&(mouse.x==character[BODYA].x+31)){
    if ((mouse.y==character[BODYA].y-43)&&(mouse.y==character[BODYA].y+44)){
      SetMouseCursor(8);
    }
  }
  if ((mouse.x==character[HEADA].x-31)&&(mouse.x==character[HEADA].x+31)){
    if ((mouse.y==character[HEADA].y-43)&&(mouse.y==character[HEADA].y+44)){
      SetMouseCursor(8);
    }
  }


Nope.  No dice for either one of them.

I've been reading up on Properties a bit lately, I'm still not clear about how to use them or what they could be used for.  But, according to what I read in the manual, I can use them to set a default interaction for a character... would I be able to use this to cause the mouse cursor to change when it moves over the character?

EDIT:  Hold on just one second... I see something I might have done wrong in the second script... lemme see if I can still get it to work...

RE-EDIT:  Alright, nope... no effect at all on either one of the scripts...
Watch, I just killed this topic...

Squinky

#3
Try this for the mouse thing maybe?
I grabbed this code form one of my projects. I used it to make a talk cursor change when over a character. The first number should be the character number....then you need to pick which cursor mode you want, its currently at talk...

if ((GetCharacterAt(mouse.x, mouse.y)==5)&&(GetCursorMode()==3)){
   //code here?
   }

Edit:
Yep this should work, I tested it out and it ran for me. The previous crap I posted must have been a little wonky, this is easier anyway...

Nine Toes

Sweet.  Good job, Squink!

I had to modify it a little bit, but I got it to work:
Code: ags
if ((GetCharacterAt(mouse.x,mouse.y)==2)){
  SetMouseCursor(8);
}
if ((GetCharacterAt(mouse.x,mouse.y)==3)){
  SetMouseCursor(8);
}  


My only problem now is that the mouse cursor doesn't revert to any of the regular cursors (walk, talk, interact, look) when you move the mouse off of the character...  But, I'm going to play with that a bit myself... try to figure it out on my own.  (it's my game... I gotta do SOME work on it, right?) ;)

As far as the FollowCharacterEX problem, anybody have any new ideas?
Watch, I just killed this topic...

Squinky

Well, for the cursor prob, couldn't you just set a variable when you select cursors, and in rep exec make it check that variable and put it back to waht it was?

Did that make any sense?

Nine Toes

Watch, I just killed this topic...

Gilbert

#7
Can you do something like below?

if ((GetCharacterAt(mouse.x,mouse.y)==2)){
 SetMouseCursor(8);
} else if ((GetCharacterAt(mouse.x,mouse.y)==3)){
 SetMouseCursor(8);
}  else SetMouseCursor(curmode);



Where curmode is a variable holding the current mouse mode, which was set each time you select cursors.

Nine Toes

I think I might have found a bug...

Now, when you use SetMouseCursor() to set the mouse cursor mode 8 or 9, you will only get an interaction if you place the script for the interaction under AnyClick in the interaction editor, correct?

I have a feature in my project, when the mouse cursor moves over a certain character, it switches to mode 8, so that you can only use that interaction on that character alone.

When you start the game, the mouse cursor is always Walk by default, right?  Here my problem:  if the mouse cursor is at walk, and I move the mouse cursor over the character, it will switch to cursor mode 8, like it's supposed to.  BUT, if I then click on the character, the game responds as if the mouse cursor is still at Walk (I click on the character and my character walks to those coordinates).  If the previous mouse cursor was Talk, Ineract, or Look, the script for AnyClick will run just fine.

Any thoughts?
Watch, I just killed this topic...

Ryukage

Quote from: Dr. Jekyll?~MR. HYDE! on Fri 20/02/2004 00:17:42
I think I might have found a bug...

Now, when you use SetMouseCursor() to set the mouse cursor mode 8 or 9, you will only get an interaction if you place the script for the interaction under AnyClick in the interaction editor, correct?

I have a feature in my project, when the mouse cursor moves over a certain character, it switches to mode 8, so that you can only use that interaction on that character alone.

When you start the game, the mouse cursor is always Walk by default, right?  Here my problem:  if the mouse cursor is at walk, and I move the mouse cursor over the character, it will switch to cursor mode 8, like it's supposed to.  BUT, if I then click on the character, the game responds as if the mouse cursor is still at Walk (I click on the character and my character walks to those coordinates).  If the previous mouse cursor was Talk, Ineract, or Look, the script for AnyClick will run just fine.

Any thoughts?

SetMouseCursor() only changes the sprite used for the cursor, the actual mode remains the same as it was before.  It's intended for temporarily displaying the wait or pointer cursors without losing track of what the cursor mode is (the cursor can be returned to the normal appearance using SetDefaultCursor() ).  If you want to actually change the cursor mode so that the player can click on things in that mode, you need to use SetCursorMode().

Also, the comment in the manual stating that modes 8 and 9 only fire AnyClick events is out of date.  When CJ added the Interaction Editor, he also added special events for modes 8 and 9, though for some reason they're not available on everything.  Inventory, for example, is missing quite a few cursor modes from its Interaction Editor for some reason.  So you only need to use AnyClick to catch those if the special nodes are missing.  I think AnyClick fires even if the special handler has already dealt with the click, so it always needs to test the cursor mode before doing anything.  The only time AnyClick does not fire is with Walk Mode, because that's handled internally by the engine unless you check the "No special walk mode handling" box.
Ninja Master Ryukage
"Flipping out and kicking off heads since 1996"

Nine Toes

I am truly sorry... I feel really dumb for not thinking of that sooner... I always overlook the minor details like that.

I went in and modified the script in question, changing all "SetMouseCursor" commands to "SetCursorMode".  And I took the script in AnyClick and moved it to Mode 8 for the character in question.  Everything is in working order, now.

Thank you.
Watch, I just killed this topic...

SMF spam blocked by CleanTalk