Graal Forums  

Go Back   Graal Forums > Graal V6 forums > Bug Report
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-25-2009, 04:41 AM
Tyhm Tyhm is offline
Psionic Youth
Tyhm's Avatar
Join Date: Mar 2001
Location: Babord, West Graal Deaths:1009 Kills:1
Posts: 5,635
Tyhm has a spectacular aura about
Impossible Scripting Bug

If I remove the testing code (drawmap in if(created)), I get a Floating Point error and it crashes the gorram editor.

How? Why? WTF?

UNFORTUNATELY MY SCRIPT IS TOO LONG FOR THIS FORUM, SO YOU CAN'T SEE IT. ALSO IT CONTAINS PERCENT SIGNS. SILLY ME.

PHP Code:
// NPC made by Tyhm
if (created) {
  
setarray this.board[],4096;//a 64 by 64 array
  
setarray this.doorlisting[],400;//Better too big...
  
this.failures=0;
  
drawmap(); //remove this line and it all collapses
}
if (
playerenters) {
  
placerooms();
  
placetunnels();
  
sleep 0.1;
  
drawmap();
}

function 
drawmap(){
  for(
temp.j=0;temp.j<64;temp.j++){
    
setstring temp.output,;
    for(
temp.n=0;temp.n<64;temp.n++){
      
temp.o=this.board[(temp.n*64)+temp.j];
      if(
temp.o<0setstring temp.output,#s(temp.output)-;
      
else if(temp.o<10setstring temp.output,#s(temp.output)#v(temp.o);
      
else if(temp.o in |75,99|) setstring temp.output,#s(temp.output)#K((99-temp.o)+97);
      
else setstring temp.output,#s(temp.output)#K(temp.o+55);
    
}
    
showtext temp.j,64,(temp.j*0.8)+5,Fixedsys,Normal,#s(temp.output);
    
changeimgvis temp.j,0;
  }
}

function 
placerooms(){
  
temp.startx=int(random(0,60));
  
temp.starty=int(random(0,60));
  
temp.roomheight=int(random(3,10));
  
temp.roomwidth=int(random(3,12));
  if(
temp.startx+temp.roomwidth>64temp.roomwidth=64-temp.startx;
  if(
temp.starty+temp.roomheight>64temp.roomheight=64-temp.starty;
  
this.failed=0;
  for(
temp.i=temp.startx-1;temp.i<temp.startx+temp.roomwidth+1&&this.failed<1;temp.i++){
    for(
temp.n=temp.starty-1;temp.n<temp.starty+temp.roomheight+1&&this.failed<1;temp.n++){
      if(
temp.i in |0,63| && temp.n in |0,63| && this.board[(temp.i*64)+temp.n]>0){
        
this.failures++;
        
this.failed=1;
      }
    }
  }
  if(
this.failed<1){
    
this.rooms++;
    
this.roomtype=99-(this.rooms-1);
    
//7;//change this if it's a LIT room
    //0-6: walls, 7-8: rooms, 9:passages...
    
for(temp.i=temp.startx;temp.i<temp.startx+temp.roomwidth;temp.i++){
      for(
temp.n=temp.starty;temp.n<temp.starty+temp.roomheight;temp.n++){
        
this.board[(temp.i*64)+temp.n]=this.roomtype;
      }
    }
    
this.doors=int(random(2,4));
    
this.perimeter=(temp.roomwidth*2)+(temp.roomheight*2);
    for(
temp.d=0;temp.d<this.doors;temp.d++){
      
temp.dpos=int(random(0,this.perimeter));
      if(
temp.dpos<temp.roomwidth*2){
        if(
temp.dpos<temp.roomwidth){
          
temp.doorpos=((temp.startx+temp.dpos)*64)+(temp.starty-1);
          
temp.dir=0;
        }else{
          
temp.doorpos=((temp.startx+(temp.dpos-temp.roomwidth))*64)+(temp.starty+temp.roomheight);
          
temp.dir=2;
        }
      } else {
        if(
temp.dpos<(temp.roomwidth*2)+temp.roomheight){
          
temp.doorpos=((temp.startx-1)*64)+(temp.starty+(temp.dpos-(temp.roomwidth*2)));
          
temp.dir=1;
        }else{
          
temp.doorpos=((temp.startx+temp.roomwidth)*64)+(temp.starty+temp.dpos-((temp.roomwidth*2)+temp.roomheight));
          
temp.dir=3;
        }
      }
      
//check for adjacent doors
      //and eliminate;
      //if under 2 doors for that room, decrement temp.d
      //also, eliminate doors facing Out
      
if(temp.doorpos<64||temp.doorpos>4031||temp.doorpos 
AND GODDAMN IT WOULD SOMEONE FIX THE PERCENT ERROR ALREADY!
__________________
"Whatever," said Bean, "I was just glad to get out of the toilet."

"Power does not corrupt. Fear corrupts, perhaps the fear of a loss of power."- John Steinbeck
"I'm only acting retarded, what's your excuse?" queried the Gord.
- My pet, the Levelup Gnome

http://forums.graalonline.com/forums...&postcount=233

Last edited by Tyhm; 01-25-2009 at 05:03 AM..
Reply With Quote
 


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 07:12 AM.


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