Author |
Topic: High Score Table (Read 690 times) |
|
Usama Amin
New Member
member is offline


Gender: 
Posts: 18
|
 |
High Score Table
« Thread started on: Nov 10th, 2012, 5:28pm » |
|
Hi Richard is it possible to store a variable which doesn't erase when BBC basic is closed e.g. for a high score leader board and can a high score table be created in BBC basic?
|
|
Logged
|
|
|
|
admin
Administrator
member is offline


Posts: 1145
|
 |
Re: High Score Table
« Reply #1 on: Nov 10th, 2012, 10:07pm » |
|
on Nov 10th, 2012, 5:28pm, Usama Amin wrote:Hi Richard is it possible to store a variable which doesn't erase when BBC basic is closed? |
|
The usual method would be to store the value either in the Windows Registry or in an INI file (or indeed in any kind of data file). For the use of INI files see this Wiki article:
http://bb4w.wikispaces.com/Reading+and+writing+.INI+data+files
Of course a disadvantage of storing a High Score Table as 'plain text' in the Registry or an INI file is that it would be easy for somebody to edit it to give themselves a very high score! Therefore in that case you may want to encrypt the data before storing it.
Richard.
|
« Last Edit: Nov 10th, 2012, 10:12pm by admin » |
Logged
|
|
|
|
Usama Amin
New Member
member is offline


Gender: 
Posts: 18
|
 |
Re: High Score Table
« Reply #2 on: Nov 11th, 2012, 09:37am » |
|
Ok thanks how would one go about encrypting an .ini file?
|
|
Logged
|
|
|
|
admin
Administrator
member is offline


Posts: 1145
|
 |
Re: High Score Table
« Reply #3 on: Nov 11th, 2012, 9:33pm » |
|
on Nov 11th, 2012, 09:37am, Usama Amin wrote:Ok thanks how would one go about encrypting an .ini file? |
|
You could use any kind of encryption that you consider to be adequately secure, I have no specific suggestions. You could try asking other games writers what they have used (but for obvious reasons they might not want to reveal too much detail!).
If the encryption produces an output that still looks like 'text' you can store it in the INI file like any regular string. If the encryption creates 'binary' data you can store it in the INI file using WritePrivateProfileStruct.
Richard.
|
|
Logged
|
|
|
|
Usama Amin
New Member
member is offline


Gender: 
Posts: 18
|
 |
Re: High Score Table
« Reply #4 on: Nov 12th, 2012, 7:27pm » |
|
Thanks I just multiplied it by a really large number when writing to the ini file and divided by the same number when reading worked well enough  Thanks for the help Richard
|
|
Logged
|
|
|
|
admin
Administrator
member is offline


Posts: 1145
|
 |
Re: High Score Table
« Reply #5 on: Nov 13th, 2012, 08:04am » |
|
on Nov 12th, 2012, 7:27pm, Usama Amin wrote:I just multiplied it by a really large number when writing to the ini file and divided by the same number when reading worked well enough |
|
Works well enough until somebody playing your game reads this forum..... 
Richard.
|
|
Logged
|
|
|
|
Usama Amin
New Member
member is offline


Gender: 
Posts: 18
|
 |
Re: High Score Table
« Reply #6 on: Nov 13th, 2012, 08:34am » |
|
Haha
|
|
Logged
|
|
|
|
|