Are you excited?
Yes!
 80%  [ 21 ]
No.
 3%  [ 1 ]
I don't care.
 15%  [ 4 ]
Total Votes : 26

I'm kind of embarrassed to be asking this, but can anyone optimize/find a better way of doing this? The goal of this code is to create a menu based on the ownership status of cars. When one is selected, the program will have to know which one. The 0s and 1s relate to the ownership status of cars. Variables starting with CARIDEN relate to the unique identification number that each car has, and variables starting with CARNAM relate to the name of each car. Like I said, I'm not at all happy with this code, but with the time constraints of this contest, the fact is, if I don't ask for help I'll never get done in time. So, here's the code. If anyone can help, it would be much appreciated. Thanks.


Code:
SELECT
det(9,1)
1→CONDA
maxYSLCTDATA
minY1,1,"00"→CHECKG
det(0)
det(20,255)
det(21,0)
det(22,255)
det(75,93)
det(18,CARNAMA,5,22)
det(18,CARNAMB,5,32)
det(18,CARNAMC,5,42)
det(18,CARNAMD,5,52)
det(18,CARNAME,5,62)
det(18,CARNAMF,5,72)
det(18,CARNAMG,5,82)
det(18,CARNAMH,5,92)
det(18,CARNAMI,5,102)
det(18,CARNAMJ,5,112)
det(18,CARNAMK,5,122)
det(18,CARNAML,5,132)
det(18,CARNAMM,5,142)
det(18,CARNAMN,5,152)
det(18,CARNAMO,5,162)
det(18,CARNAMP,5,172)
det(18,CARNAMQ,5,182)
det(18,CARNAMR,5,192)
det(18,CARNAMS,5,202)
det(18,CARNAMT,5,212)
det(11,1)
minY100,10→BACKG
2→X
20→Y
det(63,CHECKG,X,Y,100,10)
det(61,BACKG,200,70)
det(20,0)
det(21,255)
det(22,0)
det(11,1)
Repeat getKey(9)
det(57,BACKG,X,Y)
If getKey(1)
Y+10→Y
Pause 150
End
If getKey(4)
Y-10→Y
Pause 150
End
If Y>NUMBCARS*10+20
Y-20→Y
End
If Y<20
20→Y
End
det(61,BACKG,X,Y)
det(63,CHECKG,X,Y,100,10)
If Y=20
CARNAMA→CARNAMTEMP
CARIDENA→CARIDENTEMP
End
If Y=30
CARNAMB→CARNAMTEMP
CARIDENB→CARIDENTEMP
End
If Y=40
CARNAMC→CARNAMTEMP
CARIDENC→CARIDENTEMP
End
If Y=50
CARNAMD→CARNAMTEMP
CARIDEND→CARIDENTEMP
End
If Y=60
CARNAME→CARNAMTEMP
CARIDENE→CARIDENTEMP
End
If Y=70
CARNAMF→CARNAMTEMP
CARIDENF→CARIDENTEMP
End
If Y=80
CARNAMG→CARNAMTEMP
CARIDENG→CARIDENTEMP
End
If Y=90
CARNAMH→CARNAMTEMP
CARIDENH→CARIDENTEMP
End
If Y=100
CARNAMI→CARNAMTEMP
CARIDENI→CARIDENTEMP
End
If Y=110
CARNAMJ→CARNAMTEMP
CARIDENJ→CARIDENTEMP
End
If Y=120
CARNAMK→CARNAMTEMP
CARIDENK→CARIDENTEMP
End
If Y=130
CARNAML→CARNAMTEMP
CARIDENL→CARIDENTEMP
End
If Y=140
CARNAMM→CARNAMTEMP
CARIDENM→CARIDENTEMP
End
If Y=150
CARNAMN→CARNAMTEMP
CARIDENN→CARIDENTEMP
End
If Y=160
CARNAMO→CARNAMTEMP
CARIDENO→CARIDENTEMP
End
If Y=170
CARNAMP→CARNAMTEMP
CARIDENP→CARIDENTEMP
End
If Y=180
CARNAMQ→CARNAMTEMP
CARIDENQ→CARIDENTEMP
End
If Y=190
CARNAMR→CARNAMTEMP
CARIDENR→CARIDENTEMP
End
If Y=200
CARNAMS→CARNAMTEMP
CARIDENS→CARIDENTEMP
End
If Y=210
CARNAMT→CARNAMTEMP
CARIDENT→CARIDENTEMP
End
det(18,CARNAMTEMP,5,Y+2)
det(11,1)
End
Lbl SLCTDATA
0→XSTEP
0→ZORCAEON
1→FERBERLIN
0→MAZDARATI
1→ZONDAVICIC
5→Y
Σy²20→CARNAMA
Σy²20→CARNAMB
Σy²20→CARNAMC
Σy²20→CARNAMD
Σy²20→CARNAME
Σy²20→CARNAMF
Σy²20→CARNAMG
Σy²20→CARNAMH
Σy²20→CARNAMI
Σy²20→CARNAMJ
Σy²20→CARNAMK
Σy²20→CARNAML
Σy²20→CARNAMM
Σy²20→CARNAMN
Σy²20→CARNAMO
Σy²20→CARNAMP
Σy²20→CARNAMQ
Σy²20→CARNAMR
Σy²20→CARNAMS
Σy²20→CARNAMT
Σy²20→CARNAMU
Σy²20→CARNAMV
Σy²20→CARNAMW
Σy²20→CARNAMX
Σy²20→CARNAMY
Σy²20→CARNAMZ
Σy²20→CARNAMTEMP


Repeat XSTEP=25
If ZORCAEON=CONDA and XSTEP=0
NUMBCARS+1→NUMBCARS
"Zorca Eon"→CARNAMTEMP
1→CARIDEN
End
If FERBERLIN=CONDA and XSTEP=1
NUMBCARS+1→NUMBCARS
"Ferrotti Berlinera"→CARNAMTEMP
2→CARIDEN
End
If MAZDARATI=CONDA and XSTEP=2
NUMBCARS+1→NUMBCARS
"Mazda Rati"→CARNAMTEMP
3→CARIDEN
End
If ZONDAVICIC=CONDA and XSTEP=3
NUMBCARS+1→NUMBCARS
"Zonda Vicic"→CARNAMTEMP
4→CARIDEN
End
If NISSACITY=CONDA and XSTEP=4
NUMBCARS+1→NUMBCARS
"Nissa Cityscape"→CARNAMTEMP
5→CARIDEN
End
If LAGANEHUERA=CONDA and XSTEP=5
NUMBCARS+1→NUMBCARS
"Lagane Huera"→CARNAMTEMP
6→CARIDEN
End
If ZORCACAYAN=CONDA and XSTEP=6
NUMBCARS+1→NUMBCARS
"Zorca Cayan"→CARNAMTEMP
7→CARIDEN
End
If ZORCANOT=CONDA and XSTEP=7
NUMBCARS+1→NUMBCARS
"Zorca 912"→CARNAMTEMP
8→CARIDEN
End
If MAZDAXR=CONDA and XSTEP=8
NUMBCARS+1→NUMBCARS
"Mazda X7R"→CARNAMTEMP
9→CARIDEN
End
If BIMMERM=CONDA and XSTEP=9
NUMBCARS+1→NUMBCARS
"Bimmer 3M"→CARNAMTEMP
10→CARIDEN
End
If DOMVIPPER=CONDA and XSTEP=10
NUMBCARS+1→NUMBCARS
"Dom Vipper"→CARNAMTEMP
11→CARIDEN
End
If OTTIRS=CONDA and XSTEP=11
NUMBCARS+1→NUMBCARS
"Otti RS5"→CARNAMTEMP
12→CARIDEN
End
If OTTITT=CONDA and XSTEP=12
NUMBCARS+1→NUMBCARS
"Otti TT"→CARNAMTEMP
13→CARIDEN
End
If VOLVERTF=CONDA and XSTEP=13
NUMBCARS+1→NUMBCARS
"Volver 420"→CARNAMTEMP
14→CARIDEN
End
If DELARO=CONDA and XSTEP=14
NUMBCARS+1→NUMBCARS
"DeLaro"→CARNAMTEMP
15→CARIDEN
End
If ZONDANS=CONDA and XSTEP=15
NUMBCARS+1→NUMBCARS
"Zonda NS"→CARNAMTEMP
16→CARIDEN
End
If MERCSLA=CONDA and XSTEP=16
NUMBCARS+1→NUMBCARS
"Merc SL₆00"→CARNAMTEMP
17→CARIDEN
End
If MERCSLB=CONDA and XSTEP=17
NUMBCARS+1→NUMBCARS
"Merc SL₆5 MAG"→CARNAMTEMP
18→CARIDEN
End
If MITGTO=CONDA and XSTEP=18
NUMBCARS+1→NUMBCARS
"Mitzer GTO"→CARNAMTEMP
19→CARIDEN
End
If MITRAJ=CONDA and XSTEP=19
NUMBCARS+1→NUMBCARS
"Mitzer Raja"→CARNAMTEMP
20→CARIDEN
End
If NISSAVX=CONDA and XSTEP=20
NUMBCARS+1→NUMBCARS
"Nissa 300VX"→CARNAMTEMP
21→CARIDEN
End
If OPELSPEE=CONDA and XSTEP=21
NUMBCARS+1→NUMBCARS
"Opel Speeder"→CARNAMTEMP
22→CARIDEN
End
If LAROP=CONDA and XSTEP=22
NUMBCARS+1→NUMBCARS
"Laro P2"→CARNAMTEMP
23→CARIDEN
End
If FERROLE=CONDA and XSTEP=23
NUMBCARS+1→NUMBCARS
"Ferrotti LeFerrotti"→CARNAMTEMP
24→CARIDEN
End
If CUSTOMA=CONDA and XSTEP=24
NUMBCARS+1→NUMBCARS
"Custom 1"→CARNAMTEMP
25→CARIDEN
End
If CUSTOMB=CONDA and XSTEP=25
NUMBCARS+1→NUMBCARS
"Custom 2"→CARNAMTEMP
26→CARIDEN
End
XSTEP+1→XSTEP
If NUMBCARS=1
CARIDEN→CARIDENA
CARNAMTEMP→CARNAMA
End
If NUMBCARS=2
CARIDEN→CARIDENB
CARNAMTEMP→CARNAMB
End
If NUMBCARS=3
CARIDEN→CARIDENC
CARNAMTEMP→CARNAMC
End
If NUMBCARS=4
CARIDEN→CARIDEND
CARNAMTEMP→CARNAMD
End
If NUMBCARS=6
CARIDEN→CARIDENF
CARNAMTEMP→CARNAMF
End
If NUMBCARS=7
CARIDEN→CARIDENG
CARNAMTEMP→CARNAMG
End
If NUMBCARS=8
CARIDEN→CARIDENH
CARNAMTEMP→CARNAMH
End
If NUMBCARS=9
CARIDEN→CARIDENI
CARNAMTEMP→CARNAMI
End
If NUMBCARS=10
CARIDEN→CARIDENJ
CARNAMTEMP→CARNAMJ
End
If NUMBCARS=11
CARIDEN→CARIDENK
CARNAMTEMP→CARNAMK
End
If NUMBCARS=12
CARIDEN→CARIDENL
CARNAMTEMP→CARNAML
End
If NUMBCARS=13
CARIDEN→CARIDENM
CARNAMTEMP→CARNAMM
End
If NUMBCARS=14
CARIDEN→CARIDENN
CARNAMTEMP→CARNAMN
End
If NUMBCARS=15
CARIDEN→CARIDENO
CARNAMTEMP→CARNAMO
End
If NUMBCARS=16
CARIDEN→CARIDENP
CARNAMTEMP→CARNAMP
End
If NUMBCARS=17
CARIDEN→CARIDENQ
CARNAMTEMP→CARNAMQ
End
If NUMBCARS=18
CARIDEN→CARIDENR
CARNAMTEMP→CARNAMR
End
If NUMBCARS=19
CARIDEN→CARIDENS
CARNAMTEMP→CARNAMS
End
If NUMBCARS=20
CARIDEN→CARIDENT
CARNAMTEMP→CARNAMT
End
If NUMBCARS=21
CARIDEN→CARIDENU
CARNAMTEMP→CARNAMU
End
If NUMBCARS=22
CARIDEN→CARIDENV
CARNAMTEMP→CARNAMV
End
If NUMBCARS=23
CARIDEN→CARIDENW
CARNAMTEMP→CARNAMW
End
If NUMBCARS=24
CARIDEN→CARIDENX
CARNAMTEMP→CARNAMX
End
If NUMBCARS=25
CARIDEN→CARIDENY
CARNAMTEMP→CARNAMY
End
If NUMBCARS=26
CARIDEN→CARIDENZ
CARNAMTEMP→CARNAMZ
End
End
Return
Pause
det(1)

Alright! I think I have another idea for this (unfortunately, it will only allow for 5 slots in your garage).
Anyway, though, it will take up a lot less space and hopefully make the program run at its best as well.
I'm already slightly behind, but I think that the garage and dealership shouldn't (hopefully) take that much longer to complete. Here's the rest of the game plan.

3/9- Finish garage and dealership (includes converting all cars to ICE format and some work on the custom car stuff)
3/15- Finish all of the quick race mode.
3/18- Finish career mode.
3/24- Achievements, statistics, and settings.
3/31- General polish and bug fixes to prepare the program for release.
Feedback?






Don't worry, I haven't just spent the last couple days messing about with a menu. All of the car stats (when you buy them Wink ) and prices have been figured out as well. More to come soon. BTW, sorry images are a bit big.
You should show the numbers in bar graphs rather than text. Smile (Or both!)

Looking good!
Can we see all the car sprites? Very Happy

How big is it?
Alright, I will implement the bar graphs soon if I have time.

And Justin, the car sprites aren't done yet, but when they are (and people want to see them), I'll be sure to post some.
In the car selection scene the sprite of the selected car should be drawn on the right side of the screen.

(Disclaimer: I drew this with a mouse)
Hmm I'll think about it. Disclaimer- the cars won't be 3D (it'll be a side view like Pixel Car Racer).
Hey, I've got a question. Can someone help me out with saving/loading data? I've tried a lot of things, from lists to appvars to allocated data, but nothing seems to be working right. I want to have the program read the data previously stored at the start (but not if the data does not exist yet) and then overwrite the previous data to be read at the next running of the program. Any help would be appreciated and thanks in advance.
Btw @slimeenergy, that would be very easy to implement, since it uses almost exactly the same principle that has the icon on the right chance in the main menu change as you scroll. However, the sprites will all be about 100 x 30, so I'm not sure if there'll be enough space to fit the picture in neatly, especially if it corresponds with a longer car name. Like I said, though, I really like this idea and will probably end up experimenting with it at some point.
Update-

Program is now storing the following in an appvar and accessing it properly:
-performance data for all five garage slots
-current cash
-current EXP
-car last viewed in dealership

So, time to get to work on the garage menus.

EDIT- Currently working on fixing a massive glitch, but I think I have found the issue.
EDIT 2- Seems like the problem is due to there not being enough memory to perform the calculations. Does anyone have any insight on the cause/ solution of this? Thanks.
EDIT 3- Might move sprite data to an appvar, because it’s taking up a lot of space.
Can someone help me out (again)?
I'm trying to read sprite data from an appvar in order to save space and stop the RAM on calc from resetting when I run the program. Unfortunately, it is not displaying properly. Any idea why?

Here is the appvar code.

Code:
1E14000000000000000000000000000000000000000000000000FFFFFFFFFFFF0000000000000000000000000000000000000000000000000000FFFFFFFF000000000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000FFFF000000000000000000000000000000000000000000000000000000FFFFFF0000000000000000000000000000000000000000000000000000FFFFFFFF000000000000000000000000000000000000000000000000FFFFFFFFFFFF

Where 1E and 14 are the sprite width and height. I've tried 30 and 20 instead, but that didn't work either. Here is the code to display the sprite (which is supposed to be a letter D).


Code:
Alloc(602→LETTERS
sum(1,"LETTERS","r"→B
sum(5,LETTERS,602,1,B)
det(58,LETTERS,72,15)
Pause


Like I said, any help would be appreciated. Please submit your replies directly in this thread if you can help, and thanks in advance.
wut. First of all, why are you copying the sprite data to a buffer, it's already in the appvar.

Second, you didn't call CloseAll before attempting to open.
Alright. So would something like this work better?

Code:

sum(0)
sum(1,"LETTERS","r"->B
sum(18,B->LETTER
det(58,LETTER,5,5)
Pause


And BTW, in the last code I did use CloseAll(), but forgot to copy that part.
Yes that would work a lot better Smile
Nice. And does the appvar format look alright? Should I use hex to define the width and height, or decimal?
epsilon5 wrote:
Nice. And does the appvar format look alright? Should I use hex to define the width and height, or decimal?

You should be using convpng.
Oh. I'll do that then. Time to make the menu sprites again (not too hard, just took a few hours last time).

EDIT- And should I use Seek( to change the offset, or is there a better way? Because there will be more than just one sprite in the appvar, clearly.
Hmm. I did what you said, but this happened. What could be going wrong? One suspicious thing is that the appvar created by convPNG was only 76 bytes. Any suspicions?

  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 2 of 4
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement