MateoConLechuga wrote:
xlibman wrote:
I wanted to update the game since it only works with C libs released before October 2017.

Can you expand on this a bit more? The C libraries are backwards compatible across all versions, so this seems like a case where the API might not be being used correctly by the ICE compiler?


On the possum's game's title screen, text and rectangles are displayed with the wrong colors for the most part and when the game starts the opossum's mood is always "Satanic Mad" instead of picking randomly between 6 different moods (with Satanic Mad being the 5th).

The weird part is that text/shape discoloring only seem to happen on the title screen and not anywhere else.


Code:
Lbl TI
[i]Displays title screen content
FillScreen(B+111
SetColor(248-B
FillRectangle(0,14,160,88
FillRectangle(160,14,160,88
SetColor(255
FillRectangle(0,18,160,80
FillRectangle(160,18,160,80
ScaledSprite_NoClip(1,66,20,2,2
TransparentSprite_NoClip(4,120,108
SetTextFGColor(9+B
PrintStringXY("Press anykey!",58,160
SetTextFGColor(B
PrintStringXY("(c)2016 It RPG Is!",16,208
PrintStringXY("http://codewalr.us",16,224



Code:
   [i]Possum mood rand, score, meter, mood spd list, mood spd cache(2), anim frame
   rand/2800000->R
   0->P
   77->E
   385->F
   {8,3,4,2,7,5,4,7,5,6,20,5->L1
   L1(R->L
   L1(R+6->M
   0->U
   [i]Var increment timers
   0->T
   0->S
   0->V
   SetTextFGColor(255
   PrintStringXY("Possum's ",0,0
   If R=0
      PrintString("hyper"
   End
   If R=1
      PrintString("grumpy"
   End
   If R=2
      PrintString("feelin good"
   End
   If R=3
      PrintString("sleepy"
   End
   If R=4
      PrintString("satanic mad"
   End
   If R=5
      PrintString("scared"
   End
I just downloaded and learned ICE, and some of the main things I want to write require floating-point numbers. Has anyone made a library or sub program that allows ICE to handle them, or will I have to make one? The things I am trying to make are the Cookie Clicker game and a Mandelbrot set renderer.
P.S. I have been programming in BASIC for three years, and just looked up assembly and C and all that stuff, so I don’t really know anything about it.
S/jr/W wrote:
I just downloaded and learned ICE, and some of the main things I want to write require floating-point numbers. Has anyone made a library or sub program that allows ICE to handle them, or will I have to make one? The things I am trying to make are the Cookie Clicker game and a Mandelbrot set renderer.
P.S. I have been programming in BASIC for three years, and just looked up assembly and C and all that stuff, so I don’t really know anything about it.


Hey S/jr/W, ICE does not support floats you'll have to write your own library for that. Also, Cookie Clicker has already been made on the CE here: https://codewalr.us/index.php?topic=1799.0.

Lastly, A Mandelbroth set renderer has been made on the CE: https://www.youtube.com/watch?v=S8XNCO9MB78.

I encourage you to remake some in ICE and see how it pans out.

Good luck on you ICE programming journey. Smile
I am attempting to open, read, and edit/save to a program. I am able to open the file and get the correct length, but when I try and read/convert the tokens into a string, it prints a random symbol/letter/other thing. Here is the code I am running:

Code:

sum(2, "TESTFILE", "r+", 5) → FILE                 //open the program (auto un-archive)
sum(15, FILE                 //rewind (set to beginning of file)
sum(17, sum(18, FILE), °LENT, °LENS)→LETTER                 //convert token to string
det(18, "OUTPUT: ", 1, 1                 //set and lable output
det(17, LETTER                 //print the actual letter

The file 'TESTFILE' is already made and has a bunch of letters in it.
Therad2 wrote:
I am attempting to open, read, and edit/save to a program. I am able to open the file and get the correct length, but when I try and read/convert the tokens into a string, it prints a random symbol/letter/other thing. Here is the code I am running:

Code:

sum(2, "TESTFILE", "r+", 5) → FILE                 //open the program (auto un-archive)
sum(15, FILE                 //rewind (set to beginning of file)
sum(17, sum(18, FILE), °LENT, °LENS)→LETTER                 //convert token to string
det(18, "OUTPUT: ", 1, 1                 //set and lable output
det(17, LETTER                 //print the actual letter

The file 'TESTFILE' is already made and has a bunch of letters in it.

https://github.com/CE-Programming/toolchain/blob/master/examples/fileioc/tokens/src/main.c
I changed the code to fit the example you gave me:

Code:

Sum(2,"TESTFILE","r",5)→FILE         //open
If not(FILE)         //check if a file was opened
Goto END
End
sum(18, FILE)→DATAPTR      //get the address
sum(16,FILE)→SIZE      //get the size
0→I      //the loop variable
sum(3,FILE      //close
sum(13,FILE      //archive
While SIZE      //loop untill size is 0
det(19,1,I*10      //set text location
det(17,sum(17,DATAPTR,°LENT,°LENS))      //print converted tokens
SIZE - LENT→SIZE
End


But it freezes (needs a RAM reset)
You need to pass the address of DATAPTR, not the value.

Code:
Sum(2,"TESTFILE","r",5)→FILE         //open

If not(FILE)         //check if a file was opened
Goto END
End

sum(18, FILE)→DATAPTR      //get the address
sum(16,FILE)→SIZE      //get the size

det(19,1,1      //set text location
det(17,sum(17,°DATAPTR,°LENT,°LENS))      //convert and print tokens

sum(3,FILE      //close


When I do this, it works and prints the first letter of 'TESTFILE', but when I duplicate the two last lines (and change text position), it freezes and needs a ram reset.

(Fixed after edit, still same problem)
MateoConLechuga wrote:
You need to pass the address of DATAPTR, not the value.

How many times do I have to say it. Pass the ADDRESS to the function, not the value. °DATAPTR or whatever.
Yes, sorry, I actually did change that, but just forgot to put it in the example code. It still freezes but like I said last time, it shows the first character correctly.
  
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 33 of 33
» 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