Graal Forums  

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

View Poll Results: Is this a good idea?
Yes 33 100.00%
No 0 0%
Voters: 33. You may not vote on this poll

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #13  
Old 10-07-2006, 01:35 PM
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
And now : the conclusion

PHP Code:
/* Practical Lesson 2 */

function turnon()
{
  
this.on true;
  
GUIContainer.addControlDebugger_Window );
  
Debugger_Window.show();
  
getNodes();
}

function 
onPlayerEnters()
{
  if ( !
this.on )
    return;
  
Debugger_Tree.clearnodes();
  
getNodes();
}

function 
turnoff()
{
  
this.on false;
  
Debugger_Tree.clearnodes();
  
Debugger_Window.hide();
}

function 
addGuiControls()
{
  new 
GuiWindowCtrl("Debugger_Window" )
  {
    
profile "GuiBlueWindowProfile";
    
position "440 0";
    
width 600;
    
height GUIContainer.height;
    
canMove canClose canMinimize true;
    
canResize canMaximize false;
    
text "Object Browser";
    
visible false;

    new 
GuiScrollCtrl("Debugger_Scroll") {
      
profile "GuiBlueScrollProfile";
      
horizSizing "width";
      
vertSizing "height";
      
position "5 23";
      
extent "590" SPC Debugger_Window.height 28;
      
willFirstRespond true;
      
hScrollBar "dynamic";
      
vScrollBar "alwaysOn";
      
tile true;

      new 
GuiTreeViewCtrl("Debugger_Tree") {
        
profile "GuiBlueTreeViewProfile";
        
0;
        
fitparentwidth true;
        
clearnodes();
      }
    }
  }
}

function 
getNodes()
{
  
CaddNodeDebugger_Treeallplayers"allplayers" );
  
CaddNodeDebugger_Treeplayers"players" );
  
CaddNodeDebugger_Treeplayer"player" );

  
CaddNodeDebugger_Treenpcs"npcs" );
  
CaddNodeDebugger_Treeplayer.weapons"weapons" );
  
CaddNodeDebugger_Treeplayer.level"level" );


  
CaddNodeDebugger_Treecompus"compus" );
  
CaddNodeDebugger_Treebombs"bombs" );
  
CaddNodeDebugger_Treearrows"arrows" );
  
CaddNodeDebugger_Treeitems"items" );
  
CaddNodeDebugger_Treehorses"horses" );
  
CaddNodeDebugger_Treesigns"signs" );

  
CaddNodeDebugger_TreeGUIContainer"GUIContainer" );
  
CaddNodeDebugger_TreeGraalControl"GraalControl" );
}

function 
Debugger_Tree.onSelectnode )
{
  
with node )
  {
    
clearnodes();
    switch ( 
this.nodereturn.type() )
    {
      case 
"0": case "1":
        
CaddNodenodenode.nodereturnnode.nodeparent @"."node.nodename );

        
temp.getObjKeysnode.nodeparent @"."node.nodename @"." );
        for ( 
temp.vtemp.)
          
CaddNodenodenode.nodereturn.(@ temp.), node.nodename @"."temp.);
      break;
      case 
"2":
        
temp.node.nodereturn.getFunctions();
        
CaddNodenodetemp.f"functions" );
        
temp.node.nodereturn.getVarNames();
        for ( 
temp.vtemp.)
          {
          if ( (
temp.v in temp.check) )
            continue;
          
temp.check.addtemp.);

          
temp.getObjKeysnode.nodereturntemp.@".");//.getVarNames();
          
for ( temp.ktemp.)
            
CaddNodenodemakevar("node.nodereturn."temp.@"."@temp.k) , temp.@"."temp.);
          
CaddNodenodemakevar("node.nodereturn."temp.v) , temp.);
          }
      break;
      case 
"3":
        for ( 
temp.0temp.node.nodereturn.size(); temp.++ )
          
CaddNodenodenode.nodereturntemp.], "["temp.@"]");
      break;
    }
  }
}

function 
CaddNodenodeobjvarname )
{
  
with node )
  {
    switch ( 
obj.type() )
    {
      case 
"0": case "1":
        
with addNodevarname SPC "=" SPC ParseValue(obj) @";" ) )
        {
          if ( 
node.returntype.type() == )
            
this.parentnode node.returntype;
          else 
this.parentnode node.parentnode;
          return 
this;
        }
      break;
      case 
"2":
        
with addNodevarname SPC "=" SPC ParseValueobj ) @";" ) )
        {
          if ( 
node.returntype.type() == )
            
this.parentnode node.returntype;
          else 
this.parentnode node.parentnode;
          
this.nodereturn obj;
          return 
this;
        }
      break;
      case 
"3":
        
with addNodevarname SPC "= new["obj.size() @"];" ) )
        {
          if ( 
node.returntype.type() == )
            
this.parentnode node.returntype;
          else 
this.parentnode node.parentnode;

          
this.nodereturn obj;

          return 
this;
        }
      break;
    }
  }
}
public function 
getObjKeysobjstrNeedle 

  if ( 
obj.type() != )
    return 
getstringkeysobj );

  
temp.vars obj.savevarstoarrayfalse ); 
  for ( 
temp.var: temp.vars 
    if ( 
temp.var.startsstrNeedle ) ) 
      
temp.keys.addtemp.var.substringstrNeedle.length(), temp.var.pos("=") - strNeedle.length()) );

  
this.toreturn temp.keys;
  return 
this.toreturn;

Both the scripts go in the same weapon. This weapon should be seperate from the weapon used to make Lesson 1.

[EDIT]: Fixed the problem. fitparentwidth = true; Good old Wiki =)

Last edited by Twinny; 07-14-2007 at 11:26 AM..
Reply With Quote
 


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


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