Gray out a custom command and show a portrait ?
Moderators: Moderators for English X Forum, Scripting / Modding Moderators
Gray out a custom command and show a portrait ?
Hi,
Two questions this time
- Is there a way to gray out a custom command ? I would like to condition my command to a global variable.
- Can we show a portrait when the player is in space or in a station, like the game does during main plots or when he's being scanned ?
Thanks.
Two questions this time
- Is there a way to gray out a custom command ? I would like to condition my command to a global variable.
- Can we show a portrait when the player is in space or in a station, like the game does during main plots or when he's being scanned ?
Thanks.
- DrBullwinkle
- Posts: 5715
- Joined: Sat, 17. Dec 11, 01:44
Re: Gray out a custom command and show a portrait ?
Take a look at Passenger to Marine.Joubarbe wrote:- Is there a way to gray out a custom command ? I would like to condition my command to a global variable.
In the setup file, the "set script command:" line references a check script.
In the check script, there are several constants that you can return. CmdConCheckDisabled is the constant that causes the command to be greyed out in the menu. [FALSE] removes the command from the menu.
Peace through superior firepower
Bullwinkle's List | Marine Repairs and Training | Mobile Mining Mk2 | Drone Carrier Software 2 (DCS2) | Ship Tricks: Mini-Guides (with Video)
Bullwinkle's List | Marine Repairs and Training | Mobile Mining Mk2 | Drone Carrier Software 2 (DCS2) | Ship Tricks: Mini-Guides (with Video)
- DrBullwinkle
- Posts: 5715
- Joined: Sat, 17. Dec 11, 01:44
Actors are commonly presented from MD scripts.
Peace through superior firepower
Bullwinkle's List | Marine Repairs and Training | Mobile Mining Mk2 | Drone Carrier Software 2 (DCS2) | Ship Tricks: Mini-Guides (with Video)
Bullwinkle's List | Marine Repairs and Training | Mobile Mining Mk2 | Drone Carrier Software 2 (DCS2) | Ship Tricks: Mini-Guides (with Video)
Re: Gray out a custom command and show a portrait ?
check cmd script:DrBullwinkle wrote:CmdConCheckDisabled is the constant that causes the command to be greyed out in the menu. [FALSE] removes the command from the menu.
return 0 ... command not available
return 1 ... command available
return 2 ... command greyed out
And a super bonus question : how to get the name of a class ? Get name returns me a strange thing like "CLASS0418934"...
Here is the code (took from X-Studio, with strange behavior) :
And I'd need the real name of the ship. Quite strange that doesn't work.
DrBullwinkle, I know you have some libraries to find ships for ASS, but that's not exactly what I need (I read your mind!).
Here is the code (took from X-Studio, with strange behavior) :
Code: Select all
dim $ArrayTM = {Argon Magnetar}, {Boron Pleco}, {Split Boa}, {Pirate Caravel}, {Argon Zephyrus}, {Paranid Helios}, {Teladi Pelican}, {Yaki Chokaro}
if $NeededClass == [TM]
$ArrayNeeded = $ArrayTM
end
$ArraySize = size of array $ArrayNeeded
$Random = random value from zero to $ArraySize
$ReturnShip = $ArrayNeeded[$Random]
return $ReturnShip
DrBullwinkle, I know you have some libraries to find ships for ASS, but that's not exactly what I need (I read your mind!).
- DrBullwinkle
- Posts: 5715
- Joined: Sat, 17. Dec 11, 01:44
RefObj-> get classJoubarbe wrote: how to get the name of a class ?
However, there is a problem with testing the result of "get class" against a fixed class: Most ships belong to multiple classes.
For example, an M6 is a member of Carrier, M6, BigShip, Ship, and Moveable Ship.
So a more reliable test is:
If RefObj-> is of class [whatever] ...
else if RefObj-> is of class [whatever2] ...
end
Peace through superior firepower
Bullwinkle's List | Marine Repairs and Training | Mobile Mining Mk2 | Drone Carrier Software 2 (DCS2) | Ship Tricks: Mini-Guides (with Video)
Bullwinkle's List | Marine Repairs and Training | Mobile Mining Mk2 | Drone Carrier Software 2 (DCS2) | Ship Tricks: Mini-Guides (with Video)
Joubarbe wrote:And a super bonus question : how to get the name of a class ? Get name returns me a strange thing like "CLASS0418934"...
And I'd need the real name of the ship. Quite strange that doesn't work.
Code: Select all
$Ship.Type.Name = sprint fmt: '%s', $Ship.Type, null, null, null, null
$Object.Class.Name = sprint fmt: '%s', $Object.Class, null, null, null, null
$Ship.Type is of datatype "ship type"
$Object.Class is of datatype "object class"
Thank you for your answers.
That works, even if I don't really understand this command. My ship.type.name = CLASS0418934 if I use "get name" with it. Ok, because this command is to retrieve the name of an in-game object, not a ship type. But why a sprint fmt here, what do you replace exactly... ?
Because this will work too (that's what I use).
Code: Select all
$Ship.Type.Name = sprint fmt: '%s', $Ship.Type, null, null, null, null
Code: Select all
$Ship.Type = sprint fmt: '%s', $Ship.Type, null, null, null, null
the sprint command is basically a way to setup a string using a serious of arguments, same as the c command, sprint.Joubarbe wrote:Thank you for your answers.
That works, even if I don't really understand this command. My ship.type.name = CLASS0418934 if I use "get name" with it. Ok, because this command is to retrieve the name of an in-game object, not a ship type. But why a sprint fmt here, what do you replace exactly... ?Code: Select all
$Ship.Type.Name = sprint fmt: '%s', $Ship.Type, null, null, null, null
Because this will work too (that's what I use).Code: Select all
$Ship.Type = sprint fmt: '%s', $Ship.Type, null, null, null, null
all objects and data types can be converted to strings internally,.
the Reason the ->get name doesn't work, is because classes are not objects, they are enumerations, so you can't run object commands on them.
When converting these into a string, it basically does a read text command for the correct page and class id