Sorry, this is gonna look really confusing, but I cannot simplify what I have. I am getting a Stream Does Not Exist Error regarding the line :
The pathname is definitely correct, the file exists, and the code used to work until I made the "If flight_mode$="" " changes ( this just meant duplicating a couple of the routines with some minor changes).
The only other reason I can see for this error, is if I have left a streamopen elsewhere, so the 'Current Dir' is different. I cannot find this either...
NewStruct\StructType$=ReadLine (SectorStructData)
The pathname is definitely correct, the file exists, and the code used to work until I made the "If flight_mode$="" " changes ( this just meant duplicating a couple of the routines with some minor changes).
The only other reason I can see for this error, is if I have left a streamopen elsewhere, so the 'Current Dir' is different. I cannot find this either...
;SKYBOX Skybox=CreateSphere(20) ScaleMesh skybox,(shldlong+1)/2,(shldlong+1)/2,(shldlong+1)/2 FlipMesh skybox EntityOrder skybox,1 If flight_mode$="Space" Then skytext=LoadTexture ("Sectors"+Current_Sector$+"\box.bmp") If flight_mode$="Atmosphere" Then skytext=LoadTexture ("Sectors"+Current_Sector$+locality$+"\box.bmp") EntityTexture skybox,skytext FreeTexture skytext EntityParent skybox,ship If wire=1 Then EntityAlpha skybox,0 EntityPickMode skybox,0 If flight_mode$="Space" ;CREATE PLANET & MOONS MoonTexture=LoadTexture("Visual\3D\LUNARtxt.jpg") PlanetTexture=LoadTexture("Sectors"+Current_Sector$+""+Locality$+"\PLANETtxt.jpg") SectorPlanetData=OpenFile("Sectors"+Current_Sector$+""+Locality$+"\PlanetData.txt") PlanetClass$=ReadLine(SectorPlanetData) PlanetRadius=ReadLine(SectorPlanetData) PlanetRings=ReadLine(SectorPlanetData) PlanetMoons=ReadLine(SectorPlanetData) NewTarget.RadarTargets=New RadarTargets PlanetMesh=CreateSphere(50) ScaleMesh PlanetMesh,(PlanetRadius/20),(PlanetRadius/19),(PlanetRadius/20) EntityTexture PlanetMesh,PlanetTexture FreeTexture PlanetTexture EntityType PlanetMesh,9,False EntityPickMode PlanetMesh,1 EntityRadius PlanetMesh,(PlanetRadius/20),(PlanetRadius/19) NameEntity PlanetMesh,Locality$ NewTarget\Name$=(Locality$+"-"+PlanetClass$) NewTarget\TargetType$="PLANET" NewTarget\TargetColourRed=160 NewTarget\TargetColourGreen=160 NewTarget\TargetColourBlue=160 NewTarget\TargetEntityHandle=PlanetMesh If PlanetMoons>0 spread#=(360/PlanetMoons) For g=1 To PlanetMoons MoonData$=ReadLine(SectorPlanetData) NewMoon.Moonstype=New MoonsType NewMoon\Mesh=CreateSphere(20) NewMoon\Name$=MoonData$ NewMoon\ParentPlanet$=Locality$ ScaleMesh NewMoon\Mesh,50,50,50 EntityTexture NewMoon\Mesh,MoonTexture RotateEntity NewMoon\Mesh,0,(spread#*g)-180,0 MoveEntity NewMoon\Mesh,0,Rand(-50,50),Rand(PlanetRadius/5,PlanetRadius/4) EntityParent NewMoon\Mesh,PlanetMesh,1 EntityType NewMoon\Mesh,10,False EntityPickMode NewMoon\Mesh,1 EntityRadius NewMoon\Mesh,50 NewTarget.RadarTargets=New RadarTargets NewTarget\Name$=(NewMoon\Name$) NewTarget\TargetType$="SATELLITE" NewTarget\TargetColourRed=100 NewTarget\TargetColourGreen=100 NewTarget\TargetColourBlue=100 NameEntity NewMoon\Mesh,NewMoon\Name$ NewTarget\TargetEntityhandle=NewMoon\Mesh Next EndIf PlanetStructs=ReadLine(SectorPlanetData) PlanetX=ReadLine(SectorPlanetData) PlanetY=ReadLine(SectorPlanetData) PlanetZ=ReadLine(SectorPlanetData) CloseFile (SectorPlanetData) If wire=0 And PlanetRings=1 RingSprite=LoadSprite("Sectors"+Current_Sector$+""+Locality$+"\RING.jpg") SpriteViewMode RingSprite,2 EntityFX RingSprite,16 EntityAlpha RingSprite,0.8 ScaleSprite RingSprite,(PlanetRadius/9),(PlanetRadius/7) TurnEntity RingSprite,80,0,0 PositionEntity RingSprite,EntityX(PlanetMesh),EntityY(PlanetMesh),EntityZ(PlanetMesh) EntityParent RingSprite,PlanetMesh EndIf PositionEntity PlanetMesh,PlanetX,PlanetY,PlanetZ FreeTexture MoonTexture EndIf ;STAR SectorStarData=OpenFile("Sectors"+Current_Sector$+"\Stars.txt") StarName$=ReadLine(SectorStarData) StarClass$=ReadLine(SectorStarData) StarLightRed=ReadLine(SectorStarData) StarLightGreen=ReadLine(SectorStarData) StarLightBlue=ReadLine(SectorStarData) CloseFile(SectorStarData) If wire=0 SunSprite=LoadSprite("Sectors"+Current_Sector$+""+StarName$+".bmp") ScaleSprite SunSprite,5,5 EntityOrder SunSprite,1 sunsphere=CreateSphere(3) EntityOrder sunsphere,1 EntityAlpha sunsphere,0 EntityParent sunsphere,sunsprite EndIf If wire=1 SunSprite=CreateSphere(15) ScaleEntity SunSprite,5,5,5 EntityOrder SunSprite,1 EndIf Sunlight=CreateLight(1) LightColor Sunlight,StarLightRed,StarLightGreen,StarLightBlue MoveEntity SunSprite,-35,-35,45 PointEntity sunlight,sunsprite MoveEntity sunlight,0,0,100 PointEntity Sunlight,ship EntityParent SunSprite,skybox EntityAlpha SunSprite,1 NameEntity SunSprite,StarName$ EntityParent Sunlight,SunSprite ;RESOLVING FOR STAR ON RADAR newtarget.RadarTargets= New radartargets NewTarget\Name$=(StarName$) NewTarget\TargetType$="STAR" NewTarget\TargetColourRed=255 NewTarget\TargetColourGreen=220 NewTarget\TargetColourBlue=50 If wire=0 NewTarget\TargetEntityhandle=sunsphere EndIf If wire=1 NewTarget\TargetEntityhandle=sunsprite EndIf If flight_mode$="Space" ;STRUCTURES SectorStructData=OpenFile("Sectors"+Current_Sector$+""+Locality$+"\Structure.txt") For f=1 To PlanetStructs NewStruct.Buildings=New Buildings NewStruct\StructType$=ReadLine (SectorStructData) NewStruct\StructName$=ReadLine (SectorStructData) NewStruct\Allegiance$=ReadLine (SectorStructData) NewStruct\X=ReadLine (SectorStructData) NewStruct\Y=ReadLine (SectorStructData) NewStruct\Z=ReadLine (SectorStructData) NewStruct\Armour=ReadLine (SectorStructData) NewStruct\Shield=ReadLine (SectorStructData) NewStruct\Weapon$=ReadLine (SectorStructData) NewStruct\Mesh=LoadMesh("Visual\3D"+NewStruct\StructType$+".b3d") NewStruct\PartoPlanet=ReadLine(SectorStructData) NewStruct\Rotate=ReadLine(SectorStructData) CloseFile (sectorstructdata) structexture=LoadTexture("Visual\3D"+NewStruct\StructType$+"txt.bmp") EntityPickMode NewStruct\Mesh,2 If wire=0 Then EntityTexture NewStruct\Mesh,structexture FreeTexture structexture NameEntity NewStruct\Mesh,NewStruct\StructName$ NewTarget.RadarTargets=New RadarTargets NewTarget\Name$=(Locality$+"-"+NewStruct\StructName$) NewTarget\TargetType$="STRUCTURE" NewTarget\TargetColourRed=110 NewTarget\TargetColourGreen=130 NewTarget\TargetColourBlue=250 NewTarget\TargetEntityHandle=NewStruct\Mesh NewTarget\Allegiance$=NewStruct\Allegiance$ EntityType NewStruct\Mesh,10,False PositionEntity NewStruct\Mesh,NewStruct\X,NewStruct\Y,NewStruct\Z If NewStruct\ParToPlanet=1 Then EntityParent NewStruct\Mesh,PlanetMesh ;POSITION SHIP If NewStruct\StructName$=Docking_Name$ MoveEntity ship,NewStruct\X,NewStruct\Y,NewStruct\Z+20 PointEntity ship,NewStruct\Mesh TurnEntity ship,0,180,0 speed#=topspeed# EndIf Next EndIf If flight_mode$="Atmosphere" atmosdat=OpenFile("Sectors"+Current_Sector$+""+Locality$+"\Atmosphere Data.txt") ambred=ReadLine(atmosdat) ambgreen=ReadLine(atmosdat) ambblue=ReadLine(atmosdat) GStructs=ReadLine(atmosdat) CloseFile(atmosdat) ;STRUCTURES GroundStructData=OpenFile("Sectors"+Current_Sector$+""+Locality$+"\Ground Structure.txt") For f=1 To GStructs NewStruct.Buildings=New Buildings NewStruct\StructType$=ReadLine (GroundStructData) NewStruct\StructName$=ReadLine (GroundStructData) NewStruct\Allegiance$=ReadLine (GroundStructData) NewStruct\X=ReadLine (GroundStructData) NewStruct\Y=ReadLine (GroundStructData) NewStruct\Z=ReadLine (GroundStructData) NewStruct\Armour=ReadLine (GroundStructData) NewStruct\Shield=ReadLine (GroundStructData) NewStruct\Weapon$=ReadLine (GroundStructData) CloseFile (GroundStructData) NewStruct\Mesh=LoadMesh("Visual\3D"+NewStruct\StructType$+".b3d") structexture=LoadTexture("Visual\3D"+NewStruct\StructType$+"txt.bmp") EntityPickMode NewStruct\Mesh,2 If wire=0 Then EntityTexture NewStruct\Mesh,structexture FreeTexture structexture NameEntity NewStruct\Mesh,NewStruct\StructName$ NewTarget.RadarTargets=New RadarTargets NewTarget\Name$=(Locality$+"-"+NewStruct\StructName$) NewTarget\TargetType$="STRUCTURE" NewTarget\TargetColourRed=110 NewTarget\TargetColourGreen=130 NewTarget\TargetColourBlue=250 NewTarget\TargetEntityHandle=NewStruct\Mesh NewTarget\Allegiance$=NewStruct\Allegiance$ EntityType NewStruct\Mesh,10,False PositionEntity NewStruct\Mesh,NewStruct\X,NewStruct\Y,NewStruct\Z ;POSITION SHIP If NewStruct\StructName$=Docking_Name$ MoveEntity ship,NewStruct\X,NewStruct\Y,NewStruct\Z+20 PointEntity ship,NewStruct\Mesh TurnEntity ship,0,180,0 speed#=topspeed# EndIf Next EndIf If flight_mode$="Space" ;Asteroid Field Max_Sector_Roids=Rand(7,30) For f = 1 To Max_Sector_Roids setup_roid.sector_roid=New sector_roid debris=Rand(20,40) composition=100-debris setup_roid\ICE=Rand(0,70) composition=(composition-(setup_roid\ICE)) setup_roid\METAL_ORE=Rand(0,composition) composition=(composition-(setup_roid\METAL_ORE)) setup_roid\MINERAL=Rand(0,composition) composition=(composition-(setup_roid\MINERAL)) setup_roid\PRECIOUS_METALS=Rand(0,composition) composition=composition-((setup_roid\PRECIOUS_METALS)) setup_roid\HYDROCARBONS=Rand(0,composition) composition=composition-((setup_roid\HYDROCARBONS)) setup_roid\RADIOACTIVES=Rand(0,composition) composition=composition-((setup_roid\RADIOACTIVES)) setup_roid\DEBRIS=composition+debris roid_seg=Rand(3,9) setup_roid\mesh=CreateSphere(roid_seg) roidtxt=Rand(1,7) setup_roid\texture=LoadTexture("Visual\3D\roid"+roidtxt+"txt.bmp") setup_roid\PosX=Rnd(-50000,50000) setup_roid\PosY=Rnd(-10000,10000) setup_roid\PosZ=Rnd(-50000,50000) PositionEntity setup_roid\mesh,setup_roid\posX,setup_roid\PosY,setup_roid\PosZ TurnEntity setup_roid\mesh,Rand(0,360),Rand(0,360),Rand(0,360) scalerX#=Rnd(3,12) scalerY#=Rnd(3,8) scalerZ#=Rnd(3,10) ScaleMesh setup_roid\mesh,scalerX#,scalerY#,scalerZ# EntityType setup_roid\mesh,7 EntityPickMode setup_roid\mesh,2 If wire=0 Then EntityTexture setup_roid\mesh,setup_roid\texture FreeTexture setup_roid\texture setup_roid\name$="ASTEROID" NameEntity setup_roid\mesh,Upper$((Left$(locality$,2)))+(scalerX#)+(scalerY#)+(scalerZ#) If Ast_Rotacol=1 NewTarget.RadarTargets=New RadarTargets NewTarget\Name$=(EntityName$(setup_roid\mesh)) NewTarget\TargetType$="ASTEROID" NewTarget\TargetColourRed=130 NewTarget\TargetColourGreen=120 NewTarget\TargetColourBlue=50 NewTarget\TargetEntityHandle=setup_roid\Mesh EndIf Next EndIf ; RADAR INITIAL TARGET DETAILS RadarSorter.RadarTargets=First RadarTargets TargetEntity=RadarSorter\TargetEntityHandle ;CREATE TERRAIN If flight_mode$="Atmosphere" Terrain=LoadTerrain("Sectors"+current_sector$+""+locality$+"\Terrain.JPG") TerrainDetail terrain,4000 Terrain_Texture=LoadTexture("Sectors"+current_sector$+""+locality$+"\Terrain Texture.JPG") ScaleTexture Terrain_Texture,16,16 ScaleEntity terrain,256,64,256 EntityType Terrain,15 EntityTexture Terrain,Terrain_Texture FreeTexture Terrain_Texture EndIf