commodities

General discussion for players of Oolite.

Moderators: winston, another_commander

User avatar
Killer Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 2279
Joined: Tue Jan 02, 2007 12:38 pm

commodities

Post by Killer Wolf »

showing my ignorance, can someone explain this calculation in English please :

Code: Select all

quantity = (2 + (133 & 7) - (3 * -3)) & 255 = (2 + 5 + 9) & 255 = 16
i dunno what a & is or how you get 5 from &ing 133 and 7.

also, since the game code seems (according to Wiki) to limit quantities to 63 for some reason, is there any way to bypass this?

Code: Select all

// if the quantity gets too high it's zeroed
if (quantity > 127) quantity = 0

// limit the quantity to 0..63 units
quantity &= 63
this seems a bit confusing to me. should this not be "if (quantity > 127) quantity = 63"?

ta
User avatar
ADCK
---- E L I T E ----
---- E L I T E ----
Posts: 771
Joined: Thu Dec 24, 2009 12:30 am
Location: Sydney
Contact:

Re: commodities

Post by ADCK »

& is an ampersand, it means 'and'
Last edited by ADCK on Fri Jul 22, 2011 8:34 am, edited 1 time in total.
User avatar
Killer Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 2279
Joined: Tue Jan 02, 2007 12:38 pm

Re: commodities

Post by Killer Wolf »

i know what it means in speech, what does 133 AND 7 mean mathematically?
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Re: commodities

Post by JensAyton »

It means “bitwise AND”. The number 133 is 10000101₂ in binary. The number 7 is 00000111₂. Bitwise AND considers each column, so:

Code: Select all

  10000101₂ = 133
& 00000111₂ = 7
----------
  00000101₂ = 5
Equivalently, it’s multiplying each column independently.
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6683
Joined: Wed Feb 28, 2007 7:54 am

Re: commodities

Post by another_commander »

Killer Wolf wrote:
i know what it means in speech, what does 133 AND 7 mean mathematically?
The single ampersand is actually the bitwise And operator. 133 & 7 applies the And logical operation on a bit-per-bit basis on the two numbers and returns 1 when both bits are either 1 or 0, otherwise it returns 0. It works like this:
133 in binary: 10000101
7 in binary: 111

Code: Select all

10000101
00000111   &
--------
00000101 ---> 5 in decimal
More information about the bitwise operators can be found here: [wp]Bitwise operation[/wp]

Edit: Argh! Ninja'd while looking for the Wikipedia article!
User avatar
Killer Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 2279
Joined: Tue Jan 02, 2007 12:38 pm

Re: commodities

Post by Killer Wolf »

cheers guys.

so is bypassing/overriding the results not possible? i'm doing a station that's supposed to cater to the bigger haulers, more stock and slightly lower prices.
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: commodities

Post by Switeck »

In my own experience, it's even worse than that.
Anything that goes over 63 has to start over at 0 and count up to 63 again. At 63->64, it's back to 0 again!
So the only way to fill up big haulers is if quite a few commodities have 50-63 TC for sale.
Or by regular or special cargo contracts. A special cargo contract could be anything from a mission-scripted "X" TC of whatever to a special fills-the-hold cargo that doesn't register as a regular cargo type.
User avatar
Killer Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 2279
Joined: Tue Jan 02, 2007 12:38 pm

Re: commodities

Post by Killer Wolf »

bah. holdover from the player never being able to have more than a C3's holding capacity i expect.

time for a rethink then!

ta
Zireael
---- E L I T E ----
---- E L I T E ----
Posts: 1396
Joined: Tue Nov 09, 2010 1:44 pm

Re: commodities

Post by Zireael »

Killer Wolf wrote:
bah. holdover from the player never being able to have more than a C3's holding capacity i expect.

time for a rethink then!

ta
Seconded.
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: commodities

Post by Switeck »

It's the reason why getting a cargo hold larger than a Python's 100 (or 115) TC is almost a waste. The Anaconda's is so big as to basically never be fully utilized except maybe when doing massive cargo contracts and side trading along the way, but there's no real need to shrink the Anaconda's cargo capacity since that's one of its few charms. The only other one really is the 7 missile pylons, but lots of much smaller OXP ships seem to have at least that many now. :P Some missile pylon using equipment (in OXPs) can be recoded as activate-able equipment thanks to v1.75 changes, so at least that may get better.

If there's multiple stations in a system, an Anaconda might (remotely!) get filled up that way. Way I've got my game set up, there's typically only 1 big secondary station near the main station (Sothis, Superhub, or Globe) with possibly a couple special purposes stations elsewhere in-system (Rock Hermits, Pirate Coves, Black Monks, Buoy Repair, Hoopy Casino, Random Hits Spacebar, Free Trade Zone, Commies stations, Dictators factory, etc.) Even still, my Boa 2 (at 175 TC max) often has space capacity. In-system trading only typically consists of small cargo moves to/from stations I run across on my way to the main station, although I often visit the big secondary station near the main station just because it lets me double up on the big money makers. (computers, luxuries ...or furs, liquors/wines.)
User avatar
Oathbreaker
Dangerous
Dangerous
Posts: 85
Joined: Sun Jul 10, 2011 4:37 am
Location: San Diego, CA
Contact:

Re: commodities

Post by Oathbreaker »

133?

7?


LEET



...I'll just pack my bags and leave, then.
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: commodities

Post by Smivs »

Switeck wrote:
It's the reason why getting a cargo hold larger than a Python's 100 (or 115) TC is almost a waste.
Sorry Switeck, but that is completely wrong! My Boa Clipper has a 150Tc hold, and it's nearly always full. At rich industrials I buy computers and luxuries (and can't fit them all in) and at the lower-end worlds, it's furs and booze. On top of that the safe is usually well stocked with gold, gems and platinum, and if I do have any spare capacity (which does still happen) I'll stop of at a rock hermit and buy radioactives and hold on to them till I get to a rich industrial.
With a big hold it's often worth holding on to cargo for a jump or two until you find a good market. I would happily have a 250TC hold and even then it may not always be big enough.
Anaconda....good size but hopeless ship.
Commander Smivs, the friendliest Gourd this side of Riedquat.
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: commodities

Post by Switeck »

Smivs wrote:
Sorry Switeck, but that is completely wrong! My Boa Clipper has a 150Tc hold, and it's nearly always full. At rich industrials I buy computers and luxuries (and can't fit them all in) and at the lower-end worlds, it's furs and booze.
No single station will sell you more than 63 of a commodity, so in your example of computers and luxuries that would be a theoretical max of 126 TC out of your Boa Clipper's 150 TC hold if all you were doing was stocking up on computers and luxuries (or furs and booze) at the main station. Rock Hermits wouldn't help in that regard, because they don't offer computers, luxuries, furs, or booze...so apparently you have other OXP places to visit.
User avatar
Alex
---- E L I T E ----
---- E L I T E ----
Posts: 770
Joined: Mon Oct 06, 2008 10:49 pm
Location: Oz. The land of some gold but mostly rust

Re: commodities

Post by Alex »

I once hacked my ship to hold 500Tc

Know what, it still wasn't big enough for the good deals I came across.

Then realized, a lot of the game fun for me was in deciding what and where to buy and sell.

So returned hold to original size.

Would still like to be able to sell more than 127 units of stuff at a time though. Namely Gold, Plat and Gems.
LOOK OUT!!!
OOPS..
"Press Space" Commander
If you do not see "Press Space" more often than you want.. Your not trying!
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: commodities

Post by Smivs »

Switeck wrote:
Smivs wrote:
Sorry Switeck, but that is completely wrong! My Boa Clipper has a 150Tc hold, and it's nearly always full. At rich industrials I buy computers and luxuries (and can't fit them all in) and at the lower-end worlds, it's furs and booze.
No single station will sell you more than 63 of a commodity, so in your example of computers and luxuries that would be a theoretical max of 126 TC out of your Boa Clipper's 150 TC hold if all you were doing was stocking up on computers and luxuries (or furs and booze) at the main station. Rock Hermits wouldn't help in that regard, because they don't offer computers, luxuries, furs, or booze...so apparently you have other OXP places to visit.
I usually keep 15-20 TC clear for salvage and rescues (free money), and as I hinted, with this capacity you can sit on stuff until you get a good price. For instance Alien Items (scooped Thargons) are worth holding on to until you get to a high-paying world or a sec-com station if you use Galactic Navy.
Also it's not uncommon to visit say two high techs in a row....fill up the spare with even more computers, and sell them in two lots if necessary. You'll still make maximum profit within a handful of jumps. It's just a case of using the space intelligently.
Commander Smivs, the friendliest Gourd this side of Riedquat.
Post Reply