Graal Forums  

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

View Poll Results: Was this useful to you?
Yeah 5 71.43%
No 2 28.57%
Voters: 7. You may not vote on this poll

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 10-02-2006, 09:19 PM
KuJi KuJi is offline
Banned
Join Date: Apr 2004
Location: Staten Island, New York
Posts: 2,202
KuJi will become famous soon enough
Send a message via ICQ to KuJi Send a message via AIM to KuJi Send a message via MSN to KuJi Send a message via Yahoo to KuJi
IRC Chat W/ RC Chat (If Staff)

Another great script from KuJi . This allows the use of multiple irc chatrooms (to join) aswell as if you are staff you will be able to get an RC Tab (unclosable though - atleast for now.. I may change that sometime though**)

Anyway, don't forget to rep me . As my rep rises, I will add more scripts to the code gallery . Enjoy.. and if you are too use this PLEASE DO NOT TAKE MY NAME OUT. I'd prefer to keep the credit I deserve, expecially if you want updates to this .

To open / close the program hold Shift and 1. Enjoy .

( Also if you have a request.. forum pm me it )

PHP Code:
// NPC Made by KuJi
/*
  If you use this script you must leave my name
  above aswell as in the text of each starting
  window. If you do not respect this simple
  rule I have I will stop releasing scripts
  for the public. Thanks, KuJi aka Joey.
*/

//#CLIENTSIDE
function onCreated()
{
  
this.isstaff false;
  
requesttext("options""");
  
  
sendtext("irc""login"player.nick);
  
onShowGUI();
}

function 
onShowGUI()
{
  if (
GIRC_Window0 != NULL)
  {
    
GIRC_Window0.destroy();
  }
  
  new 
GuiWindowCtrl(GIRC_Window0)
  {
    
profile  "GuiBlueWindowProfile";
    
extent   = {554403};
    
position = {271125};

    
text     "IRC Chat - Made by KuJi (V 1.0)";
    
visible  false;

    new 
GuiTabCtrl(GIRC_Tab)
    {
      
profile "GuiBlueTabProfile";
      
extent = {53525};
      
position = {833};
      
      
horizSizing "width";
      
      
clearrows();
    }
    
    new 
GuiScrollCtrl(GIRC_Scroll1)
    {
      
profile     "GuiBlueScrollProfile";
      
extent      = {386314};
      
position    = {658};
      
      
hscrollbar  "dynamic";
      
vscrollbar  "dynamic";
      
      
horizSizing "width";
      
vertSizing  "height";
    }
    
    new 
GuiScrollCtrl(GIRC_Scroll2)
    {
      
profile     "GuiBlueScrollProfile";
      
extent      = {157314};
      
position    = {39158};
      
      
hscrollbar  "dynamic";
      
vscrollbar  "dynamic";
      
      
horizSizing "left";
      
vertSizing  "height";
    }
    
    new 
GuiTextEditCtrl(GIRC_Edit)
    {
      
profile GuiBlueTextEditProfile;
      
extent  = {54225};
      
position = {6372};
      
      
text "";
      
      
historysize 50;
      
horizSizing "width";
      
vertSizing  "top";
    }
  }
}

function 
GIRC_Tab.onSelect(tabidtabtexttabindex)
{
  for (
temp.var: GIRC_Tab.rows)
  {
    if (
temp.var.text == tabtext)
    {
      
temp.textobj makevar("GIRC_Text_" temp.var.tabid);
      
temp.listobj makevar("GIRC_List_" temp.var.tabid);
            
      
temp.textobj.visible true;
      
temp.listobj.visible true;
      
      break;
    }
  }
}

function 
GIRC_Tab.onDeselect(tabidtabtexttabindex)
{
  for (
temp.var: GIRC_Tab.rows)
  {
    if (
temp.var.text == tabtext)
    {
      
temp.textobj makevar("GIRC_Text_" temp.var.tabid);
      
temp.listobj makevar("GIRC_List_" temp.var.tabid);
            
      
temp.textobj.visible false;
      
temp.listobj.visible false;
      
      break;
    }
  }
}

function 
GIRC_Edit.onAction()
{
  if (
GIRC_Edit.text.starts("/join"))
  {
    
sendtext("irc""join"GIRC_Edit.text.substring(6));
  }
    elseif (
GIRC_Edit.text.starts("/part"))
  {
    
sendtext("irc""part"GIRC_Edit.text.substring(6));
  }
    elseif (
GIRC_Edit.text.starts("/"))
  {
    
onAddMsg({"unknown or incomplete command, type /help for more info"GIRC_Tab.getselectedtext() , "unknown or incomplete command, type /help for more info"});
  }
    elseif (
GIRC_Edit.text != NULL)
  {
    if (
GIRC_Tab.getselectedtext() == "RemoteControl")
    {
      
sendtorc(GIRC_Edit.text);
    }
      else
    {
      
sendtext("irc""privmsg", {GIRC_Tab.getselectedtext(), GIRC_Edit.text});
    }
  }
  
  
GIRC_Edit.text "";
}

function 
onReceiveText(texttypetextoptionstextlines)
{
  if (
texttype == "options")
  {
    
this.isstaff true;
    
requesttext("clientrc"1);
    
onJoinChat("RemoteControl");
    
    
onTimeout();
  }
    elseif (
texttype == "irc")
  {
    switch (
textoptions)
    {
      case 
"addchanneluser":
      {
        
// Add Player to Channel
        
temp.tfound onFindTab(textlines[0]);
        
        if (
temp.tfound >= 0)
        {
          
temp.listobj makevar("GIRC_List_" temp.tfound);
          
          
temp.listobj.addrow(this.newUser++, textlines[1]);
        }
        
        break;
      }
      
      case 
"deletechanneluser":
      {
        
// Remove Player from Channel
        
temp.tfound onFindTab(textlines[0]);
        
        if (
temp.tfound >= 0)
        {
          
temp.listobj makevar("GIRC_List_" temp.tfound);

          
temp.listobj.removerow(temp.listobj.findtext(textlines[1]));
        }
      
        break;
      }
      
      case 
"join":
      {
        
// Join Channel
        
onJoinChat(textlines[0]);
        
        break;
      }

      case 
"part":
      {
        
// Leave Channel
        
onLeaveChat(textlines[0]);
          
        break;
      }
      
      case 
"privmsg":
      {
        
// Get Message (Regular Message)
        
onAddMsg(textlines);
        
        break;
      }
    }
  }
}

function 
onRCChat(text)
{
  
onAddMsg({text.substring(0text.pos(":")), "RemoteControl"text.substring(text.pos(":") + 1)});
}

function 
onAddMsg(temp.tlines)
{
  
temp.tfound onFindTab(temp.tlines[1]);

  if (
temp.tfound >= 0)
  {
    if (
textlines[0].substring(0temp.tlines[0].pos("_")) == player.account)
    {
      
temp.color "FF0000";
    }
      else
    {
      
temp.color "00FF00";
    }
    
    
temp.textobj makevar("GIRC_Text_" temp.tfound);
    
temp.textobj.text format("%s<br><font color=#%s>%s:</font> %s"temp.textobj.texttemp.colortemp.tlines[0], temp.tlines[2]);
  }
}

function 
onJoinChat(newChan)
{
  
// Add to Tab
  
with (GIRC_Tab.addrow(thiso.ircChat++, newChan))
  {
    
this.tabid thiso.ircChat;
    
GIRC_Tab.setselectedbyid(this.id);
  }
  
  
// Create Text
  
with (GIRC_Scroll1)
  {
    new 
GuiMLTextCtrl("GIRC_Text_" thiso.ircChat)
    {
      
profile  GuiBlueMLTextProfile;
      
extent   = {375120};
      
position = {32};
      
text     "<font color=#FF0000 size=15><b><u>Graal IRC V1.0 Scripted by Joey. Last updated on October 02, 2006</u></b></font>";
      
wordwrap true;
    }
  }
  
  
// Create List
  
with (GIRC_Scroll2)
  {
    new 
GuiTextListCtrl("GIRC_List_" thiso.ircChat)
    {
      
profile        GuiBlueTextListProfile;
      
position       = {00};
      
width          140;
      
fitparentwidth true;
    
      
clearrows();
      
addrow(0player.account);
      
setSelectedRow(1);
    }
  }
}

function 
onLeaveChat(newChan)
{
  
temp.tfound onFindTab(newChantrue);
  
  if (
temp.tfound[0] >= 0)
  {
    
temp.listobj      makevar("GIRC_List_" temp.tfound[1]);
    
temp.textobj      makevar("GIRC_Text_" temp.tfound[1]);
    
temp.textobj.text "";
    
    
temp.listobj.destroy();
    
temp.textobj.destroy();
    
    
GIRC_Tab.removerowbyid(temp.tfound[0]);
  }
}

function 
onFindTab(ircTabircType)
{
  for (
temp.var: GIRC_Tab.rows)
  {
    if (
temp.var.text == ircTab)
    {
      if (
ircType != NULL)
      {
        return {
temp.var.idtemp.var.tabid};
      }
        else
      {
        return 
temp.var.tabid;
      }
    }
  }
  
  return -
1;
}

function 
onFindRCS()
{
  
temp.tfound onFindTab("RemoteControl");
  
  if (
temp.tfound >= 0)
  {
    
temp.newUser 0;
    
temp.listobj makevar("GIRC_List_" temp.tfound);
    
temp.listobj.clearrows();
    
    for (
temp.var: allplayers)
    {
      if (!
temp.var.account.starts("irc") && temp.var.level == "" && temp.var.account != "(npcserver)")
      {        
        
temp.listobj.addrow(temp.newUser++, temp.var.account);
      }
    }
  }
}

function 
onTimeout()
{
  
onFindRCS();
  
  
setTimer(5);
}

function 
onKeyPressed(keycodekeychar)
{
  if (
keycode == 305)
  {
    
GIRC_Window0.visible = !GIRC_Window0.visible;
  }

Commands:
/join #CHANNEL_NAME
/part #CHANNEL_NAME
Attached Thumbnails
Click image for larger version

Name:	graal_1159817249.png
Views:	407
Size:	98.4 KB
ID:	38094  

Last edited by KuJi; 10-02-2006 at 11:45 PM..
Reply With Quote
  #2  
Old 10-03-2006, 04:02 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
Quote:
Originally Posted by KuJi View Post
Anyway, don't forget to rep me . As my rep rises, I will add more scripts to the code gallery
Should add scripts for the general advancement of graal - not for personal rep points

Anywho. Only 1 problem I have found, it shows global buddies in the RC playerlist =(

Last edited by Twinny; 10-03-2006 at 04:16 AM..
Reply With Quote
  #3  
Old 10-03-2006, 04:39 AM
KuJi KuJi is offline
Banned
Join Date: Apr 2004
Location: Staten Island, New York
Posts: 2,202
KuJi will become famous soon enough
Send a message via ICQ to KuJi Send a message via AIM to KuJi Send a message via MSN to KuJi Send a message via Yahoo to KuJi
Quote:
Originally Posted by Twinny View Post
Should add scripts for the general advancement of graal - not for personal rep points

Anywho. Only 1 problem I have found, it shows global buddies in the RC playerlist =(
And it also doesn't show player rcs, I'll fix soon.
Reply With Quote
  #4  
Old 10-03-2006, 04:50 PM
Moondeath_2 Moondeath_2 is offline
"..."
Moondeath_2's Avatar
Join Date: Jan 2006
Location: Far Far Away.
Posts: 238
Moondeath_2 is an unknown quantity at this point
Send a message via AIM to Moondeath_2 Send a message via MSN to Moondeath_2 Send a message via Yahoo to Moondeath_2
Quote:
Originally Posted by Twinny View Post
Should add scripts for the general advancement of graal - not for personal rep points

Anywho. Only 1 problem I have found, it shows global buddies in the RC playerlist =(
You should post some cool stuff.
__________________
Aim: DarkFireXZ3
Email: [email protected] or [email protected]
Common Location: Unholy Nation
Gscript, Playerworld Rules, Support Center
Reply With Quote
  #5  
Old 10-03-2006, 09:13 PM
KuJi KuJi is offline
Banned
Join Date: Apr 2004
Location: Staten Island, New York
Posts: 2,202
KuJi will become famous soon enough
Send a message via ICQ to KuJi Send a message via AIM to KuJi Send a message via MSN to KuJi Send a message via Yahoo to KuJi
Quote:
Originally Posted by Moondeath_2 View Post
You should post some cool stuff.
He's just jeolous cuz I know what teh community likes .

Besides, I only made this becuz Shrobo went COOL @ your irc chat =( (which was soo basic)
Reply With Quote
  #6  
Old 10-03-2006, 09:14 PM
zephirot zephirot is offline
Banned?
Join Date: Sep 2004
Location: Paris
Posts: 1,311
zephirot is a name known to allzephirot is a name known to allzephirot is a name known to all
Send a message via AIM to zephirot Send a message via MSN to zephirot
Nice, but whats up with the pokemon thing in the bacground?
__________________

Quote:
Originally Posted by unixmad
Can you just shut up ?
MAGA
MFGA
MEGA
Reply With Quote
  #7  
Old 10-03-2006, 09:15 PM
KuJi KuJi is offline
Banned
Join Date: Apr 2004
Location: Staten Island, New York
Posts: 2,202
KuJi will become famous soon enough
Send a message via ICQ to KuJi Send a message via AIM to KuJi Send a message via MSN to KuJi Send a message via Yahoo to KuJi
Quote:
Originally Posted by zephirot View Post
Nice, but whats up with the pokemon thing in the bacground?
.. I wanna be the very best.

Just don't worry about that for now ;P
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 05:23 AM.


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