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 03-25-2007, 02:36 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
getguildnick(guild, account)

So, does this feature work? I think not.
Working on a basic tag feature, can anyone see why?
HTML Code:
function onPlayerChats()
  {
  if (this.guildowner.index(player.account) == -1) 
    return false;
  temp.playerChat = player.chat.tokenize();
  temp.playerOption = temp.playerChat[0];
  temp.playerParams = player.chat.substring((temp.playerOption.length() + 1)).tokenize();
  switch(temp.playerOption.substring(1))
    {
    case "add":
      this.chat = getguildnick("FAQ", player.account);
      if (getguildnick("FAQ", temp.playerParams[0]) == "") 
        {
        temp.playerAccount = findPlayer(temp.playerParams[0]);
        if (temp.playerAccount.account)
          {
          addguildmember("FAQ", temp.playerParams[0], temp.playerParams[1]);
          this.doMessage({{player.account, format(_("You've added %s [%s]!"), temp.playerParams[0], temp.playerParams[1])},
                          {temp.playerAccount.account, format(_("You've been added to the FAQ Team!\n%s (FAQ)"), temp.playerParams[1])}
                         });
          }
         else
          {
          this.doMessage({{player.account, format(_("%s Isn't online!"),temp.playerParams[0])}});
          } 
        }
       else
        {
        this.doMessage({{player.account, format(_("%s already has a tag! [%s]"), temp.playerParams[0], getguildnick("FAQ", temp.playerParams[0]))}});
        }
    break;
    case "remove":
      if (getguildnick("FAQ", temp.playerParams[0])) 
        {  
          removeguildmember("FAQ", temp.playerParams[0]);
          this.doMessage({{player.account, format(_("You've removed %s!"), temp.playerParams[0])},
                          {temp.playerParams[0], "You've been removed from the FAQ Team!"}
                         });    
        }
       else
        {
        this.doMessage({{player.account, format(_("%s Isn't in the FAQ Team!"),temp.playerParams[0])}});
        }
    break;  
    }
  }
function doMessage(messageData)
  for (temp.currentMessage: temp.messageData)
    findPlayer(temp.currentMessage[0]).sendpm(temp.currentMessage[1]);
Reply With Quote
  #2  
Old 03-25-2007, 03:40 PM
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
Maybe you would like to explain why the code is not working and what behaviour you are expecting. :|
__________________
Skyld
Reply With Quote
  #3  
Old 03-25-2007, 03:55 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
right.
PHP Code:
getguildnick(guildaccount
Does this work? [Answer being yes or no of cause]
If answer is to be yes, what am I doing wrong.
Reply With Quote
  #4  
Old 03-25-2007, 04:06 PM
godofwarares godofwarares is offline
Webmaster
godofwarares's Avatar
Join Date: Dec 2006
Location: Florida
Posts: 552
godofwarares is on a distinguished road
Send a message via ICQ to godofwarares Send a message via AIM to godofwarares Send a message via MSN to godofwarares Send a message via Yahoo to godofwarares
Quote:
Originally Posted by Chandler View Post
right.
PHP Code:
getguildnick(guildaccount
Does this work? [Answer being yes or no of cause]
If answer is to be yes, what am I doing wrong.
Yes, but it has to be called from serverside. Clientside doesn't work.
__________________
What signature? I see no signature?
Reply With Quote
  #5  
Old 03-25-2007, 05:28 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Quote:
Originally Posted by godofwarares View Post
Yes, but it has to be called from serverside. Clientside doesn't work.
The code that I posted isn't clientside, rofl
Reply With Quote
  #6  
Old 03-25-2007, 05:45 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Quote:
Originally Posted by Chandler View Post
The code that I posted isn't clientside, rofl
I didn't know that the PlayerChats event was called serverside...?
__________________
Reply With Quote
  #7  
Old 03-25-2007, 05:50 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Quote:
Originally Posted by Inverness View Post
I didn't know that the PlayerChats event was called serverside...?
I should make it clear, it's for a class.
Reply With Quote
  #8  
Old 03-25-2007, 06:00 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Quote:
Originally Posted by Chandler View Post
I should make it clear, it's for a class.
How does this change the fact that onPlayerChats() is not called on the serverside? Which is obviously the initial function of your script.
__________________
Reply With Quote
  #9  
Old 03-25-2007, 06:06 PM
godofwarares godofwarares is offline
Webmaster
godofwarares's Avatar
Join Date: Dec 2006
Location: Florida
Posts: 552
godofwarares is on a distinguished road
Send a message via ICQ to godofwarares Send a message via AIM to godofwarares Send a message via MSN to godofwarares Send a message via Yahoo to godofwarares
You don't call onPlayerChats() on serverside ...
__________________
What signature? I see no signature?
Reply With Quote
  #10  
Old 03-25-2007, 06:12 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
ok... explain why not? Also explain how it works for that matter. Thank you.
Reply With Quote
  #11  
Old 03-25-2007, 06:18 PM
godofwarares godofwarares is offline
Webmaster
godofwarares's Avatar
Join Date: Dec 2006
Location: Florida
Posts: 552
godofwarares is on a distinguished road
Send a message via ICQ to godofwarares Send a message via AIM to godofwarares Send a message via MSN to godofwarares Send a message via Yahoo to godofwarares
Quote:
Originally Posted by Chandler View Post
ok... explain why not? Also explain how it works for that matter. Thank you.
When the player chats, its triggered clientside, not serverside. You can't receive triggers serverside if they are triggered clientside.

Use a triggerServer();.
__________________
What signature? I see no signature?
Reply With Quote
  #12  
Old 03-25-2007, 06:20 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
You're making no sense. You are aware of what a class is right?
Reply With Quote
  #13  
Old 03-25-2007, 06:33 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
And you're aware of the fact that classes also have a clientside and serverside right?

If the object is in a level and you want to send info to the serverside, then you can set a shape to the object on both sides and trigger an action on the object with the parameters you need, the action will be called on serverside & clientside as a result.
__________________
Reply With Quote
  #14  
Old 03-25-2007, 06:42 PM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
I know of format() but not of format(_()) whats that do?
Reply With Quote
  #15  
Old 03-25-2007, 06:45 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Lets move along from the calling of the function. Is anyone else having any problems with
PHP Code:
getguildnick(guildaccount
Thank you...

Just more organized.
PHP Code:
format(_("%s hiya"), player.account
Reply With Quote
  #16  
Old 03-25-2007, 06:56 PM
godofwarares godofwarares is offline
Webmaster
godofwarares's Avatar
Join Date: Dec 2006
Location: Florida
Posts: 552
godofwarares is on a distinguished road
Send a message via ICQ to godofwarares Send a message via AIM to godofwarares Send a message via MSN to godofwarares Send a message via Yahoo to godofwarares
Quote:
Originally Posted by Chandler View Post
You're making no sense. You are aware of what a class is right?
No duh. You're not listening to what i'm saying:

PHP Code:
function onPlayerChats() // WON'T work

//#CLIENTSIDE
function onPlayerChats() // WILL work 
Simple as that.

P.S:
PHP Code:
triggerServer("class""classname""function""params"); 
__________________
What signature? I see no signature?
Reply With Quote
  #17  
Old 03-25-2007, 07:02 PM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
I've used player.chat/onPlayerChats on Serverside and it worked fine, well it was a Tad slower but it still worked none the less

EDIT: Also I've never really heard of this function. What exactly are you trying to do? Add the guild tag to the player no matter what their nick is? Maybe something else?
__________________
Deep into the Darkness peering...
Reply With Quote
  #18  
Old 03-25-2007, 07:03 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Quote:
Originally Posted by godofwarares View Post
No duh. You're not listening to what i'm saying:

PHP Code:
function onPlayerChats() // WON'T work

//#CLIENTSIDE
function onPlayerChats() // WILL work 
Simple as that.

P.S:
PHP Code:
triggerServer("class""classname""function""params"); 
rofl, you don't understand at all.

Quote:
Originally Posted by Angel_Light View Post
I've used player.chat serverside and it worked fine, well it's a tad slower than the clientside but it still worked, o.O
Yeah. I don't think either of them understand.
Thank you


Upon debugging with a friend, we found the error.
Thanks
Reply With Quote
  #19  
Old 03-25-2007, 07:13 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
*shrug*
You need to be more specific next time.
__________________
Reply With Quote
  #20  
Old 03-25-2007, 07:14 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Yeah, I guess when people don't understand how a class or a level object work it can be rather difficult.
Quote:
Originally Posted by Inverness View Post
I didn't know that the PlayerChats event was called serverside...?
I should make it clear, it's for a class.
Reply With Quote
  #21  
Old 03-26-2007, 01:12 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
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
Newbs.

onPlayerChats() only doesn't work on serverside in a wNPC, if its in a local npc/class/DB it WILL work serverside.

And to answer your question Chandler, yes - your getguildname(guild, account) will (should) work, I've used it in the same way and it works.

I refer you to this thread: http://forums.graalonline.com/forums...ad.php?t=71885
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #22  
Old 03-26-2007, 08:36 AM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Quote:
Originally Posted by xXziroXx View Post
Newbs.

onPlayerChats() only doesn't work on serverside in a wNPC, if its in a local npc/class/DB it WILL work serverside.

And to answer your question Chandler, yes - your getguildname(guild, account) will (should) work, I've used it in the same way and it works.

I refer you to this thread: http://forums.graalonline.com/forums...ad.php?t=71885
That's where I got the idea from, hehe. I have a problem with adding myself though, but it works for everyone else. Thank you.
Reply With Quote
  #23  
Old 03-26-2007, 09:08 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
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
Quote:
Originally Posted by Chandler View Post
That's where I got the idea from, hehe. I have a problem with adding myself though, but it works for everyone else. Thank you.
You're welcome!
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #24  
Old 03-28-2007, 09:39 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Lol @ the "lol nub onPlayerChats can't be called serverside?!?!?!"

Perhaps you were thinking about ChatBar.onAction? That can't be read serverside .

If you have onPlayerChats serverside in a weapon, everyone in that level can call that event - even if only one player has it.
Reply With Quote
  #25  
Old 03-28-2007, 11:00 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
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
Quote:
Originally Posted by Twinny View Post
Lol @ the "lol nub onPlayerChats can't be called serverside?!?!?!"

Perhaps you were thinking about ChatBar.onAction? That can't be read serverside .

If you have onPlayerChats serverside in a weapon, everyone in that level can call that event - even if only one player has it.
I'm quite sure that it cant be called from a Weapon on serverside, atleast it couldn't in the past.

EDIT: I just tried it, it didn't work. I tried to make a wNPC with only a serversided onPlayerChats and I tried making one with some useless script on clientside and a onPlayerChats serverside. None worked.
__________________
Follow my work on social media post-Graal:Updated august 2025.

Last edited by xXziroXx; 03-28-2007 at 11:36 AM..
Reply With Quote
  #26  
Old 03-28-2007, 02:07 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Quote:
Originally Posted by xXziroXx View Post
I'm quite sure that it cant be called from a Weapon on serverside, atleast it couldn't in the past.

EDIT: I just tried it, it didn't work. I tried to make a wNPC with only a serversided onPlayerChats and I tried making one with some useless script on clientside and a onPlayerChats serverside. None worked.
Yeah...damn.. I thought of a time where i had a 'if (playerchats)' serverside on a N-pulse weapon (damn gs1) and i remember everyone getting affected by it when they spoke even though i was the only one who had it. I thought i used a weapon .
Reply With Quote
  #27  
Old 03-29-2007, 08:28 AM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
What the hell are you guys talking about...onPlayerChats is a global function both serverside and clientside o_O
__________________
Do it with a DON!
Reply With Quote
  #28  
Old 03-29-2007, 08:36 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
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
Quote:
Originally Posted by zokemon View Post
What the hell are you guys talking about...onPlayerChats is a global function both serverside and clientside o_O
NOT in a Weapon. Never has been, never will be. Try it and see for yourself if you can not take us on our word.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #29  
Old 03-29-2007, 08:40 AM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Quote:
Originally Posted by xXziroXx View Post
NOT in a Weapon. Never has been, never will be. Try it and see for yourself if you can not take us on our word.
Oh maybe not in a weapon...
But for TServerNPC's it DEFINATLY is serverside o_O
__________________
Do it with a DON!
Reply With Quote
  #30  
Old 03-29-2007, 08:42 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
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
Quote:
Originally Posted by zokemon View Post
Oh maybe not in a weapon...
But for TServerNPC's it DEFINATLY is serverside o_O
For everything other then a Weapon, aye.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #31  
Old 03-30-2007, 11:32 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
The only time I ever use onPlayerChats is for weapons so excuse me...
__________________
Reply With Quote
  #32  
Old 03-31-2007, 01:08 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
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
Quote:
Originally Posted by Inverness View Post
The only time I ever use onPlayerChats is for weapons so excuse me...
We're talking about onPlayerChats serversided in a weapon. That does NOT work.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #33  
Old 03-31-2007, 04:41 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Quote:
Originally Posted by xXziroXx View Post
We're talking about onPlayerChats serversided in a weapon. That does NOT work.
Thats the point, I doesn't work for a weapon so I assumed it didn't work for anything else :P

I do have a vague recollection of maybe using it for an npc sometime though...
__________________
Reply With Quote
  #34  
Old 03-31-2007, 05:28 AM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
rofl, you were still wrong
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 07:45 PM.


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