Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 06-30-2006, 10:48 PM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Mining stuff

Working on a mine script, it soesn't work with the parameter check in it, and it doesn't work without it either. It does part of the script, but seems to randomly stop before freezeplayer? Weird.
PHP Code:
function onActionserverside()
{
  if(
params[0]=="mine")
  {
    if(
clientr.minerocks>0)
    {
      
//variable setup
      
this.mine int(random(0,101));
      
this.time random(3,8);
      
player.dif=2;
      
freezeplayer(this.time);
      
player.chat "Searching through pile";
      
showimg(4,"dr-minerocks.png",playerx+.5,playery+2.1);
      
changeimgvis(4,.5);
      
changeimgzoom(4,.75);
      
setani("push",NULL);
      
sleep(this.time);
      
hideimg(4);
      if(
this.mine<=15)
      {
        
//15%
        
player.chat "Found some Carbon!";
        
addweapon("Tools/Carbon");
        
clientr.carbon++;
        
clientr.minerocks--;
      }
      else if(
this.mine<=25)
      {
        
//10%
        
player.chat "Found some Iron!";
        
addweapon("Tools/Iron");
        
clientr.iron++;
        
clientr.minerocks--;
      }
      else if(
this.mine<=30)
      {
        
//5%
        
player.chat "Found some Silver!";
        
addweapon("Tools/Silver");
        
clientr.sliver++;
        
clientr.minerocks--;
      }
      else if(
this.mine<=35)
      {
        
//5%
        
player.chat "Found a Saphire!";
        
addweapon("Tools/Saphire");
        
clientr.saphire++;
        
clientr.minerocks--;
      }
      else if(
this.mine<=40)
      {
        
//5%
        
player.chat "Found a Ruby!";
        
addweapon("Tools/Ruby");
        
clientr.ruby++;
        
clientr.minerocks--;
      }
      else if(
this.mine<=43)
      {
        
//3%
        
player.chat "Found Gold!!";
        
addweapon("Tools/Gold");
        
clientr.Gold++;
        
clientr.minerocks--;
      }
      else
      {
        
player.chat=="Nothing";
        
clientr.minerocks--;
      }
    }
    else
    {
      
player.chat="You have no more mine rocks!";
    }
  }
}
      
          
//#CLIENTSIDE
function onWeaponfired()
{
  
triggeraction(0,0,"serverside","New mining","mine");

Reply With Quote
  #2  
Old 07-01-2006, 12:07 AM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
player.dif=2;

do you mean:
player.dir=2; ?

Also, did you even attempt to debug it using echo() calls to see where exactly it is screwing up?
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #3  
Old 07-01-2006, 01:12 AM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Quote:
Originally Posted by ApothiX
player.dif=2;

do you mean:
player.dir=2; ?

Also, did you even attempt to debug it using echo() calls to see where exactly it is screwing up?
Nope, not 100% sure how to use it yet XD
Reply With Quote
  #4  
Old 07-01-2006, 01:19 AM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by excaliber7388
Nope, not 100% sure how to use it yet XD
eh? just throw a bunch of: echo("Checkpoint, next line: blah=blah;"); or something, and it will output to NC and you will be able to check where exactly is is failing.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #5  
Old 07-01-2006, 01:49 AM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
oh thanks.
It still doesn't work with the player.dir fixed, so I'll check that
edit:
Nope, runs right through to the end of the script, it must be something else
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 06:51 PM.


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