Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Detecting if the chatbox/chat field is open. (https://forums.graalonline.com/forums/showthread.php?t=134258991)

Jiroxys7 05-02-2010 07:27 AM

Detecting if the chatbox/chat field is open.
 
You know how UN has that typewriter script? I'm trying to create a script that detects if the chat box is open and the player is typing (anything), and displays an emote to show that the player is typing. though i cant seem to find the functions that detect this. anyone know where i could find a list of functions or whatever that check for these? or if youve found them somewhere in the wiki, could you link me to it?

cbk1994 05-02-2010 09:24 AM

ChatBar is the GuiTextEditCtrl; you can use events like onShow to display the bubble.

xAndrewx 05-02-2010 09:52 AM

ChatBar.visible = true;

I used something like this to detect if it's open
HTML Code:

//#CLIENTSIDE
function onKeyPressed(code) {
  if (keydown(8) || temp.code == 9) setTimer(0.05);
}

function onTimeout() {
  if (ChatBar.visible) {
    temp.text = ChatBar.text; //or ChatBar.getText()
    if (temp.text != null) {
      [Do your animation]
    }
    setTimer(0.1);
  }
}


Gambet 05-02-2010 06:00 PM

I believe that I used ChatBar.visible on N-Pulse a while back when I added the emote-chat bubble there. Some people don't like these types of things, but I personally think it's a nice little feature; sort of like how most instant messengers tell you when the person you're conversing with is typing.

fowlplay4 05-02-2010 06:19 PM

cbk already said but what it comes down to is:

PHP Code:

//#CLIENTSIDE
function ChatBar.onShow() {
  
// I have been made visible.


All GUI controls have that kind of functionality, you can find the list here:

http://wiki.graal.net/index.php/Crea...ent/GuiControl

Gambet 05-02-2010 06:29 PM

Quote:

Originally Posted by fowlplay4 (Post 1573477)
cbk already said but what it comes down to is:

PHP Code:

//#CLIENTSIDE
function ChatBar.onShow() {
  
// I have been made visible.


All GUI controls have that kind of functionality, you can find the list here:

http://wiki.graal.net/index.php/Crea...ent/GuiControl


ChatBar.onShow() is only evoked once each time that the ChatBar becomes visible. This can lead to the emote glitching in cases where the player is warped around while chatting (could be that they are waiting for an event to start and the ET warps everyone to the event while some are mid-chat), and probably other instances as well (like spar waiting queues and such).

coreys 05-02-2010 07:30 PM

Quote:

Originally Posted by Gambet (Post 1573469)
I believe that I used ChatBar.visible on N-Pulse a while back when I added the emote-chat bubble there. Some people don't like these types of things, but I personally think it's a nice little feature; sort of like how most instant messengers tell you when the person you're conversing with is typing.

Mhm, you're right, that's really all it takes. You can use Andy's example as well if you want a more event oriented approach.

Jiroxys7 05-03-2010 08:14 AM

Thanks guys. i got it working last night using andy's example. and thanks for the link jer :D now all i need to do is find out how to make the emote image i made act like an actual emote instead of making a seperate gani for each gani the player triggers it in :p

Cubical 05-03-2010 08:23 AM

Set player.attr[30] to whatever gani you would like to show. You can choose any number up to 30 but make sure none of your ganis are using the attribute that you set it to.


All times are GMT +2. The time now is 08:49 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.