Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 04-20-2011, 11:37 AM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
Events that work in ganiscript?

working on a custom nickname system, it appears that neither onPlayerNickChanges
or
onNickChanges

are invoked in the gani.


PHP Code:
function onPlayerEnters(){
  
with(findimg(200)){
    
player.1.5;
    
player.3;
    
attachtoowner true;
    
temp.shared.getAlignmentColor(player.ap);
    
/*red = c[0]/255;
    green = c[1]/255;
    blue = c[2]/255;*/
    
red 83;
    
green 46;
    
blue 86;
    
textshadow true;
    
//temp.c = shared.getAlignmentShadowColor()
    //shadowcolor = {c[0]/255, c[1]/255, c[2]/255};
    
text player.nick;
    
font $pref::graal::defaultfontname;
    
style "bc";
    
zoom $pref::graal::defaultfontsize 24;
    
layer 0;
  }
}

function 
onPlayerNickChanges(){
  
with(findimg(200)){
    
text player.nick;
  }

Reply With Quote
  #2  
Old 04-20-2011, 11:41 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
I think those are serverside only.
__________________
Reply With Quote
  #3  
Old 04-20-2011, 11:48 AM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
trying something like
PHP Code:
function onPlayerChats(){
  if(
player.chat.starts("setnick")){
    
with(findimg(200)){
      
text player.nick;
    }
  }

also doesn't work

I'd hate to have to do something like unset the player.attr and then reset it after a timeout or something, but it looks like I may have to
Reply With Quote
  #4  
Old 04-20-2011, 12:11 PM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
ended up duplicating the gani and am changing the attr to the 2nd gani when onPlayerNickChanges is invoked on the serverside, resetting back to original after a .1 sec scheduleevent

guess I'll have to shove a timeout into the ani itself to deal with AP, checking once every 10 or so seconds seems reasonable
Reply With Quote
  #5  
Old 04-20-2011, 12:12 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Maybe try using onPlayerChanges(pl)? I doubt it will work inside a GANI script, though.
__________________
Reply With Quote
  #6  
Old 04-20-2011, 12:22 PM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
I can imagine nickname displaying having several complications if done through gani script, even if there was an event for nick changing within gani scripts you still ought to have a way to add the text "(Paused)" assuming you want to replicate default.
And what about when AP changes?

You may want nicknames to be hidden at certain times which would likely require the use of a timeout to check for them being enabled, which is something you'd want to be checking one time within a weapon rather than for every single player in a gani script.

Edit: you mentioned this just before I posted.

If there were other gani scripts active that were modifying player red, green, blue, zoom etc would these not also be applied to nickname display if it were within a gani script?
Reply With Quote
  #7  
Old 04-20-2011, 01:14 PM
MrOmega MrOmega is offline
One More Time
MrOmega's Avatar
Join Date: Aug 2010
Location: TN, USA
Posts: 631
MrOmega is an unknown quantity at this point
Send a message via AIM to MrOmega Send a message via MSN to MrOmega Send a message via Yahoo to MrOmega
The method I use is setting the nick to an attr and check to see if they don't equal each other. I use another attr for my custom pause system.. Suppose you could do the same for AP
__________________
Time is the fire in which we burn...
Up, Up, Down, Down, Left, Right, Left, Right, B, A, Select, Start! Now I got 99 LIVES!!!
Reply With Quote
  #8  
Old 04-20-2011, 06:11 PM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
Quote:
Originally Posted by ffcmike View Post
I can imagine nickname displaying having several complications if done through gani script, even if there was an event for nick changing within gani scripts you still ought to have a way to add the text "(Paused)" assuming you want to replicate default.
And what about when AP changes?

You may want nicknames to be hidden at certain times which would likely require the use of a timeout to check for them being enabled, which is something you'd want to be checking one time within a weapon rather than for every single player in a gani script.

Edit: you mentioned this just before I posted.

If there were other gani scripts active that were modifying player red, green, blue, zoom etc would these not also be applied to nickname display if it were within a gani script?
For pausing, I assume I can just use a keydown to check for the pause button, then if that occurs, check ispaused, swap to the duped gani for a moment and just append (paused), then revert back to the other.

You're right about the hiding nicks though, as far as I'm aware there is still no inherent method of getting the player object who is viewing the gani, so I guess I'll have to use a weapon for this instead.
Reply With Quote
  #9  
Old 04-20-2011, 06:19 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
Quote:
Originally Posted by Mark Sir Link View Post
You're right about the hiding nicks though, as far as I'm aware there is still no inherent method of getting the player object who is viewing the gani, so I guess I'll have to use a weapon for this instead.
If you use a client.var in a gani script, it'll always use the one of the player viewing the gani.
__________________
Reply With Quote
  #10  
Old 04-20-2011, 06:20 PM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
Quote:
Originally Posted by Crow View Post
If you use a client.var in a gani script, it'll always use the one of the player viewing the gani.
should I just reference the client var without providing the object?

PHP Code:
if(client.viewnicks
EDIT: tested that with another player, appears to be working as intended

I guess the issues I need to figure out still are how to update nick names being toggled off instantly rather than having to sit and wait for a slow timeout I plan to use for AP.

EDIT 2: apparently keydown(10) only returns true while unpausing, and will not return true while starting a pause. Only solution I can think of is using GraalControl.onKeyDown and checking if keyname == 2nd param.

Last edited by Mark Sir Link; 04-20-2011 at 06:42 PM..
Reply With Quote
  #11  
Old 04-20-2011, 07:11 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
Quote:
Originally Posted by Mark Sir Link View Post
EDIT: tested that with another player, appears to be working as intended
Glad it does
__________________
Reply With Quote
  #12  
Old 04-20-2011, 08:13 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
Quote:
Originally Posted by Mark Sir Link View Post
should I just reference the client var without providing the object?

PHP Code:
if(client.viewnicks
EDIT: tested that with another player, appears to be working as intended

I guess the issues I need to figure out still are how to update nick names being toggled off instantly rather than having to sit and wait for a slow timeout I plan to use for AP.

EDIT 2: apparently keydown(10) only returns true while unpausing, and will not return true while starting a pause. Only solution I can think of is using GraalControl.onKeyDown and checking if keyname == 2nd param.
Pausing is weird, disable default and re-make your own.
__________________
Reply With Quote
  #13  
Old 04-20-2011, 09:08 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
Quote:
Originally Posted by xAndrewx View Post
Pausing is weird, disable default and re-make your own.
How'd you make the player invincible? ^_^
__________________
Reply With Quote
  #14  
Old 04-20-2011, 10:44 PM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
Quote:
Originally Posted by xAndrewx View Post
Pausing is weird, disable default and re-make your own.
I think my solution is just fine really. I don't really want it to show (paused) when players alt tab since it doesn't make them invincible/able to be walked through

PHP Code:
function GraalControl.onKeyDown(cks){
  if(
keyname(10) == k){
    if(
player.paused){ 
      
player.attr[14] = " (paused)";
    }
    else{
      
player.attr[14] = "";
    }
    
player.attr[13] = "un_nick2.gani";
    
setTimer(.05);
  }

I just wish an event was invoked when AP changes at this point...
Reply With Quote
  #15  
Old 04-21-2011, 06:51 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
That's some really hackish stuff you got there.
__________________
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 01:22 PM.


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