Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-22-2009, 04:55 PM
littlekinky littlekinky is offline
Registered User
littlekinky's Avatar
Join Date: Sep 2007
Posts: 185
littlekinky has a little shameless behaviour in the past
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
Reply With Quote
  #2  
Old 08-22-2009, 05:12 PM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
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.
__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
Reply With Quote
  #3  
Old 08-22-2009, 06:09 PM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Quote:
Originally Posted by Switch View Post
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).

Last edited by Gambet; 08-22-2009 at 06:38 PM.. Reason: Clarifying in response to post below :)
Reply With Quote
  #4  
Old 08-22-2009, 06:32 PM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
Yeah, don't use a timeout. Try something like this

HTML Code:
//#CLIENTSIDE
function onKeyPressed() {
  if (keydown(8)) {
    if (ChatBar.visible == true) {
    } else {
    }
  }
}
Reply With Quote
  #5  
Old 08-22-2009, 07:12 PM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
Quote:
Originally Posted by Gambet View Post
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.
__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
Reply With Quote
  #6  
Old 08-22-2009, 07:16 PM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Quote:
Originally Posted by Switch View Post
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.
Reply With Quote
  #7  
Old 08-22-2009, 07:20 PM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
Quote:
Originally Posted by Gambet View Post
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.
__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
Reply With Quote
  #8  
Old 08-22-2009, 07:32 PM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Quote:
Originally Posted by Switch View Post
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.
Reply With Quote
  #9  
Old 08-22-2009, 08:35 PM
Pelikano Pelikano is offline
Registered User
Pelikano's Avatar
Join Date: Oct 2008
Posts: 1,133
Pelikano has a little shameless behaviour in the past
No need for more discussion, Andy's code should work fine
Reply With Quote
  #10  
Old 08-22-2009, 09:27 PM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Quote:
Originally Posted by Pelikano View Post
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.
Reply With Quote
  #11  
Old 08-22-2009, 09:33 PM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
How else do you hide the chatbar?
Reply With Quote
  #12  
Old 08-22-2009, 10:05 PM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
Quote:
Originally Posted by [email protected] View Post
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?
      
}
    }
  }

__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.

Last edited by Switch; 08-22-2009 at 10:15 PM.. Reason: added check for left clicking
Reply With Quote
  #13  
Old 08-22-2009, 10:07 PM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
Quote:
Originally Posted by Switch View Post
Left clicking anywhere in your Graal screen that there is no GUI or such.
Oh yeah- haha. duh
Reply With Quote
  #14  
Old 08-22-2009, 10:28 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Didn't try it, but using those two events should do the trick:

PHP Code:
function ChatBar.onShow() {
  
// stuff
}

function 
ChatBar.onHide() {
  
// more stuff

Reply With Quote
  #15  
Old 08-22-2009, 10:36 PM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
Quote:
Originally Posted by Crow View Post
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.
__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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