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 16 88.89%
No 2 11.11%
Voters: 18. You may not vote on this poll

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-30-2006, 08:35 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
RC NPC-Control (Ingame)

Okay.. this was my first attempt to make an NPC-Control ingame. It's about 309 lines or so. Picture Included.

Rep is a nice way to thank me btw =).. maybe I'll add some other cool thingys. Anywa.. tell me if its useful VIA poll.

PHP Code:
// NPC Made by KuJi - V1.0
//#CLIENTSIDE
function onCreated()
{
  
requesttext("clientrc"1);
  
  
onShowGUI();
}

function 
onShowGUI()

  if (
NC_Window != NULL)
  {
    
NC_Window.destroy();
  }
  
  new 
GuiWindowCtrl(NC_Window)
  {
    
height               460;
    
profile              GuiBlueWindowProfile;
    
text                 "NC Control (V1.0 by KuJi) ";
    
width                577;
    
x                    150;
    
y                    150;
    
    
visible              false;
    
    new 
GuiTabCtrl(NC_Tab)
    {
      
profile "GuiBlueTabProfile";
      
extent = {38025};
      
position = {18335};
      
      
horizSizing "width";
      
clearrows();
    }
    
    new 
GuiScrollCtrl(NC_Frame1)
    {
      
profile        GuiBlueScrollProfile;
      
extent         = {175431};
      
position       = {623};
      
      
hScrollBar     "dynamic";
      
vScrollBar     "dynamic";
      
vertSizing     "height";
      
      
useownprofile  true;
      
profile.opaque false;
      
      new 
GuiTreeViewCtrl(NC_Tree)
      {
        
profile GuiBlueTreeViewProfile;
        
0;
        
fitparentwidth true;
       
        
clearnodes();
        
addnodebypath("Classes""/");
        
addnodebypath("NPCS""/");
        
addnodebypath("Weapons""/");
      }
    }
    
    new 
GuiScrollCtrl(NC_Frame2)
    {
      
profile        GuiBlueScrollProfile;
      
extent         = {388355};
      
position       = {18260};
      
      
hScrollBar     "dynamic";
      
vScrollBar     "dynamic";
      
horizSizing    "width";
      
vertSizing     "height";
      
      
useownprofile  true;
      
profile.opaque false;
    }
    
    new 
GuiButtonCtrl(NC_Close)
    {
      
profile     GuiBlueButtonProfile;
      
extent      = {6525};
      
position    = {360423};
      
      
horizSizing "left";
      
vertSizing  "top";
      
text        "Close";
      
      
thiso.catchevent(this.name"onAction""onActionButton");
    }
    
    
    new 
GuiButtonCtrl(NC_Reload)
    {
      
profile     GuiBlueButtonProfile;
      
extent      = {6525};
      
position    = {430423};
      
      
horizSizing "left";
      
vertSizing  "top";
      
      
text        "Reload";
      
      
thiso.catchevent(this.name"onAction""onActionButton");
    }
    
    new 
GuiButtonCtrl(NC_Save)
    {
      
profile     GuiBlueButtonProfile;
      
extent      = {6525};
      
position    = {500423};
      
      
horizSizing "left";
      
vertSizing  "top";
      
      
text        "Save";
      
      
thiso.catchevent(this.name"onAction""onActionButton");
    }
  }
}

function 
NC_Tab.onSelect(tabidtabtexttabindex)
{
  for (
temp.var: NC_Tab.rows)
  {
    if (
temp.var.text == tabtext)
    {
      
temp.var.scriptedit.visible true;
    }
  }
}

function 
NC_Tab.onDeselect(tabidtabtexttabindex)
{
  for (
temp.var: NC_Tab.rows)
  {
    if (
temp.var.text == tabtext)
    {
      
temp.var.scriptedit.visible false;  
    }
  }
}


function 
NC_Tree.onDblClick(nodenodeslashpathnodedotpath)
{
  if (
nodeslashpath.starts("Classes/"))
  {
    
requesttext("class"nodeslashpath.substring(8));
  }
    elseif (
nodeslashpath.starts("Weapons/"))
  {
    
requesttext("weapon"nodeslashpath.substring(8));
  }
    elseif (
nodeslashpath.starts("NPCS/"))
  {
    
requesttext("npc"nodeslashpath.substring(5));
  }
}

function 
onReceiveText(texttypetextoptiontextlines)
{
  if (
texttype in {"classlist""npclist""weaponlist"})
  {
    
onAddScripts(textoptiontextlines);
  }
    elseif (
texttype in {"class""npc""weapon"})
  {
    
onViewScript(texttypetextoptiontextlines);
  }
}

function 
onAddScripts(temp.prefixtemp.textlines)
{
  if (
temp.prefix != NULL)
  {
    for (
temp.var: temp.textlines)
    {
      if (
temp.var != NULL)
      {
        
with (NC_Tree.addnodebypath(temp.prefix temp.var, "/"))
        {
          
image selectedimage 2;
        }
      }
    }
  }
}

function 
onViewScript(temp.texttypetemp.textoptiontemp.textlines)
{
  
temp.found NC_Tab.findtextid(temp.textoption);
  
  if (
temp.found >= 0)
  {
    
NC_Tab.setselectedbyid(temp.found);
    
    for (
temp.var: NC_Tab.rows)
    {
      if (
temp.var.id == temp.found)
      {
        
temp.var.scriptedit.setlines(temp.textlines);
      }
    }
    
    return 
true;
  }
    else
  {
    
    
with (NC_Frame2)
    {
      new 
GuiMLTextEditCtrl("NC_Edit_" temp.texttype "_" temp.textoption)
      {
        
profile            "TextEditorProfile";
        
extent             = {365225};
        
position           = {66};
        
        
horizSizing        "width";
        
vertSizing         "height";
        
        
syntaxHighlighting true;
        
wordwrap           false;
      
        
this.edittype      temp.texttype;
        
this.editoption    temp.textoption;
        
        
setlines(temp.textlines);
      }
    }
  
    
with (NC_Tab.addrow(this.tabid++, temp.textoption))
    {
      
this.scriptedit makevar("NC_Edit_" temp.texttype "_" temp.textoption);
      
NC_Tab.setselectedbyid(this.id);
    }
  } 
}

function 
onActionButton(obj)
{
  
temp.ncid NC_Tab.getselectedid();
  
  if (
temp.ncid <= -1)
  {
    return 
false;
  }
  
  switch (
obj.substring(3))
  {
    case 
"Close":
    {
      for (
temp.var: NC_Tab.rows)
      {
        if (
temp.var.id == temp.ncid)
        {
          
temp.var.scriptedit.destroy();
          
NC_Tab.removerowbyid(temp.ncid);
          
NC_Frame2.extent = {388355};
          
          break;
        }
      }
    
      break;
    }
    
    case 
"Reload":
    {
      for (
temp.var: NC_Tab.rows)
      {
        if (
temp.var.id == temp.ncid)
        {
          
requesttext(temp.var.scriptedit.edittypetemp.var.scriptedit.editoption);
          
          break;
        }
      }
      
      break;
    }
    
    case 
"Save":
    {
      for (
temp.var: NC_Tab.rows)
      {
        if (
temp.var.id == temp.ncid)
        {
          
sendtext(temp.var.scriptedit.edittypetemp.var.scriptedit.editoptiontemp.var.scriptedit.getLines());

          break;
        }
      }
    }
  }
}

function 
onKeyPressed(keycodekeychar)
{
  if (
keychar == '`')
  {
    
NC_Tree.clearnodes();
    
requesttext("classlist""Classes/");
    
requesttext("npclist""NPCS/");
    
requesttext("weaponlist""Weapons/");
    
    
NC_Window.visible = !NC_Window.visible;
  }

To Use:
Click ` to open/close it.
Attached Thumbnails
Click image for larger version

Name:	graal_1159641246.png
Views:	526
Size:	75.5 KB
ID:	38042  
Reply With Quote
  #2  
Old 09-30-2006, 08:37 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
Very cool, didn't bother checking the script, but looking at the screenshot it looks good and works, congradulations!
__________________
Reply With Quote
  #3  
Old 09-30-2006, 08:44 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
Very good, keep up the good work.
__________________

Quote:
Originally Posted by unixmad
Can you just shut up ?
MAGA
MFGA
MEGA
Reply With Quote
  #4  
Old 09-30-2006, 08:49 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
Yeah, I'd also like to give credit to Jagen.. the banned but wonderful scripter Jagen.

http://forums.graalonline.com/forums...ad.php?t=60379

I got the idea after viewing, but I don't recall his ever being released.. threw it together in like 8 hours.

If you think thats crazy amount of time.. I'd like to put that I watched The Matrix (1), Oceans Eleven and Oceans Twelve.. and played Bomberman with stefan and some others last night and this morning.

So in working time.. it's probally an hour.. in playing time about 8 =D
Reply With Quote
  #5  
Old 10-01-2006, 12:54 AM
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
awesome ;o
__________________
Deep into the Darkness peering...
Reply With Quote
  #6  
Old 10-01-2006, 01:25 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 Angel_Light View Post
awesome ;o
Don't forget to rep me =D
Reply With Quote
  #7  
Old 10-01-2006, 01:35 AM
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
If I could.
__________________

Quote:
Originally Posted by unixmad
Can you just shut up ?
MAGA
MFGA
MEGA
Reply With Quote
  #8  
Old 10-01-2006, 02:38 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 zephirot View Post
If I could.
Hehe.

P.S. I got 29 rep =D. I'll try to add some cool stuff here later =).
Reply With Quote
  #9  
Old 10-01-2006, 04:08 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
This is incredibly similar to what Jamilla did on UGCC

[EDIT]: Apprently i'll be banned for linking to those forums but it's there in the NPC scripting part.
Reply With Quote
  #10  
Old 10-01-2006, 04:09 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
This is incredibly similar to what Jamilla did on UGCC
BADLINK
oreally? Then I wasted my time?

I know.. I based mine off his and jagens =P. Also linking to that is not allowed in which is why I didn't.
Reply With Quote
  #11  
Old 10-01-2006, 08:45 PM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
How does the script write over the real script on RC
Reply With Quote
  #12  
Old 10-01-2006, 09:09 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 Rapidwolve View Post
How does the script write over the real script on RC
sendtext(TYPE, NAME, NEWTEXT4SCRIPT);
Reply With Quote
  #13  
Old 10-01-2006, 09:17 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
Make the script editor background white.

Also, you'll need requesttext("clientrc", 1); for that sendtext() to work, which requires that your account as RC set up.
Reply With Quote
  #14  
Old 10-01-2006, 09:25 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 Skyld View Post
Make the script editor background white.
I tried everything I could think of with the transperency, wanna shed some light on it and I'll fix it up =o?
Reply With Quote
  #15  
Old 10-02-2006, 01:24 AM
MysticalDragon MysticalDragon is offline
Global Administration
MysticalDragon's Avatar
Join Date: Oct 2002
Location: Lynn Ma
Posts: 883
MysticalDragon is a jewel in the roughMysticalDragon is a jewel in the rough
Send a message via AIM to MysticalDragon Send a message via MSN to MysticalDragon
Great NPC A+++!
__________________
~Delteria Support
~Playerworld Support
~PWA Chief
http://support.toonslab.com
[email protected]



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 03:03 PM.


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