[SOLVED] No dialogue with character moving in repeatedly_execute_always

Started by cipberbloom, Sat 11/09/2021 00:23:48

Previous topic - Next topic

cipberbloom

Hullo everyone--

I have a character that moves back and forth across the screen within repeatedly_execute_always(), but when you try to interact with him, nothing happens. Even hovering the cursor over him doesn't display his name. The movement script is straight from the manual, with the coordinates and character name swapped out.

Code: ags

  if (!cJerrysHead.Moving)
  {
    // if Jerry is at the left, bobble him right
    if (cJerrysHead.x < 50)
    {
      cJerrysHead.Walk(860, cJerrysHead.y, eNoBlock, eAnywhere);
    }
    // otherwise, bobble Jerry to the left
    else
    {
      cJerrysHead.Walk(0, cJerrysHead.y, eNoBlock, eAnywhere);
    }
  }


Incidentally, what does the '!' do preceding cCharacter.Moving do/mean? Does it denote 'not'? As in 'if the character is not moving'?

Thanks in advance!  ;-D

Cassiebsg

Exactly, that. ! means Not(nod)

As for the character not registering, make sure, in the characters properties, that the character is clickable. Otherwise it won't register.  :)


If that's not it, try and check if there's anything in front of the character, like a GUI, object, other character, that might be blocking the mouse from registering the character.

Also is you have problems with having that code in rep_exex_always, try moving it into rep_exe or creating a bool isSpeaking, so you can add to the if condition and not run the walk function if the character is talking.
There are those who believe that life here began out there...

cipberbloom

THANK YOU Cassie! The character was clickable (combo menu in the interface), so I tried swapping the movement code to repex, deleted an object that was a stand-in for some foreground shadows, and he still wasn't showing up when I hovered the cursor/pointer over him. Was totally flummoxed.

But your cCharacter.Speaking suggestion prompted me to put in some code to make the thus far non-reactive character go to the x coord of the character he's supposed to be talking to. Guess what I spotted? An override (cJerrysHead.Clickable = false) I'd put into room_load a couple of months ago whilst testing some other thingy!  (wtf)

Again, thanks!  ;-D

Cassiebsg

Yeah, sometimes we create test code that we forget about, and then produce a bug that is hard to find.  (laugh)
There are those who believe that life here began out there...

SMF spam blocked by CleanTalk