Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Strange crash (Dim using GetEditBoxText value)

Author
Message
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 24th Apr 2014 22:04
Got a really weird bug that I just can't figure out. I've traced it back to this bit of code:


Basically I can enter any value into the edit box and it works fine...apart from 10 and 5.... If I hard code those into the Dim command it works fine so I have to assume that the GetWidth or GetHeight variables are not transferring the number correctly. But it just seems utterly weird that it only causes an issue when I use 10 and 5. I can enter 5 and 10 no issues, 10 and 4, 10 and 6, 9 and 5 etc..Just not 10 and 5.

Any clues?!?!
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 24th Apr 2014 23:41 Edited at: 24th Apr 2014 23:41
maybe in CalcMapEditGridSize() , seems u use global variables
but redim array after call.
try remark sub function calls... you can isolate/find problem.

AGK 108 (B)19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 24th Apr 2014 23:59
If I hard code what I enter via the edit boxes I don't get the crash so I'm fairly certain it is an error in that piece of code - ie the transfer of a value from the edit box to the dimensioning of the array rather than the values being bad ones for my code somewhere. I messed around and got odd results, for example it didn't crash when I entered 5.1 instead of 5. The variable in question is an integer so I'm guessing in the internal change from float to integer AppGameKit correctly stored the number but when it was entered as a straight 5 it didn't.
Hockeykid
DBPro Tool Maker
17
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 25th Apr 2014 00:09
Quote: " for example it didn't crash when I entered 5.1 instead of 5"


Might be worth trying this:

Try using


instead of



Sean

DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 25th Apr 2014 00:24
I've tried the Trunc thing previously but not the valfloat - Good call, I will give that a go and report back...
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 25th Apr 2014 00:31
Argh! It seems to be working before I make any changes now...I always like to be able to see the error then not see it to be certain that the change has worked but it's not giving me the error in the first place now!? I'll try again tomorrow and then give the ValFloat command a go as suggested.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 25th Apr 2014 08:31
is both integer because used in dim of array?
GetWidth
GetHeight
MapWidthInTiles
MapHeightInTiles

AGK 108 (B)19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 25th Apr 2014 19:01
The MapWidthInTiles and MapHeightInTiles ones are Global variables and the GetWidth and GetHeight ones are just local to the function.

Base on the fact that hard-coded values and those same values entered via the editbox give different results (works fine vs crash) I have to assume that the values entered into the edit box are not correctly transferred to the variables. I could code an up and down button to remove the need for text entry but it feels wrong. Number entry via an edit box should work.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 25th Apr 2014 20:12
hmm.
for debugging i often use the print command..
for one of my game i also use value input from editbox for config,
never had a problem with it.
other problem i have is that the editbox did not work at some newer android os versions.

what agk version u use?

AGK 108 (B)19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 26th Apr 2014 01:22
108.21

Yes, I was thinking I should print the value to screen with something before it and after it so I can see if there are spaces for example being added somehow. I've set the edit box to be "" before hand to try and avoid this scenario but clearly something odd is happening.

Login to post a reply

Server time is: 2024-11-25 04:50:03
Your offset time is: 2024-11-25 04:50:03