Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Attributes Finder (https://forums.graalonline.com/forums/showthread.php?t=58864)

coreys 05-06-2005 04:07 PM

Attributes Finder
 
Well, I was kinda bored so I figured I'd post a fun NPC that anybody can feel free to use, as long as you dont take out the credit to me.
Take note that this is in GS2, I will post a GS1 version later.
PHP Code:

//Made by Vash-Aniki(*coreys)
function onserverside() {
  if (
strequals(params[0],attribs)) {
    
with (getplayer(params[1])) {
      
body player.body;
      
head player.head;
      
sword player.sword;
      
shield player.shield;
      
acct player.account;
  }
 }
}

//#CLIENTSIDE
if (playerchats&&startswith(getattribs,player.chat)) {
  
tokenize player.chat;
  
triggeraction(0,0,serverside,Attributes Finder,attribs,tokens[1]);
  
say2 ("Attributes of "@acct#b"Head:"@head#b"Body:"@body#b"Sword:"@sword#b"Shield:"@shield);



Ajira 05-06-2005 09:24 PM

Did you actually test this? Becuase I highly doubt it works. You should also learn to use GScript2 to it's full advantage.

coreys 05-06-2005 11:45 PM

I was at school when i made it. And I dont feel like finding graal3 to test it >.>

Here's a GS1 version that works:
PHP Code:

//Made by Vash-Aniki(*coreys)
if (actionserverside) {
 if (
strequals(#p(0),attrib)) {
   
with (getplayer(#p(1))) {
     
setstring this.sw,#1;
     
setstring this.sh,#2;
     
setstring this.h,#3;
     
setstring this.b,#8;
  
}
  
say2 Head#s(this.h)#bBody:#s(this.b)#bSword:#s(this.sw)#bShield:#s(this.sh);
 
}
}
//#CLIENTSIDE
if (playerchats&&startswith(/attrib ,#c)) {
  
tokenize #c;
  
triggeraction 0,0,serverside,Attributes Finder,attrib,#t(1);



Rick 05-07-2005 01:43 AM

HTML Code:

// Rewritten from scratch. Public domain goodness.
// You need not credit me for this exceedingly useless utility.
function onActionServerSide()
{
  if (params[0] == "attribs")
  {
    p = findplayer(params[1]);
   
    if (p == null)
    {
      triggerAction(0, 0, "clientside", "Attributes Finder", "attribs", "null", params[1]);
    }
    else
    {
      triggerAction(0, 0, "clientside", "Attributes Finder", "attribs", p.account, p.body, p.head, p.sword, p.shield);
    }
  }
}

//#CLIENTSIDE
function onActionClientside()
{
  if (params[0] == "attribs")
  {
    if (params[1] == "null")
    {
      say2("Player '" @ params[2] @ "' not found.");
    }
    else
    {
      say2
      (
        "Attributes of '" @ params[1] @ "':\n" @
        "Body: " @ params[2] @ "\n" @
        "Head: " @ params[3] @ "\n" @
        "Sword: " @ params[4] @ "\n" @
        "Shield: " @ params[5] @ "\n"
      );
    }
  }
}

function onPlayerChats()
{
  toks = player.chat.trim().tokenize();
 
  if (toks[0] == "/getattribs" && toks[1] != null)
  {
    triggeraction(0, 0, "serverside", "Attributes Finder", "attribs", toks[1]);
  }
}

Now, this likely does not work offhand but it is much better than that horrible code at the beginning of this thread.

coreys 05-07-2005 10:09 PM

Yeah...I'm still learning ^-^'


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

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