Strange "error message"

Archives Forums/BlitzPlus Bug Reports/Strange "error message"

Stamm(Posted 2010) [#1]
with the following code (its an editor for the spells i use in my game)
i just hear the error message sound, then blitzcc terminates, everything disappears and i dont even get a real error message that could help me to understand whats happening
;Spell Editor for Magic Battle

Global win=CreateWindow("Spell Editor for Magic Battle",50,-600,800,600)
gg=1
SetMinWindowSize win
HideGadget win

;Menus
Global wm=WindowMenu(win)
gg=gg+1
Global fm=CreateMenu("File",0,wm)
gg=gg+1
CreateMenu("&Help",1,fm)
CreateMenu("",65535,fm)
CreateMenu("&Open",2,fm)
CreateMenu("&Save",3,fm)
CreateMenu("Save &As...",4,fm)
CreateMenu("",65535,fm)
CreateMenu("Exit",5,fm)
UpdateWindowMenu(win)

;---------
;Gadgets
;---------

;Spell Ranks
Global rnkTabber=CreateTabber(0,0,800,20,win)
gg=gg+1
Dim rnkPanel(14)
For r=1 To 15
AddGadgetItem rnkTabber,"Rank "+r
rnkPanel(r-1)=CreatePanel(0,20,800,580,win)
gg=gg+1
Next

;arrays for loop

Dim DmgTxt(14)
Dim HealTxt(14)

Dim effectPanel(14)
Dim effect(4,8,14)

Dim rngPanel(11,14)
Dim range(12,12,14)
Dim fx(4,14)
Dim btnSetDDRange(14)
Dim btnSetDHRange(14)
Dim telebtn(4,14)

Dim tele(4,1,14)

Dim tooltiparea(14)


For r=0 To 14
;DirectDamage
CreateLabel("Damage:",5,25,60,20,rnkPanel(r))
DmgTxt(r)=CreateTextField(70,25,60,20,rnkPanel(r))
gg=gg+1

;DirectHeal
CreateLabel("Healing:",5,50,60,20,rnkPanel(r))
HealTxt(r)=CreateTextField(70,50,60,20,rnkPanel(r))
gg=gg+1

;effects
effectPanel(r)=CreatePanel(5,95,320,350,rnkPanel(r))
gg=gg+1
HideGadget rnkPanel(r)
SetPanelColor effectPanel(r),255,0,0
;ID	|	Gadget
;---|---------
;0	| DurationTxt
;1	| ValueCombo
;2	| ValueTxt
;3	| AddButton
;4	| NameTxt
;5	| ListBox
;6	| RemoveButton
;7	| Clear All
;8	| Clear List
file=ReadFile("effects.txt")
For n=0 To 4
SeekFile file,0
CreateLabel("Effect "+Str(n+1),0,n*70+4,37,15,effectPanel(r))

CreateLabel("Duration",0,n*70+23,50,15,effectPanel(r))
effect(n,0,r)=CreateTextField(0,n*70+40,50,20,effectPanel(r))
gg=gg+1
;Stop
effect(n,1,r)=CreateFXTypeCombo() ;If i cut out this line everything SEEMS TO work fine, as no errro message appears
gg=gg+1
effect(n,2,r)=CreateTextField(95,n*70+20,60,20,effectPanel(r))
gg=gg+1
CreateLabel("Value:",55,n*70+23,35,15,effectPanel(r))
effect(n,3,r)=CreateButton("Add",150,n*70+42,35,20,effectPanel(r))
gg=gg+1
effect(n,4,r)=CreateTextField(90,n*70,50,20,effectPanel(r))
gg=gg+1

effect(n,5,r)=CreateListBox(190,n*70,75,70,effectPanel(r))
gg=gg+1
effect(n,6,r)=CreateButton("Remove",270,n*70,50,15,effectPanel(r))
gg=gg+1

effect(n,7,r)=CreateButton("Clear All",270,n*70+40,50,15,effectPanel(r))
gg=gg+1
effect(n,8,r)=CreateButton("Clear List",270,n*70+20,50,15,effectPanel(r))
gg=gg+1
Next


;range select
For n=0 To 11
rngPanel(n,r)=CreatePanel(360,40,195,195,rnkPanel(r))
gg=gg+1
For x=0 To 12
For y=0 To 12
range(x,y,r)=CreateButton("",x*15,y*15,15,15,rngPanel(n,r),2)
gg=gg+1
If x=6 And y=6 Then
	CreateLabel("x",345,y*15+40,15,15,rngPanel(n,r))
	CreateLabel("x",560,y*15+40,15,15,rngPanel(n,r))
	CreateLabel("x",x*15+364,25,15,15,rngPanel(n,r))
	CreateLabel("x",x*15+364,238,15,15,rngPanel(n,r))
	SetButtonState range(x,y-1,r),1
EndIf
Next:Next:Next

CreateLabel("Set Effect Range",575,27,100,15,rnkPanel(r))
For n=0 To 4
fx(n,r)=CreateButton("Effect "+Str(n+1),575,n*15+55,60,15,rnkPanel(r),3)
gg=gg+1
Next
btnSetDDRange(r)=CreateButton("Set DirectDamage Range",575,130,150,15,rnkPanel(r),3)
gg=gg+1
SetButtonState btnSetDDRange(r),1
btnSetDHRange(r)=CreateButton("Set DirectHeal Range",575,145,150,15,rnkPanel(r),3)
gg=gg+1
For n=0 To 4
telebtn(n,r)=CreateButton("Set Teleport "+Str(n+1)+" Range",575,n*15+160,150,15,rnkPanel(r),3)
gg=gg+1
Next

;teleport
For n=0 To 4
CreateLabel("Teleport "+Str(n+1),575,n*20+252,50,15,rnkPanel(r))
CreateLabel("x",638,n*20+252,10,15,rnkPanel(r))
CreateLabel("y",710,n*20+252,10,15,rnkPanel(r))
tele(n,0,r)=CreateTextField(650,n*20+250,55,20,rnkPanel(r))
gg=gg+1
tele(n,1,r)=CreateTextField(720,n*20+250,55,20,rnkPanel(r))
gg=gg+1
Next

;tooltip
CreateLabel("Tooltip",440,260,40,15,rnkPanel(r))
tooltiparea(r)=CreateTextArea(360,280,200,200,rnkPanel(r))
gg=gg+1
Next

ShowGadget rnkPanel(0)
ShowGadget win

AppTitle "Note:"
Notify "Total number of STORED gadgets(not including labels)="+gg
.evloop
id=WaitEvent()
src=EventSource()
dat=EventData()
ex=EventX()
ey=EventY()
ez=EventZ()
Select id
	Case $803:If Not changes Then End Else Select Proceed("Data wasn't saved. Save before quit?")
												Case 0:End
												Case 1:Save(1):End
											End Select
	Case $1001:Select dat
					Case 1:ShowHelp()
					Case 2:Open()
					Case 3:Save(1)
					Case 4:Save()
					Case 5:If Not changes Then
						End
					Else:Select Proceed("Data wasn't saved. Save before quit?")
							Case 0:End
							Case 1:Save(1):End
						End Select
					EndIf
				End Select
	Case $401
		For r=0 To 14
			For n=0 To 4
				UpdateFXPanel(n,r)
			Next
		Next
End Select
Goto evloop

Function CreateFXTypeCombo()
	ret=CreateComboBox(55,n*70+40,90,15,effectPanel(r))
	AddGadgetItem ret,"Select Effect Type"
	SelectGadgetItem ret,0
	Restore fctypes
	Repeat
		Read fcs$
		AddGadgetItem ret,fcs
	Until fcs="END"
	Return ret
End Function

Function Save(curr=0)
End Function

Function Open()
End Function

Function ShowHelp()
AppTitle "Help"
file=ReadFile("hlp.txt")
Repeat
hlp$=hlp+Chr(13)+Chr(10)+ReadLine(file)
Until Eof(file)
Notify hlp
End Function

Function UpdateFXPanel(i,r)
	Select src
		Case effect(n,2,r),effect(n,0,r)
			SetGadgetText src,Int(TextFieldText(src))
		Case effect(n,3,r)
			AddGadgetItem effect(n,5,r),GadgetItemText(effect(n,1,r),SelectedGadgetItem(effect(n,1,r)))+TextFieldText(effect(n,2,r))
		Case effect(n,6,r)
			RemoveGadgetItem effect(n,5,r),SelectedGadgetItem(effect(n,5,r))
		Case effect(n,7,r):ClearGadgetItems effect(n,5,r)
	End Select
End Function

.fctypes
Data "DoT-Physical","DoT-Arcane","DoT-Light","DoT-Shadow","DoT-Fire","DoT-Frost","DoT-Earth","DoT-Lightning"
Data "HoT"
Data "Stamina+","Strength+","Intelligence+","Dexterity+","Spellpower+"
Data "Stamina-","Strength-","Intelligence-","Dexterity-","Spellpower-"
Data "END"

i know this is a bit undercommented but i still hope you'll understand it ;)
i also know my event loop is a bit strange but otherwise it doesn't work


Matty(Posted 2010) [#2]
Maybe try and narrow it down a little to find out when it crashes, after which instruction. I realise there is no helpful error code thrown but it is still possible to debug it manually by removing sections of code you think it may be failing on...my guess is it's an error in your code, not blitz.