how to save the game score on close card

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

ahmedinvent24BUSGdU9
Posts: 43
Joined: Mon Oct 15, 2012 6:44 pm

Re: how to save the game score on close card

Post by ahmedinvent24BUSGdU9 » Tue Dec 25, 2012 1:28 pm

Hi, Simon
i wrote that code to read a text and it works
but in graphic or image it doesn't work

please how can i let it works with an image

Code: Select all

on saveTaskList
   put specialFolderPath("documents") & "/ahmed.txt" into tFilePath
   put field "name" of this stack into url ("file:" & tFilePath) 
end saveTaskList

on readTaskList
   put specialFolderPath("documents") & "/ahmed.txt" into tFilePath
   set the cText of this stack to url ("file:" & tFilePath)
   put the cText of this stack into field "name" 
end readTaskList

on preOpenCard
   readTaskList
end preOpenCard

Thierry
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 875
Joined: Wed Nov 22, 2006 3:42 pm

Re: how to save the game score on close card

Post by Thierry » Tue Dec 25, 2012 2:39 pm

ahmedinvent24BUSGdU9 wrote:
i wrote that code to read a text and it works
but in graphic or image it doesn't work

Code: Select all

   put field "name" of this stack into url ("file:" & tFilePath) 
Hi,

Instead of "file:", use "binfile:" for any binary files.

HTH

Thierry
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: how to save the game score on close card

Post by Simon » Tue Dec 25, 2012 6:17 pm

Hi Ahmed,
I have some questions for you.
What is actually stored in cText?
Did you personally purchase LC?
Did you personally install the Android SDK? If not you then who?

Good start on writing and reading a file! But I think that only your name is stored in ahmed.txt, nothing about "levels passed".
From the code you have provided I see no attempt at manipulating graphics. How is hiding/un-hiding graphics supposed to work if there is no code?
The second part of my previous answer gives you the code for displaying the graphics but I do not see any attempt on your part to implement it.
I'll give you a hint for adding levels to your text file, from your puzzle_sample:

Code: Select all

on mouseUp
   move graphic "ln" to the points of graphic "ln1"
   wait 0.2 sec 
   answer "Complete" with "OK" --Now would be a good time!
   wait 0.1 sec
   go card 1 show graphic "fin1"
end mouseUp
Please stop replying with general
... it doesn't work
Show me the code that doesn't work and I'll help you.
I tell you what, I asked you in my previous post to look up a few things in the dictionary. Please list them with a one line explanation of what they do and I'll give you another hint.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Post Reply