Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-27-2012, 06:13 AM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
Strange Random() ?

I was testing a npc on N-Pulse when I noticed I dug up 2 items at once.. how could this be? I only generate the number once.. and they both have seperate ranges..

PHP Code:
function checkdig(chxchy) {
  
temp.randomnumber random(0,100);
  
//player.chat = random(0,3) SPC temp.randomnumber;
  
if ( int(temp.randomnumberin |20,40| ) {
    
temp.obj putnpc2(chxchy"");
    
temp.obj.image "block.png";
    
temp.obj.join("shovel_obj");
  }
  if ( 
int(temp.randomnumberin |50,60| ) {
    
temp.obj putnpc2(chxchy"");
    
temp.obj.image "np_worm.png";
    
temp.obj.join("shovel_obj");
  }

This is serverside also.

And yes I will be using case/switch. But any reason this would be acting this way?
Reply With Quote
  #2  
Old 01-27-2012, 06:21 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
How do you know your script just isn't getting executed twice?

You'd be able to tell if you used echo instead of player.chat for debugging.
__________________
Quote:
Reply With Quote
  #3  
Old 01-27-2012, 06:23 AM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
Quote:
Originally Posted by fowlplay4 View Post
How do you know your script just isn't getting executed twice?

You'd be able to tell if you used echo instead of player.chat for debugging.
Good point.

After review, you are correct. Thanks for the help, it was actually executing 4 times. It's been a rough week.
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 02:38 PM.


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