Author Topic: New PlatformInfo Parameter  (Read 2582 times)

Offline fjsantosb

  • Dr. Type
  • ****
  • Posts: 258
    • View Profile
    • Tip Tap Games - iPhone, iPad and iPod Touch Games
New PlatformInfo Parameter
« on: 2009-Sep-03 »
Hi all.

I was waiting impaciently for the new command Parameter of PlatformInfo 'Document', which have the ability to save files on iPhone (I need mainly to save some settings).
Its seems to work pretty well (Althought i haven't tested on real device yet, it works wells on glbasic).
But i discover while i was playing around that files creates using openfile command (and write command), beggins always with '0', ie. i have created a data file name settings.dat and glbasic creates 0settings.dat file.
I don't care so much about it, but i am a little worry if that behaviour will be change in a future (creating settings.dat without extra character), because the applications done before the change can be crash (well i can code to find new file, but player will lose his game, settings, progress etc).

Best Regards, fjsantos.
Francisco Santos Belmonte founder of Tip Tap Games.
Website: www.tiptapgames.com
Twitter: www.twitter.com/tiptapgames
Facebook: http://dld.bz/dYVd
iPhone News & Sales: www.gamesappetizer.com

Offline codegit

  • Dr. Type
  • ****
  • Posts: 270
    • View Profile
Re: New PlatformInfo Parameter
« Reply #1 on: 2009-Sep-03 »
Hi

I have tested on PC and iTouch and I dont seem to be having any problem. Here is what I did to save a high score file:

Code: (glbasic) [Select]

FILE_PATH$ = PLATFORMINFO$("DOCUMENTS")
.
.
.

ok = OPENFILE(1, FILE_PATH$+"/highscore.dat", 1)
IF (ok)
READLONG 1, highscore%
ENDIF

.
.
.
SUB GLB_ON_QUIT:
ok = OPENFILE(1, FILE_PATH$+"/highscore.dat", 0)
IF (ok)
WRITELONG 1,highscore%
CLOSEFILE 1
ENDIF

ENDSUB
« Last Edit: 2009-Sep-03 by codegit »
------------------------------------------
1 X Acer TravelMate 4270, laptop, XP PRO
1 X Dell Studio 17 laptop, Windows 7
1 X MacBook Pro 2,2 GHz Core 2 Duo, 2 GB RAM, 160 GB HDD, 9400M
2 X iTouch
1 X HTC Desire (Android 2.1)
iPad soon to be added

Offline fjsantosb

  • Dr. Type
  • ****
  • Posts: 258
    • View Profile
    • Tip Tap Games - iPhone, iPad and iPod Touch Games
Re: New PlatformInfo Parameter
« Reply #2 on: 2009-Sep-03 »
Yep its seems to work pretty well, the problem is the name of the file, anyfile i can save always is saved with character '0' ie. i save 'settings.dat', and in my hd is saved '0settings.dat'.

Best regards, fjsantos.
Francisco Santos Belmonte founder of Tip Tap Games.
Website: www.tiptapgames.com
Twitter: www.twitter.com/tiptapgames
Facebook: http://dld.bz/dYVd
iPhone News & Sales: www.gamesappetizer.com

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1645
  • Particle Hawk
    • View Profile
Re: New PlatformInfo Parameter
« Reply #3 on: 2009-Sep-04 »
Hi,

Sounds like a bug with openfile..

Does this fix it the name?

Code: (glbasic) [Select]
COPYFILE a$, "newname.bak"
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline fjsantosb

  • Dr. Type
  • ****
  • Posts: 258
    • View Profile
    • Tip Tap Games - iPhone, iPad and iPod Touch Games
Re: New PlatformInfo Parameter
« Reply #4 on: 2009-Sep-04 »
Mmmm, I tried your solution Hemlos, but doesn't work cause the problems seems to be the value of variable path.
if you write


GLOBAL path = PLATFORMINFO$("DOCUMENTS");
PRINT path, 0, 0;


You get 0, as value of variable path.

Strange...
Francisco Santos Belmonte founder of Tip Tap Games.
Website: www.tiptapgames.com
Twitter: www.twitter.com/tiptapgames
Facebook: http://dld.bz/dYVd
iPhone News & Sales: www.gamesappetizer.com

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1645
  • Particle Hawk
    • View Profile
Re: New PlatformInfo Parameter
« Reply #5 on: 2009-Sep-04 »
Well to use info$ = PLATFORMINFO$(what$) you need to have this format as a string.

Second, platform info is simply a variable reader for your devices.

The openfile command is used for making/ saving files....if it isnt doing exactly what you want with the name...then its likely a bug...if you want i can move this thread into the bug report section.


« Last Edit: 2009-Sep-04 by Hemlos »
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline fjsantosb

  • Dr. Type
  • ****
  • Posts: 258
    • View Profile
    • Tip Tap Games - iPhone, iPad and iPod Touch Games
Re: New PlatformInfo Parameter
« Reply #6 on: 2009-Sep-04 »
You are right Hemlos, my problem was that i haven't format variable as string (i am used to use string before variable name on c#).
So is not a bug, its my mistake!

All is working perfect!

So sorry!  :-[
Francisco Santos Belmonte founder of Tip Tap Games.
Website: www.tiptapgames.com
Twitter: www.twitter.com/tiptapgames
Facebook: http://dld.bz/dYVd
iPhone News & Sales: www.gamesappetizer.com

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1645
  • Particle Hawk
    • View Profile
Re: New PlatformInfo Parameter
« Reply #7 on: 2009-Sep-04 »
NP, glad i could help!  :)
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)