stack overflow

Post Reply
Razor McGoo
Posts: 4
Joined: Sun Mar 29, 2020 7:44 pm

stack overflow

Post by Razor McGoo » Sun Mar 29, 2020 8:38 pm

Personality Wheel.txt
(1.62 KiB) Downloaded 33 times
I'm getting a stack overflow error. Is it really that big or do I have an issue?

User avatar
kibernetik
Site Admin
Posts: 142
Joined: Tue Aug 06, 2019 3:03 pm

Re: stack overflow

Post by kibernetik » Mon Mar 30, 2020 10:34 am

Thank you for your report.
Yes, this is a bug. BestBASIC fails to report some syntax errors in your code. This will be fixed in next release.

Please take a look at your program with my corrections. You have missed several END IF commands, and BestBASIC failed to inform you about that. I have added these missing commands and commented them with '!' symbol for you to see:

Code: Select all

def getPlayer
	
	data "Jayson", "Byrne", 315, 3, -3, 3, 60
	data "Oskar", "Duggan", 45, 3, -2, 3, 82
	data "lms"

	Dim playerData(20,9)
	For player = 0 to 19
		for item = 0 to 6
			read playerData(player,item)
			if playerData(player,0)="lms" then goto GPdone
			if item = 6 then print playerData(player,item) else print playerData(player,item); " ";
		next item
	next player
GPdone	
end def

getPlayer


for player = 0 to 1
	vvar= 0
	for item=3 to 6
		vvar=vvar+playerData(player,item)
	next
	if 270 < playerData(player,2) and playerData(player,2) < 360 then 
		quad=0
	else if 180 < playerData(player,2) then 
		quad=90
	else if 90<playerData(player,2)<180 then
		quad=180
	else
		quad=270
	end if

	if playerData(player,2)+quad-vvar<270 then 
		playerData(player,7)=playerData(player,2)-vvar
	else if playerData(player,2)+quad-vvar*2<=270 then
		platerData(player,7)=270-quad
	else 
		playerData(player,7)=playerData(player,2)-vvar*2
	end if

	if playerData(player,2)+quad+vvar>360 then 
		playerData(player,8)=playerData(player,2)+vvar
	else if playerData(player,2)+quad-vvar*2>=360 then 
		playerData(player,8)=360-quad
	else
		playerData(player,8)=playerData(player,2)+vvar*2
	end if '!

	if round playerData(player,7)<playerData(player,7) then
		playerData(player,7)=round playerData(player,7)+.5
	else 
		playerData(player,7)=round playerData(player,7)
	end if '!
	if playerData(player,7)<0 then playerData(player,7)=playerData(player,7)+360
	
	if round playerData(player,8)>playerData(player,8) then
		playerData(player,8)=round playerData(player,8)-.5
	else 
		playerData(player,8)=round playerData(player,8)
	end if '!

	print vvar;playerData(player,7);playerData(player,8)
next

Razor McGoo
Posts: 4
Joined: Sun Mar 29, 2020 7:44 pm

Re: stack overflow

Post by Razor McGoo » Mon Mar 30, 2020 10:11 pm

Thank a lot. That was very helpful. So when you are in multi line mode you have to follow protocols exactly.

Post Reply