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 / CountStringTokens bug?

Author
Message
Abiz
12
Years of Service
User Offline
Joined: 14th Nov 2012
Location: Amsterdam
Posted: 20th Nov 2012 17:32
Below is a very small program I made. It works fine on the PC.
But when I use AppGameKit Viewer on my Eepad it gives 18939960 instead of 6.
Any ideas anyone?

==================
data$="1:23:456"
delimiter$ = ":"
counttokens = CountStringTokens(data$, delimiter$)

do
print("Nbr of tokens: " + str(counttokens) )
Sync()
loop
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 20th Nov 2012 18:03
Could be the Android Player has a few issues, or did you build it yourself?

There is another version of the Android Player floating around on the forums somewhere...


this.mess = abs(sin(times#))
Marl
13
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 20th Nov 2012 19:41
Quote: "18939960 instead of 6."

It should be giving 3 not 6
Abiz
12
Years of Service
User Offline
Joined: 14th Nov 2012
Location: Amsterdam
Posted: 20th Nov 2012 21:42
@baxslash: I assume official. I got this one from the Apple store.

@marl: It's 3. my typo.


Another thing that doesn't work is this:
random(100,9999)
On the Eepad it constantly gives the same result.
If f.i. you place this before the random():
SetRandomSeed ( 100 )
You get another result but constantly the same.
Works fine on PC.

I'm a novice with AppGameKit and these things are quite annoying, as I first have to check my own new code to see if I didn't make any mistakes. How are these things handled by TGC?
Is there a place for bug reports?
Abiz
12
Years of Service
User Offline
Joined: 14th Nov 2012
Location: Amsterdam
Posted: 20th Nov 2012 22:23
I've downloaded the new viewers (mentioned in other thread) and they seem to work fine. Changed SetRandomSeed() with a code snippet I found in another thread.

Thanks all for replying.
Marl
13
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 20th Nov 2012 22:35
@Abiz, figured as much, but had to get it out of the way

Definitely looks like a bug.

Have you tried different delimiters and strings to see if's bugged across the board or just with that combination?

SetRandomSeed( 100 ) uses 100 to seed the random number generator so should give the same result each time.

Using a seed value based on time is a better way to ensure it changes between runs.
Abiz
12
Years of Service
User Offline
Joined: 14th Nov 2012
Location: Amsterdam
Posted: 20th Nov 2012 22:47
@Marl: I've already posted a reply but as a novice forum user, it must be approved first, before publishing.

In short: I've installed 1082 and that solved the countstringtokens problem. The randomseed is corrected by a code snippet I found on this forum.
Thanks for your answer.
Marl
13
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 21st Nov 2012 02:18
Yeah, the approval thing can make threads seem a little out of order, but you won't have to go through it for long.

Glad you got it sorted.
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 5th Dec 2012 01:00
I had already written my own token system before one appeared in AGK. If you don't like the inbuilt one, I can post mine - which definately does work

Abiz
12
Years of Service
User Offline
Joined: 14th Nov 2012
Location: Amsterdam
Posted: 5th Dec 2012 14:13
Thanks for the offer. I'll keep it in mind.

Login to post a reply

Server time is: 2024-11-24 03:39:43
Your offset time is: 2024-11-24 03:39:43