Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   How come now working ? :( (https://forums.graalonline.com/forums/showthread.php?t=87557)

littlekinky 08-22-2009 04:55 PM

How come now working ? :(
 
Ok im trying to make a script where when you perss the tab button an image appears and shows the other players you are typeing but it doesnt seem to work ?

can anyone help

PHP Code:

//#CLIENTSIDE
function onCreated() {
  
setTimer0.05 );
}

function 
onTimeout() {
  if ( 
ChatBar.visible == true ) {
    if ( 
this.wasvisible == false ) {
      
this.wasvisible true;
      
ShowImgFunction();
    }
  } elseif ( 
this.wasvisible == true ) { 
    
this.wasvisible false;
  }
  
  
setTimer0.05 );


function 
ShowImgFunction() {
  
showimg2000"zone_teamsymbols-et.png"player.xplayer.);



I am using the et symbol for a test, im not going to use it

Switch 08-22-2009 05:12 PM

I don't see why you would need a timer for this, just check if the tab key was pressed. N-Pulse does it something like this.

Gambet 08-22-2009 06:09 PM

Quote:

Originally Posted by Switch (Post 1517555)
I don't see why you would need a timer for this, just check if the tab key was pressed. N-Pulse does it something like this.


I think I set it up on N-Pulse way back then. Anyway, you wouldn't trigger it when the player presses the tab button, you would trigger it when the chat bar is visible. I suppose you could incorporate both the tab and the chat bar visibility together, or you could just use a timeout loop (timeout loop not recommended but would work nonetheless, wouldn't really cause any extra strain on the server if done in a pre-existing loop but it's still not necessary).

[email protected] 08-22-2009 06:32 PM

Yeah, don't use a timeout. Try something like this

HTML Code:

//#CLIENTSIDE
function onKeyPressed() {
  if (keydown(8)) {
    if (ChatBar.visible == true) {
    } else {
    }
  }
}


Switch 08-22-2009 07:12 PM

Quote:

Originally Posted by Gambet (Post 1517575)
I think I set it up on N-Pulse way back then. Anyway, you wouldn't trigger it when the player presses the tab button, you would trigger it when the chat bar is visible. I suppose you could incorporate both the tab and the chat bar visibility together, or you could just use a timeout loop (timeout loop not recommended but would work nonetheless, wouldn't really cause any extra strain on the server if done in a pre-existing loop but it's still not necessary).

Well, you could do a visible check first and then a tab key check with an onKeyPressed() so it at least goes away when moving or pressing a key.

Gambet 08-22-2009 07:16 PM

Quote:

Originally Posted by Switch (Post 1517595)
Well, you could do a visible check first and then a tab key check with an onKeyPressed() so it at least goes away when moving or pressing a key.

You can't move while the chatbar is visible so that wouldn't be a problem.

Switch 08-22-2009 07:20 PM

Quote:

Originally Posted by Gambet (Post 1517597)
You can't move while the chatbar is visible so that wouldn't be a problem.

When you click anywhere on your game screen the chatbar goes away without using and onKeyPressed() function.

Gambet 08-22-2009 07:32 PM

Quote:

Originally Posted by Switch (Post 1517600)
When you click anywhere on your game screen the chatbar goes away without using and onKeyPressed() function.


Then I suppose your previous statement holds merit. :)

Pelikano 08-22-2009 08:35 PM

No need for more discussion, Andy's code should work fine ;)

Gambet 08-22-2009 09:27 PM

Quote:

Originally Posted by Pelikano (Post 1517626)
No need for more discussion, Andy's code should work fine ;)

Would work, yes, but it wouldn't work in all cases such as one brought up by Switch where you hide the chatbar without pressing the tab button. All of this needs to be accounted for.

[email protected] 08-22-2009 09:33 PM

How else do you hide the chatbar?

Switch 08-22-2009 10:05 PM

Quote:

Originally Posted by [email protected] (Post 1517670)
How else do you hide the chatbar?

Left clicking anywhere in your Graal screen that there is no GUI or such.

Edit: Something like this:
PHP Code:

//#CLIENTSIDE
function onMouseDown() {
  if (
leftMouseButton) {
    if (
ChatBar.visible == true) {
      
sleep(0.05);
      if (
ChatBar.visible == false) {
        
//hide image?
      
}
    }
  }



[email protected] 08-22-2009 10:07 PM

Quote:

Originally Posted by Switch (Post 1517680)
Left clicking anywhere in your Graal screen that there is no GUI or such.

Oh yeah- haha. duh

Crow 08-22-2009 10:28 PM

Didn't try it, but using those two events should do the trick:

PHP Code:

function ChatBar.onShow() {
  
// stuff
}

function 
ChatBar.onHide() {
  
// more stuff



Switch 08-22-2009 10:36 PM

Quote:

Originally Posted by Crow (Post 1517685)
Didn't try it, but using those two events should do the trick:

PHP Code:

function ChatBar.onShow() {
  
// stuff
}

function 
ChatBar.onHide() {
  
// more stuff



This works too.

FireHunter 08-23-2009 01:45 PM

Edit: Woops mistake didnt read the script clearly
well like crow sayed use

function ChatBar.onShow() and function ChatBar.onHide()


All times are GMT +2. The time now is 12:27 PM.

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