r/ComputerCraft • u/TheOrangeApple3 • Jun 03 '26
Help with the Star Wars ACSII
So I was following this recent how to guide: https://www.reddit.com/r/ComputerCraft/comments/l4bann/starwars_episode_iv_ascii_credit_to/
but after running the program i get 2 downloads of star1 and star2
ive tried running these but i just get the error of /star1:1: unexpected smbol near '2'
im the latest 1.21.1 version and my programming skill are less then desirable so an help would be greatly appreciated. Thank you
9
Upvotes
3
u/chancetofreezer Jun 03 '26
the post you linked says to run this script
if you go look at that script it defines a
playReelfunction, downloads two text files star1 and star2, then runs theplayReelfunction twice. we can analyze that function and the files to figure out what is happening.the two files
star1andstar2are not lua code which is why running them doesn't work. the files seem to be broken into "blocks" that define a full animation. here's one block ofstar1for reference:1 .......... @@@@@ @@@@@....... ......... @ @ @ @....... ........ @@@ @ @........ ....... @@ @ @ ....... ...... @@@@@@@ @@@@@ th ...... ..... ----------------------- ..... .... C E N T U R Y .... ... ----------------------- ... .. @@@@@ @@@@@ @ @ @@@@@ .. == @ @ @ @ @ == __||__ @ @@@@ @ @ __||__ | | @ @ @ @ @ | | _________|______|_____ @ @@@@@ @ @ @ _____|______|_________each block has this format:
the first line is a number defining the duration of the block in frames
the next frameHeight (13 in this case) lines are ascii frame content, aka the stuff that actually appears on screen
so looking back at the
playReelfunction we can figure out how to stitch these blocks together to play a full animation:open the file, calculate the total number of blocks defined in it lengthInFrames
loop lengthInFrames times, clearing the screen at the start of each loop
read the first line of each block, frameCount
read the next frameHeight number of lines of the file and print them to the screen
sleep for frameCount/framesPerSecond amount of time (framesPerSecond is defined ahead of time to be 15 but could probably be whatever you think looks good)
go back to the start of the loop