View Single Post
  #72  
Old 03-15-2010, 12:25 AM
jkldogg jkldogg is offline
J.Rollin (killaz)
jkldogg's Avatar
Join Date: Feb 2010
Location: USA
Posts: 675
jkldogg can only hope to improve
Send a message via AIM to jkldogg Send a message via MSN to jkldogg
Exclamation Inventory()replace

Quote:
Originally Posted by Cubical View Post
the script
Okay.

I want to replace the old classic inventory with my own one. I changed the key to "Q", but both inventories popped up..lol How can I easily disable the old classic one? Also, is there a way to drag out items and drop them on the ground?

I thought editing this would help..but I failed

PHP Code:
   player.chat "You can't drop this!";
    return;
  }
  
Inventory_Window.visible false;
  
this.dragging true;
  
this.dragWep = ( @ ct ).weapon;
  
Inventory_DragImg.image = ( @ ct ).weapon.image;
  
Inventory_DragQuantity.text 1;
  
refreshDrag();
  
Inventory_DragImg.visible true;
  
Inventory_DragQuantity.visible true;
  
this.startDrag timevar2;
  
client.frozen true;
}
function 
refreshDrag() 

Here's the code:

PHP Code:
function onActionServerSidecmdwepammimgacc )
{
  }
    
    
//echo(wep SPC clientr.item.( @ wep ) SPC player.account);
    
if ( clientr.item.( @ wep ) >= amm )
    {
      
clientr.item.( @ wep ) -= amm;
      if ( 
clientr.item.( @ wep ) == )
      {
        
removeweaponwep );
      }
      
temp.npc putnpc2dropPosition()[0], dropPosition()[1], "join(\"object_droppeditem\");" );
      
temp.npc.dropper acc;
      
temp.npc.realName wep;
      
temp.npc.itemQuantity amm;
      
temp.npc.itemImage img;
      
clientr.trueMoney base64encodeclientr.item.Money );
      
triggerclient"gui"name"reopenMenu" );
    }
function 
dropPosition()
{
  
temp.playerPos = {{0.751}, {0.61.5}};
  
temp.dropPos = {
                   
player.+ (player.dir in {02}? temp.playerPos[0][0] : temp.playerPos[1][0]) + vecx(player.dir) * 2,
                   
player.+ (player.dir in {02}? temp.playerPos[0][1] : temp.playerPos[1][1]) + vecy(player.dir) * 2
                 
};
  return 
temp.dropPos;
}
//#CLIENTSIDE
function onCreated()
{
  
setTimer0.05 );
}
function 
onActionClientSidecmd )
{
  if ( 
cmd == "reopenMenu" )
  {
    if ( 
this.menu == )
    {
      
destroyMenu();
      
showMenu();
    }
    else
    {
      
destroyMenu();
    }
  }
}
function 
onKeyPressedcodekey )
{
  if ( 
key == "w" )
  {
    
this.menu this.menu;
    if ( 
this.menu )
    {
      
showMenu();
      
setTimer0.05 );
    }
    else
    {
      
destroyMenu();
      
this.scroll 0;
    }
  }
}
function 
onTimeOut()
{
  if ( 
mousewheeldelta )
  {
    if ( 
this.scroll 35 this.iWeps.size() )
    {
      
this.scroll += 5;
      
destroyMenu();
      
showMenu();
    }
  }
  else if ( 
mousewheeldelta )
  {
    if ( 
this.scroll )
    {
      
this.scroll -= 5;
      
destroyMenu();
      
showMenu();
    }
  }
  if ( 
this.dragging )
  {
    
temp.Inventory_DragQuantity.text;
    if ( 
timevar2 this.lastTime >= .1 )
    {
      if ( 
keydown) )
      {
        if ( 
temp.!= clientr.item.( @ this.dragWep.name ) )
        {
          
Inventory_DragQuantity.text temp.1;
          
this.lastTime timevar2;
        }
      }
      if ( 
keydown) )
      {
        if ( 
temp.100 )
        {
          
Inventory_DragQuantity.text temp.100;
          
// this.lastTime = timevar2;
        
}
        else
        {
          
Inventory_DragQuantity.text 1;
          
//this.lastTime = timevar2;
        
}
      }
      if ( 
keydown) )
      {
        if ( 
temp.)
        {
          
Inventory_DragQuantity.text temp.1;
          
this.lastTime timevar2;
        }
      }
      if ( 
keydown) )
      {
        if ( 
temp.100 <= clientr.item.( @ this.dragWep.name ) )
        {
          
Inventory_DragQuantity.text temp.100;
          
//this.lastTime = timevar2;
        
}
        else
        {
          
Inventory_DragQuantity.text clientr.item.( @ this.dragWep.name );
          
//this.lastTime = timevar2;
        
}
      }
    }
    if ( ! 
leftmousebutton )
    {
      
endDragging();
    }
    else
    {
      
refreshDrag();
    }
  }
  if ( 
this.menu )
  {
    
setTimer0.05 );
  }
}
function 
destroyMenu()
{
  
Inventory_Window.destroy();
}
function 
showMenu()
{
  
iWeps.clear();
for ( 
temp.player.weapons )
  {
    
temp.temp.a.name;
    if ( ! 
temp.n.starts"-" ) )
    {
      
iWeps.addtemp.);
    }
  }
  
this.iWeps iWeps;
  
scroll this.scroll;
  new 
GuiShowImgCtrl"Inventory_DragImg" )
  {
    
image "";
    
0;
    
0;
    
visible false;
    
width 32;
    
height 32;
  }
  new 
GuiShowImgCtrl"Inventory_Window" )
  {
    
image "inventory1.png";
    
width 380;
    
height 380;
    
screenwidth - ( width 20 );
    
screenheight - ( height );
    
visible true;
    for ( 
temp.scrolltemp.35 scrolltemp.++ )
    {
      if ( 
temp.iWeps.size() )
      {
        
temp.iWeps[temp.i];
        if ( 
temp.cols == )
        {
          
temp.row ++;
          
temp.cols 0;
        }
        new 
GuiShowImgCtrl"Inventory_Item_" temp.a.name )
        {
          
image temp.a.image;
          
13 + ( 60.5 temp.cols );//108-x/original|35|
          
+ ( 43.5 temp.row );//9-y/original|35|
          //Newer Old-x=27.5
          //Newer Old-y=96
          
width 32;
          
height 32;
          
hint temp.a.name;
          
this.weapon temp.a;
          
thiso.catcheventname"onMouseDown""onItemClicked" );
          
thiso.catcheventname"onMouseDragged""onItemDragged" );
        }
        
temp.cols ++;
      }
    }
  }
  
onSelect( ( @ "Inventory_Item_" player.weapons[selectedweapon].name ) );
}
function 
onItemClickedctrnxycount )
{
  
temp.= ( @ ctr );
  
temp.temp.c.weapon;
  if ( 
count == )
  {
    
onEquipctr );
  }
  else
  {
    
onSelectctr );
  }
}
function 
onItemDraggedctrlnnx)
{
  if ( ! 
this.dragging )
  {
    
startDraggingctrln );
  }
}
function 
startDraggingct )
{
  if ( ( @ 
ct ).weapon.name == NULL )
  {
    
player.chat "You can't drop this!";
    return;
  }
  
Inventory_Window.visible false;
  
this.dragging true;
  
this.dragWep = ( @ ct ).weapon;
  
Inventory_DragImg.image = ( @ ct ).weapon.image;
  
Inventory_DragQuantity.text 1;
  
refreshDrag();
  
Inventory_DragImg.visible true;
  
Inventory_DragQuantity.visible true;
  
this.startDrag timevar2;
  
client.frozen true;
}
function 
refreshDrag()
{
  
player.dir getdirmousex player.xmousey player.);
  if ( 
mousex in player.10player.10 | && mousey in player.10player.10 |)// && ( timevar2 - this.startDrag > .5 ) )
  
{
    
setAni"grab"Inventory_DragImg.image );
  }
  else
  {
    
setAni"idle""" );
  }
  
Inventory_DragImg.mousescreenx 25;
  
Inventory_DragImg.mousescreeny 25;
  
Inventory_DragQuantity.mousescreenx 30;
  
Inventory_DragQuantity.mousescreeny 20;
  
Inventory_DragImg.showtop();
}
function 
endDragging()
{
  
Inventory_Window.visible true;
  if ( 
this.dragWep.name == "Medkit" )
  {
  for (
aallplayers)
    {
      if ( 
player.x in |a.2a.2| && player.y in |a.2a.2| )
      {
        if ( 
a.account != player.account )
        {
          
triggerserver"weapon"name"revive"a.account );
          
this.dragging false;
          
Inventory_DragImg.image "";
          
Inventory_DragImg.visible true;
          
Inventory_DragQuantity.text "";
          
Inventory_DragQuantity.visible false;
          
this.dragWep "";
          
client.frozen false;
        }
      }
    }
  }
  elseif ( 
mousex in player.10player.10 | && mousey in player.10player.10 | && ( timevar2 this.startDrag .5 ) )
  {
    
triggerserver"gui"name"dropItem"this.dragWep.nameInventory_DragQuantity.textthis.dragWep.imageplayer.account );
  }
  else
  {
    
setAni"idle""" );
  }
  
this.dragging false;
  
Inventory_DragImg.image "";
  
Inventory_DragImg.visible false;
  
Inventory_DragQuantity.text "";
  
Inventory_DragQuantity.visible false;
  
this.dragWep "";
  
client.frozen false;
}

function 
onSelectctrl )
{
  
temp.= ( @ ctrl ).weapon.name;
  
temp.temp.n.tokenize"/" );
  if ( 
temp.a.size() == )
  {
    
Inventory_ItemName.text "Item:" SPC temp.a[1];
  }
  else
  {
    
Inventory_ItemName.text "Item:" SPC temp.a[0];
  }

  
Inventory_ItemQuantity.text "Quantity:" SPC clientr.item.( @ temp.);
  
Inventory_Icon.image = ( @ ctrl ).weapon.image;
}
function 
onEquipctrl3 )
{
  
temp.= ( @ ctrl3 ).weapon.name;
  for ( 
temp.0temp.player.weapons.size(); temp.++ )
  {
    
temp.player.weapons[temp.i];
    if ( 
temp.a.name == temp.)
    {
      
selectedweapon temp.i;
    }
  }

__________________

PSN: jkldogg



The best post ever made on the graal forums.
After playing Graal Online for many years, JKL decides to make a forum account. Isn't life funny?

Last edited by jkldogg; 03-15-2010 at 12:26 AM.. Reason: ok script
Reply With Quote