cargoCarried?
Moderators: winston, another_commander
- 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:
cargoCarried?
Can we already query the amount of cargo carried by the player in JS (or anywhere else, for that matter)? So that we use the player.dumpCargo only if there is actually something in the hold?
This has been a request, I am just not sure whether it has already been implemented (and there is nothing in the wiki).
This has been a request, I am just not sure whether it has already been implemented (and there is nothing in the wiki).
- 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:
- DaddyHoggy
- Intergalactic Spam Assassin
- Posts: 8515
- Joined: Tue Dec 05, 2006 9:43 pm
- Location: Newbury, UK
- Contact:
I'm here - but I can't answer your question...
Oolite Life is now revealed hereSelezen wrote:Apparently I was having a DaddyHoggy moment.
-
- Quite Grand Sub-Admiral
- Posts: 6683
- Joined: Wed Feb 28, 2007 7:54 am
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
I think nothing has changed till now. The status on the wiki is still correct. As A_C writes: dumpCargo only dumps cargo when the player or NPC has cargo on board.
dumpCargo can be used from within the AI or from JS. In the later case it returns the entity of the dumped cargo (or null when there was no cargo). The entity is probably a cargo pod and a script still will not be able to see what is inside it.
this.cargo = player.dumpCargo()
or
if(player.dumpCargo()) {........}
The later if statement will try to dump the cargo and is only true when there was cargo dumped.
dumpCargo can be used from within the AI or from JS. In the later case it returns the entity of the dumped cargo (or null when there was no cargo). The entity is probably a cargo pod and a script still will not be able to see what is inside it.
this.cargo = player.dumpCargo()
or
if(player.dumpCargo()) {........}
The later if statement will try to dump the cargo and is only true when there was cargo dumped.
UPS-Courier & DeepSpacePirates & others at the box and some older versions
- JensAyton
- Grand Admiral Emeritus
- Posts: 6657
- Joined: Sat Apr 02, 2005 2:43 pm
- Location: Sweden
- Contact:
Hmm, yes. Adding Ship methods:
- cargoSpaceUsed
- availableCargoSpace
- passengerCount
- passengerCapacity (Currently always 0 for NPCs)
Yep, just a ship like any other. Currently.Eric Walch wrote:The entity is probably a cargo pod and a script still will not be able to see what is inside it.
E-mail: [email protected]
- 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:
Thanks!Ahruman wrote:Hmm, yes. Adding Ship methods:Also renaming maxCargo to cargoCapacity.
- cargoSpaceUsed
- availableCargoSpace
- passengerCount
- passengerCapacity (Currently always 0 for NPCs)
Just for clarification: I want to query whether there actually is cargo, because I want to unvoluntarily dump player-cargo together with printing out a screen message. As it is now the screen message will also be given out if there is actually no cargo dumped, which is kind of unsatisfying.
And it's already there in Flying_Dutchman.oxp. (The next version for 1.72 will have the query for cargoSpaceUsed included.)
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
Not completely. When you use:Commander McLane wrote:As it is now the screen message will also be given out if there is actually no cargo dumped, which is kind of unsatisfying.
Code: Select all
if(player.dumpCargo()) {your message....}
UPS-Courier & DeepSpacePirates & others at the box and some older versions
- 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: