Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   compressing script (https://forums.graalonline.com/forums/showthread.php?t=134268447)

brokk 07-08-2013 07:31 PM

compressing script
 
What is a better, more efficient way to write this. Preferably without TimeOuts or scheduleEvent.

It's for an npc item I'm making. There's more to it, but I'm just pasting the little snippet I want compressed.

PHP Code:

      if (blocked[0]==0) { 
       
player.-= 0.5;
       
sleep(0.05);   
       
player.-= 0.5;
       
sleep(0.05);
       
player.-= 0.5;
       
sleep(0.05);
       
player.-= 0.5;
       
sleep(0.05);
       
player.-= 0.5;
       
sleep(0.05);      
       
player.-= 0.5;
       
sleep(0.05);   
       
player.-= 0.5;
       
sleep(0.05);
       
player.-= 0.5;
       
sleep(0.05);
       
player.-= 0.5;
       
sleep(0.05); 


cbk1994 07-08-2013 07:50 PM

Use a for loop to repeat a sequence of statements.

PHP Code:

for (temp.0temp.9temp.++) {
  
player.-= 0.5;
  
sleep(0.05);



callimuc 07-08-2013 07:50 PM

either a gani or using a for() loop


All times are GMT +2. The time now is 11:45 PM.

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