Graal Forums  

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

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #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 will become famous soon enough
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
  #2  
Old 01-25-2009, 04:58 AM
Deas_Voice Deas_Voice is offline
Deas
Deas_Voice's Avatar
Join Date: Jun 2007
Location: Sweden
Posts: 2,264
Deas_Voice is a jewel in the roughDeas_Voice is a jewel in the rough
Send a message via AIM to Deas_Voice Send a message via MSN to Deas_Voice Send a message via Yahoo to Deas_Voice
you could use PHP tags, then you can scroll down if the script is too long, or u make it a textfile.
__________________
.
WTF is real life, and where do I Download it?
There is no Real Life, just AFK!
since 2003~
I Support~
ღAeonღ | ღTestbedღ | ღDelteriaღ

if you are going to rep me, don't be an idiot, leave your name!
I got nothing but love for you
Reply With Quote
  #3  
Old 01-25-2009, 05:04 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 will become famous soon enough
Too long in the sense that there's a 10000 character limit on posts for some retarded reason.
__________________
"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
Reply With Quote
  #4  
Old 01-25-2009, 05:22 AM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Although I'm not sure this will solve your problem, I believe arrays are declared like this in GS1:
PHP Code:
  setarray this.board,4096;//a 64 by 64 array
  
setarray this.doorlisting,400;//Better too big... 
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #5  
Old 01-25-2009, 07:15 AM
maximus_asinus maximus_asinus is offline
RIP DarkCloud_PK
Join Date: Oct 2001
Location: Canada
Posts: 3,745
maximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond repute
I have no other reply for you other than: Firefly fan? NICE.
__________________
Save Classic!
Reply With Quote
  #6  
Old 01-26-2009, 01:40 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 will become famous soon enough
Loathe though I am to share my work, here's the dungeonator I've been building over the past month. Note that if you comment out the fourth line, it's a Floating Point Overflow. If you replace the subroutine call with the exact cut-and-pasted subroutine, it's a Floating Point Overflow...and if you replace the setarray etc[],etc; with setarray etc,etc; it only delays the Floating Point Overflow until you return to the editor. -_-
Not only that! If you copy drawmap() to drawmap2() in anticipation of a bait-and-switch, THAT causes a Floating Point Overflow too!
Attached Files
File Type: nw cotwdungeontest.nw (20.6 KB, 450 views)
__________________
"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
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 10:11 AM.


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