Jibble

Author Topic: LucasArts GUI Help Thread (NEW Scumm GUI Available!)  (Read 198751 times)

blocking problems with 9verb template
« Reply #520 on: 02 May 2017, 12:29 »
EDIT:

in case somebody else runs into the same problem here's what was wrong:

1. i set "WalkToPoint" coordinates for the hotspots in the AGS properties window which caused a blocked "walk to" to be called when left clicking on them.

2. i failed to set the (eMA_WalkTo) action in the AnyClick function of characters/hotspots.
i.e.:
Code: [Select]
if (UsedAction(eMA_WalkTo)) {
    any_click_walk (238, 124, eDirectionRight);
  }

3. i didn't use if statements to avoid calling code that should be canceled along with the action
i.e.:
Code: [Select]
if(UsedAction(eGA_LookAt)) {
    if (any_click_move (391, 123, eDirectionLeft)) {
    player.Say ("blablabla.");
    player.Say ("bliblibli.");
    }
  }

-----------------------------------------------------------
hi,

i've done a search on this but all the answers i found seem to deal with vanilla/standard AGS functionality. i suppose it's a bit different with the 9verb template...

problem:

1. left clicking on a hotspot moves the character but blocks the game (cursor disappears)
2. left clicking on a character does nothing at all
3. using any interaction (open, talk to, etc.) walks the character over but once again the game blocks. the action cannot be cancelled.

what i would like to happen:

default lucasarts game behaviour: whenever a command is given (walk to, open, talk to,...left click or right) the character should walk over and only once it starts talking/interacting should the game "block".

it DOES behave correctly when using the "look at" (UsedAction(eGA_LookAt) function...
however this brings me to another question on the same topic:

for example, when the character has more than one line of dialogue when looking at something or any other action follows the initial "any_click_walk_look" command and the action is cancelled the script continues. how can i keep this from happening?
example:

Code: Adventure Game Studio
  1. if(UsedAction(eGA_LookAt)) {
  2.     any_click_walk_look (203, 124, eDirectionRight, "bla bla bla"); //this can be cancelled successfully
  3.     player.Say("bli bli bli"); //anything after still gets executed
  4.     Wait (40);
  5.     player.FaceDirection (eDirectionDown);
  6.     Wait (20);
  7.     player.Say ("blo blo blo");
  8. }
  9.  

in this case when the action is cancelled the character will still say "bli bli bli", face down then say "blo blo blo"...

cheers
« Last Edit: 03 May 2017, 12:51 by daniel »

Snarky

  • Global Moderator
  • Global Moderator
  • Mittens Lord
  • Private Insultant
    • Best Innovation Award Winner 2018, for his numerous additions to the AGS open source ecosystem including the new Awards Ceremony client and modules
    • Snarky worked on one or more games that won an AGS Award!
    •  
    • Snarky worked on one or more games that was nominated for an AGS Award!
Re: LucasArts GUI Help Thread (NEW Scumm GUI Available!)
« Reply #521 on: 02 May 2017, 12:54 »
Have you read the documentation for the 9-verb template?

Looking at the raw version here, you can see that it explains how to use MovePlayer() inside an if-clause to avoid blocking and make later commands contingent on not canceling/overriding the command before reaching the walkto point.

Also, the player character not being clickable is default LucasArts behavior. There doesn't seem to be a setting to change that in the template, but you can just set player.Clickable = true.

Re: LucasArts GUI Help Thread (NEW Scumm GUI Available!)
« Reply #522 on: 02 May 2017, 21:05 »
thanks, i actually did read the 9verb documentation but it's a lot to take in for someone like me who's never coded anything before. a lot of that stuff is still greek to me.
i'll try that "if-clause" thing tomorrow but it sounds like that should solve it. :)

i was not talking about the player character not being clickable btw. (of course i do not want him clickable)
it's all the NPC characters. they are "clickable" (their names show in the action bar) but when i left-click them the player doesn't walk up to them.

Re: LucasArts GUI Help Thread (NEW Scumm GUI Available!)
« Reply #523 on: 03 May 2017, 02:47 »
Are you saying you're using GoToCharacter() as described in the docs, but it has no effect?

abstauber

  • Cavefish
  • Mittens Knight
  • still mowing the lawn
    • abstauber worked on one or more games that won an AGS Award!
    •  
    • abstauber worked on one or more games that was nominated for an AGS Award!
Re: LucasArts GUI Help Thread (NEW Scumm GUI Available!)
« Reply #524 on: 03 May 2017, 10:16 »
Since we use "AnyClick" the player doesn't automatically walk to characters anymore. This also applies for hotspots, objects etc.

So you need to do it like this:
Code: [Select]
function cBman_AnyClick()
{
  // TALK TO
  if (UsedAction(eGA_TalkTo)) {
    dDialog1.Start();
  }
  // Just walk to BeMan
  else if (UsedAction(eMA_WalkTo)) {
    Go();
  }
.....

Re: LucasArts GUI Help Thread (NEW Scumm GUI Available!)
« Reply #525 on: 03 May 2017, 10:32 »
Since we use "AnyClick" the player doesn't automatically walk to characters anymore. This also applies for hotspots, objects etc.


aaah, i see:)
thanks!

might i suggest adding this to the sample function in GlobalScript.asc to avoid confusion for noobs like myself?;)

something like this:
Code: [Select]
/* Character, Object, Hotspot full blown SAMPLE
function cChar_AnyClick() {

  // WALK TO
  if (UsedAction(eMA_WalkTo)) {
    Go();
  }
  // TALK TO (characters only)
  else if (UsedAction(eGA_TalkTo)) {
    Unhandled();
  }
  // LOOK AT
  else if(UsedAction(eGA_LookAt)) {
    Unhandled();
  }
  // OPEN
  else if(UsedAction(eGA_Open)) {
    Unhandled();
  } 
  // CLOSE
  else if(UsedAction(eGA_Close)) {
    Unhandled();
  }
  // USE
  else if(UsedAction(eGA_Use)) {
    Unhandled();
  }
  // Push
  else if(UsedAction(eGA_Push)) {
    Unhandled();
  }
  // Pull
  else if(UsedAction(eGA_Pull)) {
    Unhandled();
  }
  // PICKUP
  else if(UsedAction(eGA_PickUp)) {
    Unhandled();
  }
  // GIVE TO (characters only)
  else if(UsedAction(eGA_GiveTo)) {
    Unhandled();
  } 
  //USE INV
  else if(UsedAction(eGA_UseInv)) {
    Unhandled();
  }
  else Unhandled();
}
*/


abstauber

  • Cavefish
  • Mittens Knight
  • still mowing the lawn
    • abstauber worked on one or more games that won an AGS Award!
    •  
    • abstauber worked on one or more games that was nominated for an AGS Award!
Re: LucasArts GUI Help Thread (NEW Scumm GUI Available!)
« Reply #526 on: 03 May 2017, 10:36 »
Good idea, I'll update it soon


Re: LucasArts GUI Help Thread (NEW Scumm GUI Available!)
« Reply #527 on: 03 May 2017, 12:59 »
ok, here's a quick follow-up question.
i got everything to work as it should now...almost.

when starting a dialog using
Code: [Select]
Dialog.Start() AGS seems to move the PC towards the NPC.
so when i do this
Code: [Select]
else if (UsedAction(eGA_TalkTo)) {
    if (any_click_move (413, 131, eDirectionRight)) {
    dDialog.Start();
    }
the character moves to the NPC and then returns to the given coordinates before starting the dialog.
is there some way to supress this? what if i want the characters to stand really far apart while talking?

abstauber

  • Cavefish
  • Mittens Knight
  • still mowing the lawn
    • abstauber worked on one or more games that won an AGS Award!
    •  
    • abstauber worked on one or more games that was nominated for an AGS Award!
Re: LucasArts GUI Help Thread (NEW Scumm GUI Available!)
« Reply #528 on: 03 May 2017, 13:04 »
Yep. This can be configured globally in guiscript.asc.
Around line 30 set
Code: [Select]
bool approachCharInteract = false;

You can also turn it on or off during game time via
Code: [Select]
set_approaching_char(bool enable)

Re: LucasArts GUI Help Thread (NEW Scumm GUI Available!)
« Reply #529 on: 03 May 2017, 13:29 »
Yep. This can be configured globally in guiscript.asc.

perfect, thanks!:)

btw. what's the quickest/easiest way if i want to update my game to the latest version of the 9-verb template?

abstauber

  • Cavefish
  • Mittens Knight
  • still mowing the lawn
    • abstauber worked on one or more games that won an AGS Award!
    •  
    • abstauber worked on one or more games that was nominated for an AGS Award!
Re: LucasArts GUI Help Thread (NEW Scumm GUI Available!)
« Reply #530 on: 03 May 2017, 14:33 »
That would be replacing the content from Guiscript.asc from here:
https://raw.githubusercontent.com/dkrey/ags_9verb-template/master/guiscript.asc

and guiscript.ash from here:
https://raw.githubusercontent.com/dkrey/ags_9verb-template/master/guiscript.ash

But backup your code first!

Additionally for the fix from 1.5.4 you need to edit the Globalscript.asc and edit the function on_key_press(eKeyCode keycode)
Make sure you comment out these two lines in the pause section
Code: [Select]
  // --- PAUSE-GUI ---
  if (keycode == eKeySpace)
  {
    // SPACEBAR
    if (!IsGamePaused()) {
      PauseGame();
      AdjustGUIText();
      gPaused.Visible=true;
    }
    else {
      gPaused.Visible=false;
      UnPauseGame();
      //SetDefaultAction(eMA_WalkTo);      <---- THIS LINE
      //ActionLine.TextColor=ActionLabelColorHighlighted;   <---- AND THIS LINE
      CheckDefaultAction();
      UpdateActionBar();
    }
  }

Re: LucasArts GUI Help Thread (NEW Scumm GUI Available!)
« Reply #531 on: 04 May 2017, 11:21 »
thanks! i'll give it a shot later today:)

Re: LucasArts GUI Help Thread (NEW Scumm GUI Available!)
« Reply #532 on: 08 May 2017, 01:06 »
hi again,

i noticed another peculiar thing that i can't figure out...not sure if it's actually related to the 9-verb template

when i click on a verb (i.e. "use") and then click on an empty spot on the background the PC always walks to, what seems to be, the center of the background...the game also gets blocked until he's there. it doesn't matter where i click (as long as there is no hotspot or anything). he always walks to the same spot. any idea why it's doing that?

also: is there a limit to how many characters can be displayed in the action bar? i have an item that has a pretty long name and i noticed it gets cut off in the action bar even though there's still plenty of room left.

cheers
« Last Edit: 08 May 2017, 08:34 by daniel »

abstauber

  • Cavefish
  • Mittens Knight
  • still mowing the lawn
    • abstauber worked on one or more games that won an AGS Award!
    •  
    • abstauber worked on one or more games that was nominated for an AGS Award!
Re: LucasArts GUI Help Thread (NEW Scumm GUI Available!)
« Reply #533 on: 08 May 2017, 10:45 »
Hmm... I can't reproduce the first issue. Whenever I click on something empty with "Use" selected, the action just switches to "Go To". No movement involved at all.
Could it be that in your roomscript you have a misplayed MovePlayer or player.Walk command? Does it happen in all rooms?
Also try to create a new game and check if it also happens in this "alley" sample room, the template provides.

Quote
also: is there a limit to how many characters can be displayed in the action bar? i have an item that has a pretty long name and i noticed it gets cut off in the action bar even though there's still plenty of room left.
I just counted 52 characters in total. Did you change the font of the label or did the label size change?
Have a look at the GUI gAction and check the properties of the label ActionLine

Re: LucasArts GUI Help Thread (NEW Scumm GUI Available!)
« Reply #534 on: 08 May 2017, 14:10 »
thanks,

i found the source of the first issue. for some weird reason i had set "walk to" coordinates for hotspot 0 in the AGS UI...:D don't ask

as for the second issue...i checked the ActionLine on the gAction UI and everything seems to be fine. i also didn't change the font or mess around with it in any way.
what seems to be happening is that the names of inventory items get cut off after 24 characters. i also tested it in the alley sample room...same thing.

p.s. i noticed that at the end of "function any_click_move" is a "Wait(5);" command...any specific reason why this is there? from what i can tell, all it does is cause the game to block for a fraction of a second every time the character reaches his destination...which felt kind of "glitchy" to me t.b.h.
« Last Edit: 08 May 2017, 14:22 by daniel »

abstauber

  • Cavefish
  • Mittens Knight
  • still mowing the lawn
    • abstauber worked on one or more games that won an AGS Award!
    •  
    • abstauber worked on one or more games that was nominated for an AGS Award!
Re: LucasArts GUI Help Thread (NEW Scumm GUI Available!)
« Reply #535 on: 08 May 2017, 14:19 »
Quote
what seems to be happening is that the names of inventory items get cut off after 24 characters.
I only tried 15 chars when I tried it. But this is seems to be a limitation of AGS itself. The editor limits object names to 29 characters, but apparently it forgot about limiting inventory names.

But the label itself could display all those characters ;)

edit: Hotspot names can be pretty long, I just managed to display "Go To 012345678901234567890123456789012345678 90123456"
« Last Edit: 08 May 2017, 14:24 by abstauber »

Re: LucasArts GUI Help Thread (NEW Scumm GUI Available!)
« Reply #536 on: 08 May 2017, 14:27 »
yeah i was afraid it would be something like that, too bad...so no way around it at this point i guess?

if the inventory items could have 29 characters as well i'd be fine...i'm 3 characters short!  :-\ :P

abstauber

  • Cavefish
  • Mittens Knight
  • still mowing the lawn
    • abstauber worked on one or more games that won an AGS Award!
    •  
    • abstauber worked on one or more games that was nominated for an AGS Award!
Re: LucasArts GUI Help Thread (NEW Scumm GUI Available!)
« Reply #537 on: 08 May 2017, 14:32 »
Unfortunately nothing I could do right now. Possibly CW, Gurok or Alan could help you out.

abstauber

  • Cavefish
  • Mittens Knight
  • still mowing the lawn
    • abstauber worked on one or more games that won an AGS Award!
    •  
    • abstauber worked on one or more games that was nominated for an AGS Award!
Re: LucasArts GUI Help Thread (NEW Scumm GUI Available!)
« Reply #538 on: 09 May 2017, 08:07 »
I completely overlooked you ninja edit:
Quote
p.s. i noticed that at the end of "function any_click_move" is a "Wait(5);" command...any specific reason why this is there? from what i can tell, all it does is cause the game to block for a fraction of a second every time the character reaches his destination...which felt kind of "glitchy" to me t.b.h.

This is from a time before 3.4.0 where you needed a wait command to actually see the character turning. Why it's Wait(5) instead of Wait(1)... no idea ;)

I replaced it with this code snippet

Code: [Select]
#ifver 3.4
    player.FaceDirection(dir, eBlock);
#endif
#ifnver 3.4
  player.FaceDirection(dir);
  Wait(1);
#endif

Re: LucasArts GUI Help Thread (NEW Scumm GUI Available!)
« Reply #539 on: 09 May 2017, 11:11 »
ok thanks for the info...:)

btw. is it possible to add an unhandled event for specific inventory items?

i.e. with a knife in the inventory, whenever it's used on an unhandled object i'd like the character to say "I don't want to cut that" instead of a super-generic phrase.
« Last Edit: 09 May 2017, 11:28 by daniel »