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

JOHN PATTEN johnpatten at me.com
Mon Aug 4 04:36:12 CEST 2014


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 <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



More information about the use-livecode mailing list