Please post mod releases in the Mod Showroom
Please read the Official Modification Forum Rules & Procedures BEFORE posting!
The following topics contain extremely useful data relating to the editing of missions and mission scripting:
If you are a begininer to mission coding, then please read Tutorial Links and Mission Coding Information.
Requests are to be made in the pinned topic.
Posted 09 July 2013 - 08:49 PM
I understand variables such as float, integer, byte, etc...
0A9D: readfile 0@ size 2 to 1@ //Reads 2 bytes from file into 1@
0A9D: readfile 0@ size 4 to 1@ //Reads 4 bytes from file into 1@
What I don't understand is this;
So my question; After 1@ is read from file, is 1@ a float or an integer? How is this decided?
Posted 09 July 2013 - 09:10 PM
Posted 10 July 2013 - 12:34 AM
You will notice I went with 4 bytes on all of these, however integers values of 5@, 6@, 7@ are not floats and should not require 4 bytes.
Does an integer variable in Cleo occupy 2 bytes or 4 bytes?
What are the factors that it depends upon?
Maybe I am making more out of this than I should, just trying to understand this opcode fully.
Posted 10 July 2013 - 01:34 AM
If you wrote a 4 byte integer, you should read a 4 byte intenger, but note that you can write a 1 or 2 byte integer (if it can occupy that space), and read too (CLEO will pad the other bytes...)
The float 1.0 in binary is represented as [00111111 10000000 00000000 00000000]
The integer 1065353216 has the same binary representation.
So, if you read it into a var, it will be whatever it want to be\whatever it was written as.
|Does an integer variable in Cleo occupy 2 bytes or 4 bytes?|
Posted 10 July 2013 - 07:24 AM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users