I've been working on making a clock fro Doors CS that self edits the Icon when ran to display the current hour in twelve-hour time. So far, the project is almost done, but I ran into two weird bugs that I wondered if anyone would know how to fix. The first one happens every time the program is run and results in a Syntax error at a spot where there is clearly no syntax issue. The second is that when I use the linewrite function from the Celtic-DCSB libs, It just inserts a new line rather than writing over the line I selected (it could be I am just using the command improperly, please let me know if that is the issue). Here is the code: (Note that the header is formatted to DCS6 for a 16x16 Icon)
SourceCoder 3 (CLOCK) wrote:
::DCS6
:"0000000000000000000000000000000000000000000000000000000000000000" //The Icon defaults to nothing
::
:getTmFmt
:Ans->theta
:setTmFmt(24
:getTime
:Ans(1)->T
:
:If T=1 or T=13
:"00007E786618661866186618661866187E7E"->Str1
:
:If T=2 or T=14
:"00007E7E660666066606667E666066607E7E"->Str1
:
:If T=3 or T=15
:"00007E7E66066606663E6606660666067E7E"->Str1
:
:If T=4 or T=16
:"00007E7E66606660667E6606660666067E7E"->Str1
:
:If T=5 or T=17
:"00007E7E66606660667E6606660666067E7E"->Str1
:
:If T=6 or T=18
:"00007E7E66606660667E6666666666667E7E"->Str1
:
:If T=7 or T=19
:"00007E7E660666066606660C660C660C7E0C"->Str1
:
:If T=8 or T=20
:"00007E7E66666666667E6666666666667E7E"->Str1
:
:If T=9 or T=21
:"00007E7E66666666667E6606660666067E7E"->Str1
:
:If T=10 or T=22
:"0000787E1866186618661866186618667E7E"->Str1
:
:If T=11 or T=23
:"00007E786618661866186618661866187E7E"->Str1
:
:If T=12 or T=0
:"00007E7E660666066606667E666066607E7E"->Str1
:
:If T<=12:Then
: "00000C8812D81EA8128812880000"->Str2 //First added the Hour, then AM or PM
: Str1+Str2->Str1
:End
:
:If T>=13:Then //Here is where the Syntax Error appears at
: "00001C8812D81CA8108810880000"->Str2
: Str1+Str2->Str1
:End
:
:det(6,"CLOCK",Str1,2
:det(7,"CLOCK",3
:
:setTmFmt(theta
:DelVar TDelVar thetaDelVar Str1DelVar Str2
You need to use

Code:
det(8,"CLOCK",Str1,2


Instead of


Code:
det(6,"CLOCK",Str1,2


det(8 replaces a line of code while det(6 writes a line of code. Note for det(6 that if there are lines of code below it, it doesn't replace the pre-existing line, rather it inserts the new line of code before it.

EDIT: Found your syntax error. There's a space before the lines of code.
Thanks for the help! Screenshot of progress so far:

The default icon for the program is blank when you first send it.

Edit: DCS Clock is now in the archives! Download it here!
Thanks TIny_Hacker. This looks really amazing! I'll let you know what I think about.
(Warning though: I already have pretty high expectations.) Very Happy
jsTIfied like to make gif look funny xD
BioHazard wrote:
jsTIfied like to make gif look funny xD

Yeah. Laughing
It looks like the GIF is missing a few pixels.
RoccoLox Programs wrote:
BioHazard wrote:
jsTIfied like to make gif look funny xD

Yeah. 0x5
It looks like the GIF is missing a few pixels.


A few? (More like the whole thing) :p

TIny_Hacker++
Roccolox Programs++
Yeah, that is a weird bug in jsTIfied I've noticed. Laughing
I thought that the clock was pretty cool! Well done TIny_Hacker! Do you have any future plans for this project?
Thanks for the encouragement! BioHazard suggested that I display minutes as well, though I haven't been able to come up with a way to do that without adding way more if statements and thus make the program a lot slower and take up much more space. I was trying to keep it under 1000 bytes at present. If you have any other suggestions, please do let me know!
TIny_Hacker wrote:
Thanks for the encouragement! BioHazard suggested that I display minutes as well, though I haven't been able to come up with a way to do that without adding way more if statements and thus make the program a lot slower and take up much more space. I was trying to keep it under 1000 bytes at present. If you have any other suggestions, please do let me know!



1,000 bytes?! That seems interesting. Smile
I look forward to seeing how the program ends up. Good luck Smile
Got bored before managing a sub-400. I probably missed something obvious.
402 bytes (original 881):
Code:
:DCS6
"0000000000000000000000000000000000000000000000000000000000000000
:
"7E6666666666667E781818181818187E7E0606067E60607E7E06063E0606067E6666667E060606067E60607E0606067E7E60607E6666667E7E0606060C0C0C0C7E66667E6666667E7E66667E0606067E->Str1
getTime
Ans(1->T
.1int(1+12fPart(2log(pie^(7Ans->H
"0000->Str2
For(A,1,15,2
Ans+sub(Str1,A+16int(H),2)+sub(Str1,A+160fPart(H),2
End
Ans+Str2+sub("1C8812D81CA8108810C8812D81EA8128812",1+17(T<13),18)+"880000
det(8,"CLOCK",Ans,2
Should work, but I don't have a mono.

Edit 1: Saved 144 bytes (549->405)
Edit 2: Saved 2 bytes (405->403)
Edit 3: Saved 1 byte (403->402)
I'll try this out! I can try to let you know what my results are. I'm assuming "pie" is pi, followed by e^(, right?
TIny_Hacker wrote:
I'll try this out! I can try to let you know what my results are. I'm assuming "pie" is pi, followed by e^(, right?


Correct, pie is π, and e^( is exponents.
Ok, I tested it, and it is working perfectly. Anything else I should add before a new release? Also, @logical, thanks for the optimization!
TIny_Hacker wrote:
Ok, I tested it, and it is working perfectly. Anything else I should add before a new release? Also, @logical, thanks for the optimization!


You should probably add a CIII install check to verify Celtic III is installed correctly.


Code:

If det([[1
Then
Disp "Install Celtic 3
Pause:ClrHome
Return:End


Other than that, I think you're done! Good work so far!
There shouldn't be a need for that, since you only use it with DCS anyway and DCS has Celtic III in it.
TIny_Hacker wrote:
There shouldn't be a need for that, since you only use it with DCS anyway and DCS has Celtic III in it.


I know, but I suggested it because sometimes the libs don't always work in DCS, so I add the checker just in case.
Oh ok, I see now. I tested it without CIII installed on my calc and it worked fine, so that shouldn't be necessary.
Has you thought about a Doors 8 version this?
  
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 1 of 2
» All times are GMT - 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