Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   JKL's Scripting Questions (https://forums.graalonline.com/forums/showthread.php?t=134258195)

jkldogg 02-27-2010 10:35 AM

JKL's Scripting Questions
 
First I was wondering how do I make this so you grab it and then the box pops up? Right now when i put this in an NPC thing on offline editor and upload it, right after i upload it the box pops up and I click cancel and it doesn't come back.

PHP Code:

//#CLIENTSIDE
function onCreated()
{
  
openURL("http://wiki.graal.net");



Mark Sir Link 02-27-2010 10:57 AM

Change onCreated() to onActionGrab()

jkldogg 02-27-2010 11:01 AM

Quote:

Originally Posted by Mark Sir Link (Post 1559331)
Change onCreated() to onActionGrab()

I Put this and used an image of my staff block for a test and it didn't work.

PHP Code:

//#CLIENTSIDE
function onActionGrab()
{
openURL("http://wiki.graal.net");



xAndrewx 02-27-2010 11:08 AM

onActionGrab isn't a global function. You'll have to use a triggeraction to make that function. Use the search feature on the forums. ^^

jkldogg 02-27-2010 11:15 AM

Quote:

Originally Posted by xAndrewx (Post 1559333)
onActionGrab isn't a global function. You'll have to use a triggeraction to make that function. Use the search feature on the forums. ^^

Would you be so kind to search it for me and then come back here and paste it in? :o

I do more of simple scripting such as like in a jukebox/music player I can copy the same thing over and over and insert the url's. Or something like a staff block script which i can change the images or whatever. I more so edit scripts rather than create them entirely. :(

xAndrewx 02-27-2010 11:20 AM

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

jkldogg 02-27-2010 11:31 AM

did not help :[
 
Quote:

Originally Posted by xAndrewx (Post 1559336)

Thank you, but I could NOT figure that out. Too many different posts, and after they figured it out they didn't even post the new script.

So can someone please help :\

xAndrewx 02-27-2010 11:36 AM

It's in that thread- look again and read what they're saying. We're not supposed to give you the full code...

jkldogg 02-27-2010 11:44 AM

Quote:

Originally Posted by xAndrewx (Post 1559340)
It's in that thread- look again and read what they're saying. We're not supposed to give you the full code...

>.< I just need one little piece to finish this script !pissed!

jkldogg 02-27-2010 11:49 AM

no work :(
 
I tried this and it didn't work:

PHP Code:

//#CLIENTSIDE
function onKeyPressed(codekey)
{
switch(
key)
{
case 
"a":
temp.gx player.1.5 vecx(player.dir) * 2;
temp.gy player.vecy(player.dir )* 2;
triggeraction(temp.gxtemp.gy"Grab";
break;
}
}
openURL("http://wiki.graal.net");



xAndrewx 02-27-2010 12:11 PM

triggeraction(temp.gx, temp.gy, "Grab", "");

Add that to a weapon (what you've just posted above) & then add it to a player, you'll then be able to use the function
HTML Code:

function onActionGrab() {
}

Good job ^^

Liberated 02-27-2010 06:30 PM

you could always try to use onPlayerTouchsMe()
although i always find it annoying that whenever i hit a sign, i suddenly get this lousy say2 message.

but it would immensly simplify some things
PHP Code:

//CLIENTSIDE
function onPlayerTouchsMe()
{
  
openURL("http://wiki.graal.net"); 



jkldogg 03-05-2010 09:42 PM

Inventory
 
I've got a problem with a script, It's in the code gallery, I do not take ownership of it. I want to make it so that I can replace the image it comes with, with an image of my own. But there isn't anything here that says like "IMG=" or anything of that sort. So I was wondering if someone could help me figure this out. :)

PHP Code:

function onActionServerSide() 

  if (
params[0] == "playerweaps") { 
    for (
0player.weapons.size(); ++) temp.imgs.add(findWeaponNPC(player.weapons[i]).image); 
    
triggerClient("gui"name"openinv"player.weaponstemp.imgs); 
  } 


//#CLIENTSIDE 
function onCreated() 

  
enablefeatures(allfeatures 4); 
  
this.gName "Inventory_"
  (
this.gName "Window0").destroy(); 
  
setTimer(.05); 


function 
onTimeOut() 

  
this.plWeapon player.weapon.name
  
showText(2006100"System""b""Selected Weapon:" SPC this.plWeapon SPC "[" selectedweapon "]"); 
  
changeImgVis(2004); 
   
  
setTimer(.05); 


function 
onKeyPressed(keynrkeyname

  if (
keyname == "q") { 
    if ((
this.gName "Window0").visible == falsetriggerServer("gui"name"playerweaps"); 
    else (
this.gName "Window0").destroy(); 
  } 


function 
onActionClientSide("",weaps,imgs

  if (
params[0] == "openinv"OpenInventory(weapsimgs); 


function 
OpenInventory(invWeaponsinvImages

  if ((
this.gName "Window0").visible == false) { 
    new 
GuiWindowCtrl(this.gName "Window0") { 
      
width 196height 177
      
screenwidth/width/2screenheight/height/2
     
      
canMinimize false
      
canMaximize false
      
canResize false
      
canMove false
      
destroyOnHide true
       
      
xmod NULL
      
ymod NULL
      
rowcount NULL
       
      
invItems NULL
      
// Removes old buttons 
      
for (0invItems.size(); ++) (this.gName "Button" i).destroy(); 
     
      
// Checks for items to display in inventory 
      
for (0invWeapons.size(); ++) { 
        if (!
invWeapons[i].starts("-")) invItems.add({invWeapons[i], invImages[i]}); 
      } 
       
      
// Displays the items 
      
new GuiScrollCtrl(this.gName "Scroll0") { 
        
width 187height 150
        
523
         
        
hScrollBar "alwaysOff"
        
vScrollBar "dynamic"
       
        for (
0invItems.size(); ++) { 
          
temp.var = 5
          if (
temp.var.length() == && 0) { 
            
xmod NULL
            
ymod += 36
            
rowcount ++; 
          } 
         
          new 
GuiBitmapButtonCtrl(this.gName "Button" i) { 
            
width 32height 32
            
xmodymod
           
            
this.itemname invItems[i][0]; 
            
this.itemimage invItems[i][1]; 
           
            
normalbitmap this.itemimage
            
mouseoverbitmap this.itemimage
            
pressedbitmap this.itemimage
           
            
thiso.catchevent(this"onMouseDown""onSlotPressed"); 
            
thiso.catchevent(this"onMouseEnter""onMouseOverSlot"); 
            
thiso.catchevent(this"onMouseLeave""onMouseExitSlot"); 
          } 
          
xmod += 32 4
        } 
      } 
    } 
    (
this.gName "Window0").makefirstresponder("false"); 
  } else (
this.gName "Window0").destroy(); 


function 
onSlotPressed(objkeymodifiermousescreenxmousescreenyclickcount

  if (
clickcount == 2) { 
    
player.chat "Selected Weapon:" SPC obj.itemname
    
selectedweapon player.weapons.index(findWeapon(obj.itemname)); 
    (
this.gName "Window0").destroy(); 
  } else if (
clickcount == 1) (this.gName "Window0").text obj.itemname


function 
onMouseOverSlot(obj) (this.gName "Window0").text obj.itemname
function 
onMouseExitSlot(obj) (this.gName "Window0").text ""


xAndrewx 03-05-2010 10:15 PM

HTML Code:

    new GuiWindowCtrl(this.gName @ "Window0") { 
      useownprofile = true;
      profile.bitmap = "your image here";


jkldogg 03-05-2010 10:35 PM

Where exactly does that go? Would you mind copying the script and placing it in there and posting it for me?


All times are GMT +2. The time now is 08:44 PM.

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