Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-22-2014, 02:02 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Remote Echo / Debugger

Here's a tool I banged out to debug a problem on another player's client.

Using echo's is probably one of the most used tools around here to debug problems and it's a hard habit to break. Refusing to break said habit, I wrote a tool to connect to another player's echo/log window.

It adds a 6th tab to your F2.

You remotely connect by doing: /rdebug account

Then just echo debug as normal.

-RemoteDebugger

PHP Code:
function onActionServerSide() {
  if (
params[0] == "r") {
    if (
clientr.remotedebugger.size() > 0) {
      for (
temp.pclientr.remotedebugger) {
        
temp.pl findplayer(temp.p);
        if (
temp.pl == NULL) {
          
clientr.remotedebugger.remove(temp.p);
        } else {
          
temp.pl.triggerclient("weapon"this.name"r"params[1]);
        }
      }
      if (
clientr.remotedebugger.size() <= 0) {
        
player.removeweapon(this.name);
      }
    }
  }
  else if (
params[0] == "debug") {
    if (!
clientr.isStaff) return;
    
temp.pl findplayer(params[1]);
    if (
temp.pl == NULL) {
      
player.triggerclient("weapon"this.name"r"params[1SPC "could not be found.");
      return;
    }
    if (!(
player.account in temp.pl.clientr.remotedebugger)) {
      
temp.pl.clientr.remotedebugger.add(player.account);
      
temp.pl.addweapon(this.name);
      
player.triggerclient("weapon"this.name"r"temp.pl.account SPC "connected!");
    } else {
      
temp.pl.clientr.remotedebugger.remove(player.account);
      
temp.pl.removeweapon(this.name);
      
player.triggerclient("weapon"this.name"r"temp.pl.account SPC "disconnected!");
    }
  }
  else if (
params[0] == "remove") {
    
player.removeweapon(this.name);
  }
}

//#CLIENTSIDE

function onCreated() {
  if (
clientr.isStaffsetupRemoteTab();
}

function 
ChatBar.onAction() {
  if (
ChatBar.text.starts("/rdebug ")) {
    
temp.pl ChatBar.text.substring("/rdebug ".length());
    
triggerserver("gui"this.name"debug"temp.pl);
    
ChatBar.text "";
  }
}

function 
setupRemoteTab() {
  
F2LogWindow_Tab.removerowbyid(6);
  if (
isObject("F2LogWindow_Scroll6")) {
    
F2LogWindow_Scroll6.destroy();
  }
  
F2LogWindow_Tab.addrow(6"Remote");
  
with (F2LogWindow_Window) {
    new 
F2LogWindow_Scroll0("F2LogWindow_Scroll6") {
      
profile F2LogWindow_Scroll0.profile;
      
F2LogWindow_Scroll0.x;
      
F2LogWindow_Scroll0.y;
      
width F2LogWindow_Scroll0.width;
      
height F2LogWindow_Scroll0.height;
      
vscrollbar "dynamic";
      
hscrollbar "alwaysOff";
      
horizsizing "width";
      
vertsizing "height";
      
visible false;
      new 
F2LogWindow_Text0("F2LogWindow_Text6") {
        
profile F2LogWindow_Text0.profile;
        
text "Remote Debugger Initialized. Usage: /rdebug account\n";
        
2;
        
horizsizing "width";
        
vertsizing "bottom";
        
width F2LogWindow_Scroll0.width 20;
      }
    }
  }
}

function 
onActionClientside() {
  if (
params[0] == "r") {
    
echoremote(params[1]);
  }
}

function 
onLogMessage(txtrgbltype) {
  if (
ltype == "echo") {
    if (
clientr.remotedebugger.size() > 0) {
      
triggerserver("gui"this.name"r"txt);
    } else {
      if (!
clientr.isStaff) {
        
triggerserver("gui"this.name"remove");
      }
    }
  }
}

function 
echoremote(txt) {
  
F2LogWindow_Text6.addtext(txt NL ""true);
  
F2LogWindow_Scroll6.scrolltobottom();

__________________
Quote:

Last edited by fowlplay4; 03-22-2014 at 03:22 AM..
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 05:03 PM.


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