o_O 3 Bugs...

Just starting out? Need help? Post your questions and find answers here.
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

Just one question, does 'File2.s' contain data written from DBPro? if so i would check it thoroughly before the PB stuff. (I've used DBPro and know how buggy and wierd it can be) :wink: Are you sure no binary data is being written to 'File2.s'?
--Kale

Image
DarthPuff
User
User
Posts: 47
Joined: Sat Apr 26, 2003 2:51 am
Location: USA
Contact:

Post by DarthPuff »

o_O I've been thinking about taking the string in the particle generator itself and cutting off everything after .bmp O_O file2.s is just holding the pictures location...
DarthPuff
User
User
Posts: 47
Joined: Sat Apr 26, 2003 2:51 am
Location: USA
Contact:

Post by DarthPuff »

naw kale... O_O this stuff is going into dbpro but not out... ;) patch4 is out ... it pretty much fixes all bugs ^_^
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

>patch4 is out ... it pretty much fixes all bugs

I have it, and i'm still very unimpressed/dissapointed with it, it really doesn't fix hardly anything (no where near) and Lee's removed all model support apart from *.x :roll: I could give you a list of bugs but i have left that shoddy language well behind, i just can't believe i paid £50 just to 'upgrade' to 'Pro' from Classic! ...Long Live PureBasic and Roll on Full 3D support in the next few versions! :D
--Kale

Image
DarthPuff
User
User
Posts: 47
Joined: Sat Apr 26, 2003 2:51 am
Location: USA
Contact:

Post by DarthPuff »

=P Now I remember you... the avatar... ;) I didn't know about the model thing... that sux...
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

>the avatar...

I have read your posts too :wink:

DBPro looks and sounds very promising but for me didn't deliver :( so i've moved to PB because you can do so much more with PB other than games. All my 3D stuff i have in mind is on hold while I brush up on my Maths and Fred includes the new 3D commands :)
--Kale

Image
DarthPuff
User
User
Posts: 47
Joined: Sat Apr 26, 2003 2:51 am
Location: USA
Contact:

Post by DarthPuff »

ooohhhhhh a new avatar... do you have any idea whats wrong with my proggy... heres new code...

Code: Select all

;#STANDARD_RIGHTS_REQUIRED = $000F0000
;#SYNCHRONIZE = $00100000
;#PROCESS_ALL_ACCESS = #STANDARD_RIGHTS_REQUIRED+#SYNCHRONIZE+$0FFF
;ProgramName.s = "System\Particles.exe"
;WindowTitle.s = "Particles v0.0.2 Alpha Runtime Window - Puff Inter@ctive"
;RunProgram(ProgramName.s)

If OpenWindow(0,0,0,215,375, #PB_Window_SystemMenu | #PB_Window_TitleBar | #PB_Window_MinimizeGadget,"Particles v0.0.2 Alpha")

  If CreateToolBar(0, WindowID())
  
    ToolBarStandardButton(0, #PB_ToolBarIcon_New)
    ToolBarStandardButton(1, #PB_ToolBarIcon_Open)
    ToolBarStandardButton(2, #PB_ToolBarIcon_Save)
    ToolBarSeparator() 
    ToolBarStandardButton(6, #PB_ToolBarIcon_Print)
    ToolBarSeparator()
    ToolBarStandardButton(4, #PB_ToolBarIcon_Help)
    
  EndIf

  If CreateMenu(0, WindowID())
  
    MenuTitle("File")
      MenuItem( 0, "New")
      MenuBar()
      MenuItem( 1, "Open")
      MenuItem( 2, "Save")
      MenuBar()
      OpenSubMenu("Recent") 
      CloseSubMenu()  
      MenuBar()
      MenuItem( 3, "Exit")
      
    MenuTitle("Help")
      MenuItem(4, "Help")
      MenuBar()
      MenuItem(5, "About")
         
  EndIf
  
  If CreateGadgetList(WindowID())
  
    PanelGadget(0,0,30,215,325)
    
      AddGadgetItem(0,0,"Variables")
        TextGadget(1, 0, 0, 75, 25, "Radius", #PB_Text_Center) 
        ButtonGadget(2, 75, 0, 15, 25, "<=")
        ButtonGadget(3, 90, 0, 15, 25, "<")
        StringGadget(4, 105, 0, 75, 25, Radius2.s , #PB_String_Numeric)
        ButtonGadget(5, 180, 0, 15, 25, ">")
        ButtonGadget(6, 195, 0, 15, 25, "=>")
         
        TextGadget(7, 0, 25, 75, 25, "Speed" , #PB_Text_Center)
        ButtonGadget(8, 75, 25, 15, 25, "<=")
        ButtonGadget(9, 90, 25, 15, 25, "<")
        StringGadget(10, 105, 25, 75, 25, Speed2.s, #PB_String_Numeric)
        ButtonGadget(11, 180, 25, 15, 25, ">")
        ButtonGadget(12, 195, 25, 15, 25, "=>")
        
        TextGadget(13, 0, 50, 75, 25, "Gravity" , #PB_Text_Center)
        ButtonGadget(14, 75, 50, 15, 25, "<=")
        ButtonGadget(15, 90, 50, 15, 25, "<")
        StringGadget(16, 105, 50, 75, 25, Gravity2.s , #PB_String_Numeric)
        ButtonGadget(17, 180, 50, 15, 25, ">")
        ButtonGadget(18, 195, 50, 15, 25, "=>")
        
        TextGadget(19, 0, 75, 75, 25, "Velocity" , #PB_Text_Center)
        ButtonGadget(20, 75, 75, 15, 25, "<=")
        ButtonGadget(21, 90, 75, 15, 25, "<")
        StringGadget(22, 105, 75, 75, 25, Velocity2.s , #PB_String_Numeric)
        ButtonGadget(23, 180, 75, 15, 25, ">")
        ButtonGadget(24, 195, 75, 15, 25, "=>")
         
        TextGadget(25, 0, 100, 75, 25, "Chaos" , #PB_Text_Center)
        ButtonGadget(26, 75, 100, 15, 25, "<=")
        ButtonGadget(27, 90, 100, 15, 25, "<")
        StringGadget(28, 105, 100, 75, 25, Chaos2.s , #PB_String_Numeric)
        ButtonGadget(29, 180, 100, 15, 25, ">")
        ButtonGadget(30, 195, 100, 15, 25, "=>")
        
        TextGadget(31, 0, 125, 75, 25, "Life" , #PB_Text_Center)
        ButtonGadget(32, 75, 125, 15, 25, "<=")
        ButtonGadget(33, 90, 125, 15, 25, "<")
        StringGadget(34, 105, 125, 75, 25, Life2.s , #PB_String_Numeric)
        ButtonGadget(35, 180, 125, 15, 25, ">")
        ButtonGadget(36, 195, 125, 15, 25, "=>")
        
        TextGadget(37, 0, 150, 75, 25, "Emissions" , #PB_Text_Center)
        ButtonGadget(38, 75, 150, 15, 25, "<=")
        ButtonGadget(39, 90, 150, 15, 25, "<")
        StringGadget(40, 105, 150, 75, 25, Emissions2.s , #PB_String_Numeric)
        ButtonGadget(41, 180, 150, 15, 25, ">")
        ButtonGadget(42, 195, 150, 15, 25, "=>")
        
        TextGadget(43, 0, 175, 75, 25, "Frequency" , #PB_Text_Center)
        ButtonGadget(44, 75, 175, 15, 25, "<=")
        ButtonGadget(45, 90, 175, 15, 25, "<")
        StringGadget(46, 105, 175, 75, 25, Frequency2.s , #PB_String_Numeric)
        ButtonGadget(47, 180, 175, 15, 25, ">")
        ButtonGadget(48, 195, 175, 15, 25, "=>")
        
        TextGadget(49, 0, 200, 75, 25, "Depth" , #PB_Text_Center)
        ButtonGadget(50, 75, 200, 15, 25, "<=")
        ButtonGadget(51, 90, 200, 15, 25, "<")
        StringGadget(52, 105, 200, 75, 25, Depth2.s, #PB_String_Numeric)
        ButtonGadget(53, 180, 200, 15, 25, ">")
        ButtonGadget(54, 195, 200, 15, 25, "=>")
        
        TextGadget(55, 0, 225, 75, 25, "Height" , #PB_Text_Center)
        ButtonGadget(56, 75, 225, 15, 25, "<=")
        ButtonGadget(57, 90, 225, 15, 25, "<")
        StringGadget(58, 105, 225, 75, 25, Height2.s, #PB_String_Numeric)
        ButtonGadget(59, 180, 225, 15, 25, ">")
        ButtonGadget(60, 195, 225, 15, 25, "=>")
        
        TextGadget(61, 0, 250, 75, 25, "Width" , #PB_Text_Center)
        ButtonGadget(62, 75, 250, 15, 25, "<=")
        ButtonGadget(63, 90, 250, 15, 25, "<")
        StringGadget(64, 105, 250, 75, 25, Width2.s, #PB_String_Numeric)
        ButtonGadget(65, 180, 250, 15, 25, ">")
        ButtonGadget(66, 195, 250, 15, 25, "=>")
        
        CheckBoxGadget(67, 0, 275, 215, 25, "Floor   |  Key: [>] +\- Less [=>] +\- More") 
    
      AddGadgetItem(0,0,"Image")
        ButtonGadget(68, 0, 0, 75, 25, "Open Image")
        ButtonGadget(69, 0, 25, 75, 25, "Pick Color")
        OptionGadget(70, 100, 0, 125, 25, "Use Image [32x32]")
        OptionGadget(71, 100, 25, 75, 25, "Use Color")
        TextGadget(72, 0, 75, 150, 25, "Current Image:")
        ImageGadget(77, 75, 70, 32, 32, 0, #PB_Image_Border)
        TextGadget(73, 0, 175, 150, 25, "Current Color:")
                   
      AddGadgetItem(0,0,"Effect")
        ButtonGadget(74, 0, 0, 210, 100, "Fountain")
        ButtonGadget(75, 0, 100, 210, 100, "Fire")
        ButtonGadget(76, 0, 200, 210, 100, "Snow")
      
      AddGadgetItem(0,0,"Rotation")
     
    ClosePanelGadget()
    
  EndIf
  
  Radius.l
  Radius=20
  Radius2.s=Str(Radius)
  SetGadgetText(4, Radius2.s)
  
  Speed.f
  Speed=0.01
  Speed2.s=StrF(Speed)
  SetGadgetText(10, Speed2.s)
  
  Gravity.l
  Gravity=2
  Gravity2.s=Str(Gravity)
  SetGadgetText(16, Gravity2.s)
  
  Velocity.l
  Velocity=5
  Velocity2.s=Str(Velocity)
  SetGadgetText(22, Velocity2.s)
  
  Chaos.l
  Chaos=0
  Chaos2.s=Str(Chaos)
  SetGadgetText(28, Chaos2.s)
  
  Life.l
  Life=100
  Life2.s=Str(Life)
  SetGadgetText(34, Life2.s)
  
  Emissions.l
  Emissions=10
  Emissions2.s=Str(Emissions)
  SetGadgetText(40, Emissions2.s)
  
  Frequency.l
  Frequency=100
  Frequency2.s=Str(Frequency)
  SetGadgetText(46, Frequency2.s)
  
  Depth.f
  Depth=5
  Depth2.s=StrF(Depth)
  SetGadgetText(52, Depth2.s)
  
  Height.f
  Height=5
  Height2.s=StrF(Height)
  SetGadgetText(58, Height2.s)
  
  Width.f
  Width=5
  Width2.s=StrF(Width)
  SetGadgetText(64, Width2.s)
  
  Floor.b
  SetGadgetState(67, 1)
  Floor=GetGadgetState(67)
  
  Image.b
  SetGadgetState(71, 1)
  Image=GetGadgetState(70)
  
  small.b
  big.b
  
  InitKeyboard()
  
  Repeat
  
    ExamineKeyboard()
    If KeyboardPushed(#PB_Key_All)
        file.s="System\refresh.dat"
        If CreateFile(0,file.s)
          CloseFile(0)
        EndIf
    EndIf
    
    file.s = "System\Update.dat"
    OpenFile(0,file.s)
      WriteStringN(GetGadgetText(4))
      WriteStringN(GetGadgetText(10))
      WriteStringN(GetGadgetText(16))
      WriteStringN(GetGadgetText(22))
      WriteStringN(GetGadgetText(28))
      WriteStringN(GetGadgetText(34))
      WriteStringN(GetGadgetText(40))
      WriteStringN(GetGadgetText(46))
      WriteStringN(GetGadgetText(52))
      WriteStringN(GetGadgetText(58))
      WriteStringN(GetGadgetText(64))
      WriteStringN(Str(GetGadgetState(67)))
      WriteStringN(Str(GetGadgetState(70)))
      WriteStringN(Str(GetGadgetState(71)))
      path.s=GetPathPart(File2.s)
      WriteStringN(path.s)
      part.s=GetFilePart(File2.s)
      WriteStringN(part.s)
    CloseFile(0) 
    
    nop.s="System\nop.dat"
    If FileSize(nop.s)<>-1
      DeleteFile(nop.s)
      MessageRequester("Particles - Error!", "The specified path does not exist!", #PB_MessageRequester_Ok)
    EndIf
    
    noi.s="System\noi.dat"
    If FileSize(noi.s)<>-1
      DeleteFile(noi.s)
      MessageRequester("Particles - Error!", "The specified image does not exist!", #PB_MessageRequester_Ok)
    EndIf
  
    EventID.l = WaitWindowEvent()

    If EventID = #PB_EventMenu   
        Select EventMenuID()
        
          Case 0      
            Radius=20
            Radius2.s=Str(Radius)
            SetGadgetText(4, Radius2.s)

            Speed=0.01
            Speed2.s=StrF(Speed)
            SetGadgetText(10, Speed2.s)
  
            Gravity=2
            Gravity2.s=Str(Gravity)
            SetGadgetText(16, Gravity2.s)

            Velocity=5
            Velocity2.s=Str(Velocity)
            SetGadgetText(22, Velocity2.s)
  
            Chaos=0
            Chaos2.s=Str(Chaos)
            SetGadgetText(28, Chaos2.s)
  
            Life=100
            Life2.s=Str(Life)
            SetGadgetText(34, Life2.s)
  
            Emissions=10
            Emissions2.s=Str(Emissions)
            SetGadgetText(40, Emissions2.s)
  
            Frequency=100
            Frequency2.s=Str(Frequency)
            SetGadgetText(46, Frequency2.s)
  
            Depth=5
            Depth2.s=StrF(Depth)
            SetGadgetText(52, Depth2.s)
 
            Height=5
            Height2.s=StrF(Height)
            SetGadgetText(58, Height2.s)
  
            Width=5
            Width2.s=StrF(Width)
            SetGadgetText(64, Width2.s)
  
            SetGadgetState(67, 1)
            Floor=GetGadgetState(67)
            
            SetGadgetState(70, 0)           
            SetGadgetState(71, 1)
            Image=GetGadgetState(70)
            
            file.s="System\refresh.dat"
            If CreateFile(0,file.s)
              CloseFile(0)
            EndIf
                            
          Case 1
            File.s = OpenFileRequester("Particles - Open", "C:\", "Particle (*.part)|*.part", 0)
            If File.s+File.s
              MessageRequester("Information", "Selected File: "+File.s, 0)
            EndIf
            
          Case 2
            File.s = SaveFileRequester("Particles - Save", "C:\", "Particle (*.part)|*.part", 1)
            If File.s
              MessageRequester("Information", "Selected File: "+File.s, 0)
            EndIf
                       
          Case 3
;            ProcessId.l
;            ExitCode.l
;            hWindow = FindWindow_(0, WindowTitle)
;            GetWindowThreadProcessId_(hWindow, @ProcessId)
;            hProcess = OpenProcess_(#PROCESS_ALL_ACCESS, #TRUE, ProcessId)
;            GetExitCodeProcess_(hProcess, @ExitCode)
;            TerminateProcess_(hProcess, ExitCode)
             End
             
        EndSelect
    EndIf
    
    If EventID = #PB_EventGadget
      Select EventGadgetID()
      
        Case 2
          Radius2.s=GetGadgetText(4)
          Radius=Val(Radius2.s)
          Radius=Radius-5
          Radius2.s=Str(Radius)
          SetGadgetText(4, Radius2.s)
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
        
        Case 3
          Radius2.s=GetGadgetText(4)
          Radius=Val(Radius2.s)
          Radius=Radius-1
          Radius2.s=Str(Radius)
          SetGadgetText(4, Radius2.s)
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
      
        Case 5
          Radius2.s=GetGadgetText(4)
          Radius=Val(Radius2.s)
          Radius=Radius+1
          Radius2.s=Str(Radius)
          SetGadgetText(4, Radius2.s)
   
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
        
        Case 6
          Radius2.s=GetGadgetText(4)
          Radius=Val(Radius2.s)
          Radius=Radius+5
          Radius2.s=StrF(Radius)
          SetGadgetText(4, Radius2.s)
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
        
        Case 8
          Speed2.s=GetGadgetText(10)
          Speed=ValF(Speed2.s)
          Speed=Speed-0.000005
          Speed2.s=StrF(Speed)
          SetGadgetText(10, Speed2.s) 
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
        
        Case 9
          Speed2.s=GetGadgetText(10)
          Speed=ValF(Speed2.s)
          Speed=Speed-0.000001
          Speed2.s=StrF(Speed)
          SetGadgetText(10, Speed2.s)
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
        
        Case 11
          Speed2.s=GetGadgetText(10)
          Speed=ValF(Speed2.s)
          Speed=Speed+0.000001
          Speed2.s=StrF(Speed)
          SetGadgetText(10, Speed2.s)
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
        
        Case 12
          Speed2.s=GetGadgetText(10)
          Speed=ValF(Speed2.s)
          Speed=Speed+0.000005
          Speed2.s=StrF(Speed)
          SetGadgetText(10, Speed2.s)

          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf

        Case 14
          Gravity2.s=GetGadgetText(16)
          Gravity=Val(Gravity2.s)
          Gravity=Gravity-5
          Gravity2.s=Str(Gravity)
          SetGadgetText(16, Gravity2.s)

          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
         
        Case 15
          Gravity2.s=GetGadgetText(16)
          Gravity=Val(Gravity2.s)
          Gravity=Gravity-1
          Gravity2.s=Str(Gravity)
          SetGadgetText(16, Gravity2.s)        
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
        
        Case 17
          Gravity2.s=GetGadgetText(16)
          Gravity=Val(Gravity2.s)
          Gravity=Gravity+1
          Gravity2.s=Str(Gravity)
          SetGadgetText(16, Gravity2.s)
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
        
        Case 18
          Gravity2.s=GetGadgetText(16)
          Gravity=Val(Gravity2.s)
          Gravity=Gravity+5
          Gravity2.s=Str(Gravity)
          SetGadgetText(16, Gravity2.s)
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
          
        Case 20
          Velocity2.s=GetGadgetText(22)
          Velocity=Val(Velocity2.s)
          Velocity=Velocity-5
          Velocity2.s=Str(Velocity)
          SetGadgetText(22, Velocity2.s)
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
        
        Case 21
          Velocity2.s=GetGadgetText(22)
          Velocity=Val(Velocity2.s)
          Velocity=Velocity-1
          Velocity2.s=Str(Velocity)
          SetGadgetText(22, Velocity2.s)
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
        
        Case 23
          Velocity2.s=GetGadgetText(22)
          Velocity=Val(Velocity2.s)
          Velocity=Velocity+1
          Velocity2.s=Str(Velocity)
          SetGadgetText(22, Velocity2.s)
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
        
        Case 24
          Velocity2.s=GetGadgetText(22)
          Velocity=Val(Velocity2.s)
          Velocity=Velocity+5
          Velocity2.s=Str(Velocity)
          SetGadgetText(22, Velocity2.s)
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
          
        Case 26
          Chaos2.s=GetGadgetText(28)
          Chaos=Val(Chaos2.s)
          Chaos=Chaos-5
          Chaos2.s=Str(Chaos)
          SetGadgetText(28, Chaos2.s)
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
        
        Case 27
          Chaos2.s=GetGadgetText(28)
          Chaos=Val(Chaos2.s)
          Chaos=Chaos-1
          Chaos2.s=Str(Chaos)
          SetGadgetText(28, Chaos2.s)
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
        
        Case 29
          Chaos2.s=GetGadgetText(28)
          Chaos=Val(Chaos2.s)
          Chaos=Chaos+1
          Chaos2.s=Str(Chaos)
          SetGadgetText(28, Chaos2.s)
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
        
        Case 30
          Chaos2.s=GetGadgetText(28)
          Chaos=Val(Chaos2.s)
          Chaos=Chaos+5
          Chaos2.s=Str(Chaos)
          SetGadgetText(28, Chaos2.s)
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
                           
        Case 32
          Life2.s=GetGadgetText(34)
          Life=Val(Life2.s)
          Life=Life-5
          Life2.s=Str(Life)
          SetGadgetText(34, Life2.s)
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf  
        
        Case 33
          Life2.s=GetGadgetText(34)
          Life=Val(Life2.s)
          Life=Life-1
          Life2.s=Str(Life)
          SetGadgetText(34, Life2.s)
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
        
        Case 35
          Life2.s=GetGadgetText(34)
          Life=Val(Life2.s)
          Life=Life+1
          Life2.s=Str(Life)
          SetGadgetText(34, Life2.s)
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
        
        Case 36
          Life2.s=GetGadgetText(34)
          Life=Val(Life2.s)
          Life=Life+5
          Life2.s=Str(Life)
          SetGadgetText(34, Life2.s)
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
          
        Case 38
          Emissions2.s=GetGadgetText(40)
          Emissions=Val(Emissions2.s)
          Emissions=Emissions-5
          Emissions2.s=Str(Emissions)
          SetGadgetText(40, Emissions2.s) 
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf 
        
        Case 39
          Emissions2.s=GetGadgetText(40)
          Emissions=Val(Emissions2.s)
          Emissions=Emissions-1
          Emissions2.s=Str(Emissions)
          SetGadgetText(40, Emissions2.s)
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
        
        Case 41
          Emissions2.s=GetGadgetText(40)
          Emissions=Val(Emissions2.s)
          Emissions=Emissions+1
          Emissions2.s=Str(Emissions)
          SetGadgetText(40, Emissions2.s)
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
        
        Case 42
          Emissions2.s=GetGadgetText(40)
          Emissions=Val(Emissions2.s)
          Emissions=Emissions+5
          Emissions2.s=Str(Emissions)
          SetGadgetText(40, Emissions2.s)
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
          
        Case 44
          Frequency2.s=GetGadgetText(46)
          Frequency=Val(Frequency2.s)
          Frequency=Frequency-5
          Frequency2.s=Str(Frequency)
          SetGadgetText(46, Frequency2.s) 
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf 
        
        Case 45
          Frequency2.s=GetGadgetText(46)
          Frequency=Val(Frequency2.s)
          Frequency=Frequency-1
          Frequency2.s=Str(Frequency)
          SetGadgetText(46, Frequency2.s)
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
        
        Case 47
          Frequency2.s=GetGadgetText(46)
          Frequency=Val(Frequency2.s)
          Frequency=Frequency+1
          Frequency2.s=Str(Frequency)
          SetGadgetText(46, Frequency2.s)
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
        
        Case 48
          Frequency2.s=GetGadgetText(46)
          Frequency=Val(Frequency2.s)
          Frequency=Frequency+5
          Frequency2.s=Str(Frequency)
          SetGadgetText(46, Frequency2.s)
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
          
        Case 50
          Depth2.s=GetGadgetText(52)
          Depth=ValF(Depth2.s)
          Depth=Depth-0.1
          Depth2.s=StrF(Depth)
          SetGadgetText(52, Depth2.s)
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf  
        
        Case 51
          Depth2.s=GetGadgetText(52)
          Depth=ValF(Depth2.s)
          Depth=Depth-0.01
          Depth2.s=StrF(Depth)
          SetGadgetText(52, Depth2.s)
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
        
        Case 53
          Depth2.s=GetGadgetText(52)
          Depth=ValF(Depth2.s)
          Depth=Depth+0.01
          Depth2.s=StrF(Depth)
          SetGadgetText(52, Depth2.s)
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
        
        Case 54
          Depth2.s=GetGadgetText(52)
          Depth=ValF(Depth2.s)
          Depth=Depth+0.1
          Depth2.s=StrF(Depth)
          SetGadgetText(52, Depth2.s)
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
          
        Case 56
          Height2.s=GetGadgetText(58)
          Height=ValF(Height2.s)
          Height=Height-0.1
          Height2.s=StrF(Height)
          SetGadgetText(58, Height2.s)  
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
        
        Case 57
          Height2.s=GetGadgetText(58)
          Height=ValF(Height2.s)
          Height=Height-0.01
          Height2.s=StrF(Height)
          SetGadgetText(58, Height2.s)
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
        
        Case 59
          Height2.s=GetGadgetText(58)
          Height=ValF(Height2.s)
          Height=Height+0.01
          Height2.s=StrF(Height)
          SetGadgetText(58, Height2.s)
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
        
        Case 60
          Height2.s=GetGadgetText(58)
          Height=ValF(Height2.s)
          Height=Height+0.1
          Height2.s=StrF(Height)
          SetGadgetText(58, Height2.s)
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
                             
        Case 62
          Width2.s=GetGadgetText(64)
          Width=ValF(Width2.s)
          Width=Width-0.1
          Width2.s=StrF(Width)
          SetGadgetText(64, Width2.s)  
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
        
        Case 63
          Width2.s=GetGadgetText(64)
          Width=ValF(Width2.s)
          Width=Width-0.01
          Width2.s=StrF(Width)
          SetGadgetText(64, Width2.s)
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
        
        Case 65
          Width2.s=GetGadgetText(64)
          Width=ValF(Width2.s)
          Width=Width+0.01
          Width2.s=StrF(Width)
          SetGadgetText(64, Width2.s)
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
        
        Case 66
          Width2.s=GetGadgetText(64)
          Width=ValF(Width2.s)
          Width=Width+0.1
          Width2.s=StrF(Width)
          SetGadgetText(64, Width2.s)
          
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
          
        Case 67        
          file.s="System\refresh.dat"
          If CreateFile(0,file.s)
            CloseFile(0)
          EndIf
          
        Case 68
          File2.s = OpenFileRequester("Particles - Open", "C:\", "Bitmap (*.bmp)|*.bmp", 0)
          If File2.s+File2.s
            LoadImage(0,File2.s)         
            If ImageHeight()<32 Or ImageWidth()<32
              MessageRequester("Particles - Error!", "The Image "+File2.s+" is either not tall or not wide enough!", #PB_MessageRequester_Ok)
              small=1
              FreeImage(UseImage(0))
            EndIf
            If ImageHeight()>32 Or ImageWidth()>32
              MessageRequester("Particles - Error!", "The Image "+File2.s+" is either too wide or too tall!", #PB_MessageRequester_Ok)
              big=1
              FreeImage(UseImage(0))
            EndIf                     
            If small=0 And big=0
              SetGadgetState(77,UseImage(0))

              file.s = "System\Update.dat"
              OpenFile(0,file.s)
                WriteStringN(GetGadgetText(4))
                WriteStringN(GetGadgetText(10))
                WriteStringN(GetGadgetText(16))
                WriteStringN(GetGadgetText(22))
                WriteStringN(GetGadgetText(28))
                WriteStringN(GetGadgetText(34))
                WriteStringN(GetGadgetText(40))
                WriteStringN(GetGadgetText(46))
                WriteStringN(GetGadgetText(52))
                WriteStringN(GetGadgetText(58))
                WriteStringN(GetGadgetText(64))
                WriteStringN(Str(GetGadgetState(67)))
                WriteStringN(Str(GetGadgetState(70)))
                WriteStringN(Str(GetGadgetState(71)))
                path.s=GetPathPart(File2.s)
                WriteStringN(path.s)
                part.s=GetFilePart(File2.s)
                WriteStringN(part.s)
              CloseFile(0)  
                          
              file.s="System\refresh.dat"
              If CreateFile(0,file.s)
                CloseFile(0)
              EndIf
              
            EndIf
            big=0
            small=0           
          EndIf
         
        Case 69
          ColorRequester()
                                                         
      EndSelect   
    EndIf
       
    Floor=GetGadgetState(67)
    Image=GetGadgetState(70)

    Radius2.s=GetGadgetText(4)
    Radius=Val(Radius2.s)
  
    Speed2.s=GetGadgetText(10)
    Speed=ValF(Speed2.s)
          
    Gravity2.s=GetGadgetText(16)
    Gravity=Val(Gravity2.s)
 
    Velocity2.s=GetGadgetText(22)
    Velocity=Val(Velocity2.s)

    Chaos2.s=GetGadgetText(28)
    Chaos=Val(Chaos2.s)
          
    Life2.s=GetGadgetText(34)
    Life=Val(Life2.s)
          
    Emissions2.s=GetGadgetText(40)
    Emissions=Val(Emissions2.s)
       
    Frequency2.s=GetGadgetText(46)
    Frequency=Val(Frequency2.s)
          
    Depth2.s=GetGadgetText(52)
    Depth=ValF(Depth2.s)
          
    Height2.s=GetGadgetText(58)
    Height=ValF(Height2.s)

    Width2.s=GetGadgetText(64)
    Width=ValF(Width2.s)
       
   Until EventID = #PB_EventCloseWindow
   
;   ProcessId.l
;   ExitCode.l
;   hWindow = FindWindow_(0, WindowTitle)
;   GetWindowThreadProcessId_(hWindow, @ProcessId)
;   hProcess = OpenProcess_(#PROCESS_ALL_ACCESS, #TRUE, ProcessId)
;   GetExitCodeProcess_(hProcess, @ExitCode)
;   TerminateProcess_(hProcess, ExitCode)

EndIf
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

I have run your code and it seems ok, i get no garbled characters after the path parts :?

instead of:

Code: Select all

WriteStringN(part.s)
try:

Code: Select all

WriteString(part.s+Chr(10))
see if you have more luck.

BTW i notice that you use type definitions after each variable, this really doesn't need to be done (and i don't know if it would cause problems) I only use type definitions just to declare variables then just use their name.
i.e.

Code: Select all

stringType.s = "Hello"  ;<--- '.s' to declare as string
Print stringType           ;<--- notice no '.s'
--Kale

Image
DarthPuff
User
User
Posts: 47
Joined: Sat Apr 26, 2003 2:51 am
Location: USA
Contact:

Post by DarthPuff »

o_O I'm just used to it... it keeps my mind fresh... O_O in C++ I always have to look back and make sure I'm not messing up...
DarthPuff
User
User
Posts: 47
Joined: Sat Apr 26, 2003 2:51 am
Location: USA
Contact:

Post by DarthPuff »

o_O I was just thinking... if I could just delete everything in the text file after example.bmp in purebasic it would fix my problem (what OS are you running also?)
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

WinXP Home
--Kale

Image
DarthPuff
User
User
Posts: 47
Joined: Sat Apr 26, 2003 2:51 am
Location: USA
Contact:

Post by DarthPuff »

yup it works... o_O I figured out what was wrong... I fixed the bug a long time ago... but I never deleted the file that it was saving into.. so I never cleared the bad stuff...
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

Doh! ;)
--Kale

Image
Post Reply