- DCS 7 Clock in TI-BASIC
- 16 Sep 2020 11:36:59 am
- Last edited by TIny_Hacker on 14 Sep 2022 02:11:01 pm; edited 1 time in total

I've been working on making a clock for 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)

Edit: I ported this to the CE using the (Currently in progress) Celtic CE! Here's a download to the CE version when it's public: http://ceme.tech/DL2303

**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

:"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

Edit: I ported this to the CE using the (Currently in progress) Celtic CE! Here's a download to the CE version when it's public: http://ceme.tech/DL2303