Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   Scripted /clientstats accountname (https://forums.graalonline.com/forums/showthread.php?t=86673)

fowlplay4 07-03-2009 04:59 AM

Scripted /clientstats accountname
 
Was looking through help today and saw..

/clientstats accountname: shows client stats (requires Graal v6)

So I figured.. that can't be right! I would like that functionality now...

5 or so minutes later I arrived to this basic script..

PHP Code:

// For this post sakes I named this: -ExampleWeapon
function onActionServerSide() {
  if (
params[0] == "clientstats") {
    
// Display Results
    
echo("Clientstats for " player.account);
    for (
temp.lineparams[1]) {
      echo(
temp.line);
    }
  }
}

//#CLIENTSIDE

function onActionClientside() {
  if (
params[0] == "getclientstats"onClientStats();
}

function 
onClientStats() { 
  
// Clear Scripts Log
  
F2LogWindow_Text2.text "";
  
// Get Script Stats
  
shared.chat("showscriptstats");
  
// Wait.. so the scriptstats command can do it's work.
  
sleep(0.1);
  
// Strip HTML from Results
  
for (temp.lineF2LogWindow_Text2.getlines()) {
    
temp.line temp.line.substring(line.pos(">")+1);
    
temp.line temp.line.substring(0line.pos("<"));
    
temp.packet.add(temp.line);
  }
  
// Transfer Serverside
  
triggerserver("gui"name"clientstats"temp.packet);


Then you'd trigger the client..

PHP Code:

function onClientStats(acct) {
  
findplayer(acct).triggerclient("-ExampleWeapon""getclientstats");


Then NC gets spammed :D, so you may want to add the line..

PHP Code:

if (temp.line.pos("Gani player") >= 0) continue; 

Into the for loop when it's stripping html. Enjoy!

DustyPorViva 07-03-2009 05:03 AM

Could limit it to the top 10 NPCs... really no need to see the random NPC's taking up 0.001% most of the time. Perhaps have it catch the top 10 by default, and allow a parameter to capture x amounts.

fowlplay4 07-03-2009 05:13 AM

Quote:

Originally Posted by DustyPorViva (Post 1503746)
Could limit it to the top 10 NPCs... really no need to see the random NPC's taking up 0.001 most of the time. Perhaps have it catch the top 10 by default, and allow a parameter to capture x amounts.

If people request it I'll add it :) Until then, I found that just having Gani Player not show really trims the result then again I did test/make this outside of Zodiac's OSL.

Skyld 07-03-2009 01:25 PM

The /clientstats function is more than the top NPCs taking CPU. :) It is also showing which elements of the game engine are taking most time (drawing tilesets, networking, input, etc.) and running clientside function profiling. It is also PMed to you from the player whose stats you requested so that you do not spam RC.

Looks nice, though.

Crow 07-03-2009 02:38 PM

Quote:

Originally Posted by Skyld (Post 1503826)
The /clientstats function is more than the top NPCs taking CPU. :) It is also showing which elements of the game engine are taking most time (drawing tilesets, networking, input, etc.) and running clientside function profiling. It is also PMed to you from the player whose stats you requested so that you do not spam RC.

Looks nice, though.

Holy ****, I want that badly.

Skyld 07-03-2009 02:59 PM

Quote:

Originally Posted by Crow (Post 1503845)
Holy ****, I want that badly.

It's incredibly useful; I use it a lot when testing the iPhone client because with it being a slower processor and not having an F2 window that's readily accessible, it helps to weed out laggy scripts and such.


All times are GMT +2. The time now is 07:24 AM.

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