Missing digits when replacing single digit item with two digit item?

Brahmanathswami brahma at hindu.org
Mon Aug 4 02:57:10 EDT 2014


John:

I've had gremlins like this in the past where certain functions run 
before the "interior" expression.

Or put another way: what is inside parentheses is not always evaluated 
as expected when running inside a function request.  I have never been 
able to determine a recipe, but my solution is always the same: build 
the variable first *then* run it into your function:

This could be creating wrong results (I lost your email with the button 
script

put urlEncode ("Button" && tBotton) into tCurrentLocation

Try this instead (two lines instead of 1)

put ("Button" && tBotton) into tCurrentLocation
put urlEncode(tCurrentLocation) into tUploadLatestPosition

Why not must post a number?  You don't really need "Button 12"  all you 
need is "12"


Swasti Astu, Be Well!
Brahmanathaswami

Kauai's Hindu Monastery
www.HimalayanAcademy.com



JOHN PATTEN wrote:
> Here’s the server script:
>
> <?lc
>
> put $_POST["username"] into tUsername
> put $_POST["ButtonSpot"] into tButtonSpot
> put url("file:users.txt") into tUsersFile
>
> repeat for each line tLine in tUsersFile
> if item 1 of tLine is tUserName then
> put tButtonSpot into item 4 of tLine
> --when it gets to spot 10 it is no allowing the 1s spot only the 10s spot, so button "Button 10" shows up as "Button 1," button 11, as Button 1 and so on...
> put tLine into tLine
> --put return&  tLine after tUsersFile
> --sort tUsersFile
> --put tLine
> put tUsersFile
> end if
> end repeat
>
> --else
>
> --put tUsersFile
> --end if
> --end repeat
> --put tUsersFile
>
> --open file "users.txt" for write
> --write tUsersFile to file "users.txt"
> --close file "users.txt"
> --put "Moving on!"
>
> ?>
> On Aug 3, 2014, at 7:32 PM, JOHN PATTEN<johnpatten at me.com>  wrote:
>
>> Hello!
>>
>> I have 15 buttons on a card. They are each named Button 1, Button 2, Button 3, etc. I have another button that I am using as a game piece. It moves around the digital game board to the loc of each of the other 15 buttons. I am attempting to save the players information into a single line, in a text file, on the server. I’m using LC Server to manage the text file. Each line on the the text field holds the username, password, emailaddress, and player’s game piece button location. So a line in the text file would appear as: jpatten,password,jpatten at bmail.com,Button 2
>>
>> My player piece moves across the digital game board from button loc to button loc, across 15 spots (button locs.) The LS Server writes the current players location by putting the name of the button it is over. So if the player is currently at Button 2, rolls a 3, their player moves to the loc of Button 5 and server writes Button 5 into the last item of the text entry for that player. So that players entry into text file becomes: jpatten,password,jpatten at bmail.com,Button 5.
>>
>> The problem is when I get to buttons (game board spots) 10-15. I can tell by examining the code that it is exchanging, say Button 9 for Button 12 in a move of 3, but when it puts Button 12 in for item 4 it only writes  “Button 1,” leaving out the 2 in twelve. If I go around the board, to single digits, the code works again.
>>
>> It is only when I replace the last item with a two digit number that it fails. It’s as if it won’t allow the replacement of the single digit last item, Button 9, with a two digit item, Button 12. It lops off the 2.
>>
>> Does anybody have an idea of what could be going wrong? I will put my server code in a reply to this email, otherwise I will be put into “long message limbo” if I paste it to the bottom of this message.
>>
>> Thank you!
>>
>> John Patten
>> SUSD
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list