Author Topic: Appvariables for Highscores  (Read 13408 times)

0 Members and 1 Guest are viewing this topic.

Offline Fast Crash

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 192
  • Rating: +45/-7
  • Virus of tomorrow
    • View Profile
Re: Appvariables for Highscores
« Reply #15 on: December 18, 2010, 12:34:12 pm »
So "send me" your program ;D

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Appvariables for Highscores
« Reply #16 on: December 18, 2010, 12:35:33 pm »
So "send me" your program ;D

I already did, if you have any doubts, reply to e.mail, not here, because the code will not be public :S

Maybe one day :)

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Appvariables for Highscores
« Reply #17 on: December 18, 2010, 12:59:34 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.
« Last Edit: December 18, 2010, 12:59:58 pm by Deep Thought »




Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Appvariables for Highscores
« Reply #18 on: December 18, 2010, 01:03:27 pm »
Code: [Select]
!If GetCalc(NAME)
0→{GetCalc(NAME,SIZE)→H}
Fill(H,SIZE-1)
End

Well, I decided to make the code come public, to make this easier :S

The game is an edit of Quigibo's Axe Example, PONG:

Code: [Select]
.UPONG

"<easy>"->Str4

"SCORE:"->Str2
[6363636363633F1F]->Pic3
[FCFEC6C6FEFCC0C0C0]->Pic4
[3C7EE7C3C3E77E3C]->Pic5
[00CEDFF3E3C3C3C3]->Pic6
[3F7FC3C37F3F037FFE]->Pic7
[FF00000000000000]->Pic8


DiagnosticOff
Lbl 1
ClrDraw
ClrHome
Fix 5
.Code for image
Pt-On(25,10,Pic3   
Pt-On(34,9,Pic4   
Pt-On(34,10,Pic4+1
Pt-On(42,10,Pic5   
Pt-On(51,10,Pic6   
Pt-On(60,9,Pic7   
Pt-On(60,10,Pic7+1

Pt-On(0,19,Pic8
Pt-On(8,19,Pic8
Pt-On(16,19,Pic8
Pt-On(24,19,Pic8
Pt-On(32,19,Pic8
Pt-On(40,19,Pic8
Pt-On(48,19,Pic8
Pt-On(56,19,Pic8
Pt-On(64,19,Pic8
Pt-On(72,19,Pic8
Pt-On(80,19,Pic8
Pt-On(88,19,Pic8
Pt-On(96,19,Pic8


Text(32,21,"2nd:play
Text(35,28,Str4
Text(29,35,"clear:quit

Getcalc("appvPongHS")->H
!If H
Getcalc("appvPongHS,8)->H
For(A,0,18)
0->{H+A}
End

If sub(CS,"<easy>",Str4
Text(29,42,"Highscore:",{H}>Dec
Else
Text(29,42,"Highscore:",{H+1}>Dec
End



Fix 3
Text(0,49,"             made by: David Gomes           
Text(0,55,"                                           Quigibo                           
Fix 2

DispGraph



Repeat getKey->theta
End

If getKey(3) or getKey(19)
104->{Str4+1}
114->{Str4+3}
100->{Str4+4}
End

If getKey(2) or getKey(35)
101->{Str4+1}
115->{Str4+3}
121->{Str4+4}
End

If theta=15
Fix 4
ClrHome
ClrDraw
Return
End

.THIS IS THE START OF THE GAME CODE
If theta=54
ClrDraw
0->S-1->D
44->Z*256->X
10->Y
sub(HT)

Repeat getKey(15)

If sub(CS,"<hard>",Str4)
5->M
Else
2->M
End

.MOVE LEFT CODE
If getKey(2) or getKey(35) and (Z!=0
Z-M->Z
End

.MOVE RIGHT CODE
If getKey(3) or getKey(19) and (Z!=88
Z+M->Z
End

.RANDOM POSITION FOR BALL
X+V->X
Y+D->Y

.LOSING CODE
If Y>70
Goto D
End

.RANDOM POSITION FOR BALL WHEN HIT UPPER BARRIER
If Y=0
sub(HT)
End

.HIT IMAGE CODE
If Y=54 and (abs(X/256-Z)<8
sub(HT)
S+1->S
End
If X/256=0 or (X/256=88
~V->V+X->X
End



ClrDraw
[000000000000FFFF]->Pic1
[0000182C3C180000]->Pic2
If sub(CS,"<easy>",Str4
Line(0,0,96,0)
Line(0,0,0,64)
Line(95,0,95,63)
Line(0,63,95,63)
End
Pt-On(Z,54,Pic1
Pt-On(X/256,Y,Pic2
DispGraph

End

.LOSE LABEL
Lbl D
ClrDraw
ClrHome
Fix 5
.Code for image
Pt-On(25,25,Pic3   
Pt-On(34,24,Pic4   
Pt-On(34,25,Pic4+1
Pt-On(42,25,Pic5   
Pt-On(51,25,Pic6   
Pt-On(60,24,Pic7   
Pt-On(60,25,Pic7+1

Pt-On(0,35,Pic8
Pt-On(8,35,Pic8
Pt-On(16,35,Pic8
Pt-On(24,35,Pic8
Pt-On(32,35,Pic8
Pt-On(40,35,Pic8
Pt-On(48,35,Pic8
Pt-On(56,35,Pic8
Pt-On(64,35,Pic8
Pt-On(72,35,Pic8
Pt-On(80,35,Pic8
Pt-On(88,35,Pic8
Pt-On(96,35,Pic8


If S>9
Text(33,38,Str2,S>Dec
Else
Text(35,38,Str2,S>Dec
End


If sub(CS,"<easy>",Str4
S->{H}
End

If sub(CS,"<easy>",Str4
S->{H+1}
End







DispGraph

Pause 1500
Repeat getKey->U
End
Goto 1




.ROUTINES
Return
Lbl CS
0->r3
Repeat {r2+r3}->r4 != {r1+r3} or ({r1+r3}->r5 = 0) or (r4 = 0)
::r3+1->r3
End
If r4 or r5=0
::1
::Return
End
0
Return

Lbl HT
rand^512-256->V
~D->D

Else
Goto 1
End

Offline Fast Crash

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 192
  • Rating: +45/-7
  • Virus of tomorrow
    • View Profile
Re: Appvariables for Highscores
« Reply #19 on: December 18, 2010, 01:04:55 pm »
i sent you back the code. How do you use str4? i didn't understand it...

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Appvariables for Highscores
« Reply #20 on: December 18, 2010, 01:06:26 pm »
i sent you back the code. How do you use str4? i didn't understand it...

The code you gave me crashed the calculator and does not work. I can't evem press 2nd or clear, only right and left in the title screen.

Str4 is '<easy>' or '<hard>', and sub(CS,'<easy>',Str4  checks if the the game is easy.

Offline Fast Crash

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 192
  • Rating: +45/-7
  • Virus of tomorrow
    • View Profile
Re: Appvariables for Highscores
« Reply #21 on: December 18, 2010, 01:10:17 pm »
really? i only changed the code of the picture to make it more optimized, nothing else. Check if you made an error...

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Appvariables for Highscores
« Reply #22 on: December 18, 2010, 01:13:47 pm »
really? i only changed the code of the picture to make it more optimized, nothing else. Check if you made an error...

You did change the loop and made parentheses optimizations, I think :S

Offline Fast Crash

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 192
  • Rating: +45/-7
  • Virus of tomorrow
    • View Profile
Re: Appvariables for Highscores
« Reply #23 on: December 18, 2010, 01:15:12 pm »
yes because your code created a 8 bytes appvar when you need only 4 bytes. After that i did nothing.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Appvariables for Highscores
« Reply #24 on: December 18, 2010, 01:15:55 pm »
yes because your code created a 8 bytes appvar when you need only 4 bytes. After that i did nothing.

You also made it 2 bytes for each highscore and I only want 1 :S

Offline Fast Crash

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 192
  • Rating: +45/-7
  • Virus of tomorrow
    • View Profile
Re: Appvariables for Highscores
« Reply #25 on: December 18, 2010, 01:17:05 pm »
we cannot get a score better than 255?  :P

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Appvariables for Highscores
« Reply #26 on: December 18, 2010, 01:18:15 pm »
we cannot get a score better than 255?  :P

You can but you need to play for about 4 hours and I don't want to even make it possible

Offline Fast Crash

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 192
  • Rating: +45/-7
  • Virus of tomorrow
    • View Profile
Re: Appvariables for Highscores
« Reply #27 on: December 18, 2010, 01:20:34 pm »
ah... much people will get same score  ;D

so do
Code: [Select]
0->{H}r
instead of the loop
« Last Edit: December 18, 2010, 01:21:16 pm by Fast Crash »

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Appvariables for Highscores
« Reply #28 on: December 18, 2010, 01:21:41 pm »
ah... much people will get same score  ;D

so do
Code: [Select]
0->{H}r
instead of the loop

They won't. My problem is that it does not correctly read the appvar!! That's my problem :(


Offline Fast Crash

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 192
  • Rating: +45/-7
  • Virus of tomorrow
    • View Profile
Re: Appvariables for Highscores
« Reply #29 on: December 18, 2010, 01:23:34 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.