Ajax Tokenat question

For developers using the Construct 2 Javascript SDK

Post » Fri Mar 27, 2015 7:04 pm

I ran a capx from Jim Quicks blog http://blogs.msdn.com/b/quick_thoughts/
showing how to add a leader board from Azure. The setup was easy but the display of the scores does some odd things. I am sure it is because of the way the row is being separated but I just don't see it.

I tried removing the "}" but still get the score and a comma after it.

http://blogs.msdn.com/cfs-file.ashx/__k ... BADD76.png

If anyone could explain where the problem is it would be greatly appreciated.
B
17
S
7
G
3
Posts: 12
Reputation: 2,798

Post » Sat Mar 28, 2015 8:10 am

score = replace(score, ",", "")
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,552

Post » Sat Mar 28, 2015 12:42 pm

Lennaert, thanks for the quick response but I am still confused as to how to use your advice.

First I set the tempScore:
Set tempScore to tokenat(tempRow,1,"""&SCORECOLUMNAME&"":")

Then to set the array value:
Set value at (highScoreCount,1) to tokenat(tempScore,0,"""")

Not sure where I'd use the score=replace(score,",","")
B
17
S
7
G
3
Posts: 12
Reputation: 2,798

Post » Sat Mar 28, 2015 12:50 pm

The idea is to apply the expression replace() to remove the ","

ie

Set tempScore to replace(tokenat(tempRow,1,"""&SCORECOLUMNAME&"":"), ",", "")
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,552

Post » Sat Mar 28, 2015 1:17 pm

Thanks that did the trick!
B
17
S
7
G
3
Posts: 12
Reputation: 2,798


Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 1 guest