I'm working on a mission OXP in galaxy (see, no capital g ) 1 and when I use the planet numbers from the Wiki in my scripts I have to subtract 1 from the number listed to get the right planet. Have other people encountered this and is it the same for all of the other galaxies?
If it is the same for all galaxies I will put a note of this requirement on the Wiki.
Planet lists on the Wiki
Moderators: winston, another_commander
- Uncle Reno
- ---- E L I T E ----
- Posts: 648
- Joined: Mon Apr 24, 2006 12:54 pm
- Location: UK
Planet lists on the Wiki
"Get back or I unleash my lethal spotted batoid!!"
What I do when not reading the Oolite bulletin board!
What I do when not reading the Oolite bulletin board!
- LittleBear
- ---- E L I T E ----
- Posts: 2882
- Joined: Tue Apr 04, 2006 7:02 pm
- Location: On a survey mission for GalCop. Ship: Cobra Corvette: Hidden Dragon Rated: Deadly.
Yep!
Always have to substact 1. G 1 = G0 and planet number 1 equal 0.
Previous version of the planet numbers started at 0. The current one does not. No biggy, just have to remember that that "planet_number" for scipting is one less than the number on the Wikki.
Always have to substact 1. G 1 = G0 and planet number 1 equal 0.
Previous version of the planet numbers started at 0. The current one does not. No biggy, just have to remember that that "planet_number" for scipting is one less than the number on the Wikki.
OXPS : The Assassins Guild, Asteroid Storm, The Bank of the Black Monks, Random Hits, The Galactic Almanac, Renegade Pirates can be downloaded from the Elite Wiki here.
- Uncle Reno
- ---- E L I T E ----
- Posts: 648
- Joined: Mon Apr 24, 2006 12:54 pm
- Location: UK
OK, I knew about the galaxy number needing to have 1 subtracted from it, and the Wiki does say that, but I thought I would double check about the planets. Thanks!
"Get back or I unleash my lethal spotted batoid!!"
What I do when not reading the Oolite bulletin board!
What I do when not reading the Oolite bulletin board!
- Commander McLane
- ---- E L I T E ----
- Posts: 9520
- Joined: Thu Dec 14, 2006 9:08 am
- Location: a Hacker Outpost in a moderately remote area
- Contact:
And the same is true for all the other values: techlevel 0 in the list means techlevel 1 in the game. Things like government-type are usually not visible as numbers, but they are handled in the same way, from 0 to 7.
That's simply because (as the veterans know) in the old days these values were stored in one byte only (or even parts of it only!). One byte can take values from 0..255, not 1..256. For the range 0..7 you actually need three bits only (one byte has eight), so you can store techlevel plus government type in one byte only and still have two bits left that can serve as a flag (on/off) for a certain action or a piece of equipment that you have or have not.
Programming used to be very economically in the old days of Elite. (There was even a TV computer show in german TV, where the presenters used a "thumb up" gesture as a greeting, meaning: You should always have one byte left in your computer's RAM when you have finished your program.)
-----
Thinking about it again it seems more likely that the old Elite generated an array of information about each planet in a galaxy. But the issue is still the same: Internally each computer starts counting with 0, not with 1, and that's what we all had to learn and adapt to when we started our first programming exercises in BASIC. So the first item in the array has the ordinal number 0, not 1. You could of course still have filled the positions 1..256 (instead of 0..255) in the array, but that would have meant wasting valuable RAM, because the array would have been bigger (reaching from 0..256 instead of 0..255) and the empty position 0 would have needed the same amount of RAM as all the filled positions. So you simply started counting from 0, as the machine did.
That's simply because (as the veterans know) in the old days these values were stored in one byte only (or even parts of it only!). One byte can take values from 0..255, not 1..256. For the range 0..7 you actually need three bits only (one byte has eight), so you can store techlevel plus government type in one byte only and still have two bits left that can serve as a flag (on/off) for a certain action or a piece of equipment that you have or have not.
Programming used to be very economically in the old days of Elite. (There was even a TV computer show in german TV, where the presenters used a "thumb up" gesture as a greeting, meaning: You should always have one byte left in your computer's RAM when you have finished your program.)
-----
Thinking about it again it seems more likely that the old Elite generated an array of information about each planet in a galaxy. But the issue is still the same: Internally each computer starts counting with 0, not with 1, and that's what we all had to learn and adapt to when we started our first programming exercises in BASIC. So the first item in the array has the ordinal number 0, not 1. You could of course still have filled the positions 1..256 (instead of 0..255) in the array, but that would have meant wasting valuable RAM, because the array would have been bigger (reaching from 0..256 instead of 0..255) and the empty position 0 would have needed the same amount of RAM as all the filled positions. So you simply started counting from 0, as the machine did.
- JensAyton
- Grand Admiral Emeritus
- Posts: 6657
- Joined: Sat Apr 02, 2005 2:43 pm
- Location: Sweden
- Contact:
Actually, the reason is that the convention in low-level programming languages (and mathematics) is to start counting from zero. :-)Commander McLane wrote:That's simply because (as the veterans know) in the old days these values were stored in one byte only (or even parts of it only!). One byte can take values from 0..255, not 1..256.
E-mail: [email protected]