Author Topic: Appvariables for Highscores  (Read 12988 times)

0 Members and 2 Guests are viewing this topic.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Appvariables for Highscores
« Reply #30 on: December 18, 2010, 01:24:39 pm »
I don't see why, you just have do do {H} and {H+1}

check if that's not an other part of your game who fails.

It isn't, actually, I am letting 2 bytes in my code and it works fine, it will not be like that in the final version, though :/

Offline Fast Crash

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 192
  • Rating: +45/-7
  • Virus of tomorrow
    • View Profile
Re: Appvariables for Highscores
« Reply #31 on: December 18, 2010, 01:29:42 pm »
make some others little programs to test the appvar or other things, because if you run the entire program each times you'll never see where the problem(s) comes from.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Appvariables for Highscores
« Reply #32 on: December 18, 2010, 01:37:48 pm »
I may also check the code of other Axe games :)

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Appvariables for Highscores
« Reply #33 on: December 18, 2010, 02:12:43 pm »
I'm playing civilization V so it will be later  :D

Hum... OK.

It didn't work, the appvar is created, but the HS is always 0, both for easy and hard.

Code: [Select]
!If GetCalc(NAME)→H
Fill(0→{GetCalc(NAME,SIZE)→H},SIZE-1)
End

I gotta try that too :)

Runner always optimizing :D

That leaves the pointer in the Fill( statement at zero, so you're basically copying size-1 bytes starting at address $0000, instead of the address of your appvar, which is definitely not what you want.

Try
Code: [Select]
!If GetCalc(NAME)
0→{GetCalc(NAME,SIZE)→H}
Fill(H,SIZE-1)
End
instead.

Storing the value to a static pointer would return 0, but storing it to a variable pointer returns the pointer. For example, whereas 0→{Str1} would return 0, 0→{A} would return A.

EDIT: And just a side note, storing a two-byte value to a variable pointer, like 0→{A}r, would return A+1.
« Last Edit: December 18, 2010, 02:14:47 pm by Runer112 »

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Appvariables for Highscores
« Reply #34 on: December 18, 2010, 03:11:18 pm »
I'm playing civilization V so it will be later  :D
Starcraft II!!! :love: J/k

Welcome on the forums. ;D

Offline Fast Crash

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 192
  • Rating: +45/-7
  • Virus of tomorrow
    • View Profile
Re: Appvariables for Highscores
« Reply #35 on: December 19, 2010, 06:00:05 am »
Merci, et tu peut me parler français tu sais  :P

Scout David, can you "send me" the 8xp? I could work on your program easely because i could test it.
« Last Edit: December 19, 2010, 06:01:06 am by Fast Crash »

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Appvariables for Highscores
« Reply #36 on: December 19, 2010, 06:49:43 am »
Je parle français aussi, pas de problème, mais dans ce forum nous devons parler anglais, parce que il ya des forums pour le français dans Omnimaga.

Anyways, I was given this code, looks really code:

Quote from: ScoutDavid
Quote from: shmibs
here is a good was to deal with highscore appvars:

place this at the beginning of your program:
Code: [Select]
:"appvNAME"→Str1
:GetCalc(Str1)→θ
:!If θ
:UnarchiveStr1
:GetCalc(Str1)→θEnd
:!If θ
:GetCalc(Str1,[desired size])→θEND

this first checks to see if appvNAME exists in RAM. if not, it attempts to unarchive appvNAME. if it is not found in the archive, the appv is created and made [desired size] bytes long. the pointer to the beginning of appvNAME is stored in theta, so accessing/storing is as easy as {θ+[n]} or S→{θ+[n]}

at the end of your program simply add
:Archive Str1
for safe-keeping

I gotta try that too!! Oh my god, it looks good, thank you!

At cemetech, i'll try it right away!

Offline Fast Crash

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 192
  • Rating: +45/-7
  • Virus of tomorrow
    • View Profile
Re: Appvariables for Highscores
« Reply #37 on: December 19, 2010, 07:57:34 am »
yea, that's easy.
You can directly let at the beginning of the program :
Code: [Select]
Unarchive str1
Getcalc(Str1)->H
Ect...

if the appvar doesn't exist, it will do nothing.

« Last Edit: December 19, 2010, 08:04:47 am by Fast Crash »

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Appvariables for Highscores
« Reply #38 on: December 19, 2010, 11:23:34 am »
yea, that's easy.
You can directly let at the beginning of the program :
Code: [Select]
Unarchive str1
Getcalc(Str1)->H
Ect...

if the appvar doesn't exist, it will do nothing.



Nice optimization!

To display it, how would I do?

Code: [Select]
{H}->B
Text(0,0,B

or

Code: [Select]
Text(0,0,{H}

Offline Fast Crash

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 192
  • Rating: +45/-7
  • Virus of tomorrow
    • View Profile
Re: Appvariables for Highscores
« Reply #39 on: December 19, 2010, 11:46:13 am »
the second, more optimized. Don't forget the >Dec  :)

If you send me the 8xp i could work on it and make many optimizations  :D

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Appvariables for Highscores
« Reply #40 on: December 19, 2010, 11:48:29 am »
Yeah it's best to use English in the english forum, so people who only know english can understand. In the French section it's best to only use french too if possible. We can translate our posts but then it takes a while. X.x

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Appvariables for Highscores
« Reply #41 on: December 19, 2010, 01:51:08 pm »
the second, more optimized. Don't forget the >Dec  :)

If you send me the 8xp i could work on it and make many optimizations  :D

Don't worry with optimizations, i've got it handled xD

Also, thanks for remembering me to put the >Dec, i always forget that stuff :s

Offline Fast Crash

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 192
  • Rating: +45/-7
  • Virus of tomorrow
    • View Profile
Re: Appvariables for Highscores
« Reply #42 on: December 19, 2010, 02:32:20 pm »
I don't think you saw all optimizations. I saw many others that i could do but i would have to test it to see if it works.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Appvariables for Highscores
« Reply #43 on: December 19, 2010, 03:03:09 pm »
I don't think you saw all optimizations. I saw many others that i could do but i would have to test it to see if it works.

Fast Crash, after I finish my program maybe you can, trust me I know a lot of optimizations xD

Offline Fast Crash

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 192
  • Rating: +45/-7
  • Virus of tomorrow
    • View Profile
Re: Appvariables for Highscores
« Reply #44 on: December 20, 2010, 04:03:51 am »
lol i hope that  :)

It's just that some parts of your program are very hard when it can be simple, just like for the string "easy" and "hard".