LucasArts GUI Help Thread (NEW Scumm GUI Available!)

Started by TerranRich, Fri 01/08/2003 06:04:47

Previous topic - Next topic

daniel

#520
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: ags

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: ags

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: ags

if(UsedAction(eGA_LookAt)) {
    any_click_walk_look (203, 124, eDirectionRight, "bla bla bla"); //this can be cancelled successfully
    player.Say("bli bli bli"); //anything after still gets executed
    Wait (40);
    player.FaceDirection (eDirectionDown);
    Wait (20);
    player.Say ("blo blo blo");
}


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

cheers

Snarky

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.

daniel

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.

Khris

Are you saying you're using GoToCharacter() as described in the docs, but it has no effect?

abstauber

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: ags

function cBman_AnyClick()
{ 
  // TALK TO
  if (UsedAction(eGA_TalkTo)) {
    dDialog1.Start();
  }
  // Just walk to BeMan
  else if (UsedAction(eMA_WalkTo)) {
    Go();
  }
.....

daniel

Quote from: abstauber on Wed 03/05/2017 10:16:35
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: ags

/* 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


daniel

ok, here's a quick follow-up question.
i got everything to work as it should now...almost.

when starting a dialog using
Code: ags
Dialog.Start()
AGS seems to move the PC towards the NPC.
so when i do this
Code: ags
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

Yep. This can be configured globally in guiscript.asc.
Around line 30 set
Code: ags

bool approachCharInteract = false;


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

daniel

Quote from: abstauber on Wed 03/05/2017 13:04:08
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

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: ags

  // --- 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();
    }
  }

daniel


daniel

#532
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

abstauber

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

daniel

#534
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.

abstauber

#535
Quotewhat 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 01234567890123456789012345678901234567890123456"

daniel

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

Unfortunately nothing I could do right now. Possibly CW, Gurok or Alan could help you out.

abstauber

I completely overlooked you ninja edit:
Quotep.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: ags
#ifver 3.4
    player.FaceDirection(dir, eBlock);
#endif
#ifnver 3.4
  player.FaceDirection(dir);
  Wait(1);
#endif

daniel

#539
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.

SMF spam blocked by CleanTalk