Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-07-2009, 06:41 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
player log offline

so, i have found
function onPlayerLeaves()
but thats if the player leaves a level


whats the function if the player logs offline?

also, if someone has a full list of the functions can you post them? thank you.
Reply With Quote
  #2  
Old 01-07-2009, 06:58 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
PHP Code:
function onPlayerLogout(account) {
  
temp.pl findplayer(account);

__________________
Reply With Quote
  #3  
Old 01-07-2009, 07:55 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Quote:
Originally Posted by Chompy View Post
PHP Code:
function onPlayerLogout(account) {
  
temp.pl findplayer(account);

The first parameter is already the object of the player/RC/IRC that leaves.
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #4  
Old 01-07-2009, 11:52 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
PlayerLogout is called for more than just players and RCs, so you may want to do something like this to make sure you're only getting players and RCs:

PHP Code:
function onPlayerLogout(pl) {
  if (! 
pl.account.length() > 0) {
    return;
  }

__________________
Reply With Quote
  #5  
Old 01-08-2009, 12:22 AM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by xXziroXx View Post
The first parameter is already the object of the player/RC/IRC that leaves.
Ah.

I think it's weird that findplayer allows objects as input D: Graal Script is way too.. 'soft' if you ask me :o
__________________
Reply With Quote
  #6  
Old 01-08-2009, 02:28 AM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by Chompy View Post
Ah.

I think it's weird that findplayer allows objects as input D: Graal Script is way too.. 'soft' if you ask me :o
It's not so much "allowing objects as input", it's just a consequence of variant typing. When you pass an object to something where there should be a string, it is just taking the name of the object and passing that instead. In this case, the account name is the name of the object.
Reply With Quote
  #7  
Old 01-08-2009, 05:03 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Quote:
Originally Posted by cbk1994 View Post
PlayerLogout is called for more than just players and RCs, so you may want to do something like this to make sure you're only getting players and RCs:

PHP Code:
function onPlayerLogout(pl) {
  if (
pl.objecttype() != "TServerPlayer") {
    return;
  }

Fixed.
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #8  
Old 01-08-2009, 09:12 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
onPlayerLogout is only called for players, it's called on the actual logout and when a player is switched to observer mode
Reply With Quote
  #9  
Old 01-08-2009, 09:23 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Quote:
Originally Posted by Stefan View Post
onPlayerLogout is only called for players, it's called on the actual logout and when a player is switched to observer mode
Are you 100% sure of that? I'm pretty confident in having had non-TServerPlayer objects trigger that function.
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #10  
Old 01-08-2009, 11:02 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Skyld View Post
It's not so much "allowing objects as input", it's just a consequence of variant typing. When you pass an object to something where there should be a string, it is just taking the name of the object and passing that instead. In this case, the account name is the name of the object.
That's the same as doing findplayer(findplayer("Chompy").account); :o?

But yeah, I guess it's kinda neat to have, for example when comparing: if (player.level == "osl.nw")
__________________
Reply With Quote
  #11  
Old 01-08-2009, 11:06 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 Chompy View Post
But yeah, I guess it's kinda neat to have, for example when comparing: if (player.level == "osl.nw")
Which can go horribly wrong. I have experienced quite some bugs with that.
Reply With Quote
  #12  
Old 01-09-2009, 03:48 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 have too. I think it would be best to always use .name (or .account in this case). Even if it doesn't improve the script, it makes it easier to understand, especially to new scripters.
__________________
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 07:15 PM.


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