Re: Missing digits when replacing single digit item with two digit item?
Hi John, instead of decimals use true hex (has 15 digits) OR, very effective, dadaNumbers (my youngest daughter named this) you may use e.g. n=48 or n=65 function dec2dada dc,n return numToByte(n+dc) end dec2dada function dada2dec hx,n return byteToNum(hx)-n end dada2dec ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Missing digits when replacing single digit item with two digit item?
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 PATTENjohnpat...@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,jpat...@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,jpat...@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@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@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@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Missing digits when replacing single digit item with two digit item?
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 johnpat...@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,jpat...@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,jpat...@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@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@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Missing digits when replacing single digit item with two digit item?
And here is the button script to move the player’s game piece: on mouseUp put cd fld username of cd 1 into tTargetPlayer put the loc of cd btn tTargetPlayer into tTargetPlayerLoc put 1 into x repeat 15 put the id of cd button ( Button x ) return after GameSpots add 1 to x end repeat put 1 into x repeat for number of lines in GameSpots if the loc of btn id (line x of GameSpots) is tTargetPlayerLoc then put the short name of button id (line x of GameSpots) into tLabels end if add 1 to x end repeat put char 1 to 2 of word 2 of tLabels into tCurrentSpot put tCurrentSpot + (cd fld DiceRoll) into tButton if tButton 15 then put 1 into tButton move cd button tTargetPlayer to the loc of cd button (Button tButton) put urlEncode(tTargetPlayer) into tUsername put urlEncode(Button tButton) into tButtonSpot put username= tUsername ButtonSpot= tButtonSpot into tArgList post tArgList to URL http://jpatten.on-rev.com/superdupergame/moveplayer.lc; put it --into tData else move cd button tTargetPlayer to the loc of cd button (Button tButton) put urlEncode(tTargetPlayer) into tUsername put urlEncode(Button tButton) into tButtonSpot put username= tUsername ButtonSpot= tButtonSpot into tArgList post tArgList to URL http://jpatten.on-rev.com/superdupergame/moveplayer.lc; put it --into tData end if end mouseUp On Aug 3, 2014, at 7:32 PM, JOHN PATTEN johnpat...@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,jpat...@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,jpat...@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@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@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode