Gray out a custom command and show a portrait ?

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Post Reply
User avatar
Joubarbe
Posts: 4796
Joined: Tue, 31. Oct 06, 12:11
xr

Gray out a custom command and show a portrait ?

Post by Joubarbe » Wed, 18. Dec 13, 10:07

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.

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Re: Gray out a custom command and show a portrait ?

Post by DrBullwinkle » Wed, 18. Dec 13, 11:02

Joubarbe wrote:- Is there a way to gray out a custom command ? I would like to condition my command to a global variable.
Take a look at Passenger to Marine.

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.

User avatar
Joubarbe
Posts: 4796
Joined: Tue, 31. Oct 06, 12:11
xr

Post by Joubarbe » Wed, 18. Dec 13, 12:34

Thanks (again) !

Have you ever saw a mod/script displaying a portrait ? I read all commands, and did not find anything interesting.

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Wed, 18. Dec 13, 13:09

Actors are commonly presented from MD scripts.

Guest

Re: Gray out a custom command and show a portrait ?

Post by Guest » Wed, 18. Dec 13, 19:25

DrBullwinkle wrote:CmdConCheckDisabled is the constant that causes the command to be greyed out in the menu. [FALSE] removes the command from the menu.
check cmd script:
return 0 ... command not available
return 1 ... command available
return 2 ... command greyed out ;)

User avatar
Joubarbe
Posts: 4796
Joined: Tue, 31. Oct 06, 12:11
xr

Post by Joubarbe » Wed, 18. Dec 13, 20:41

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) :

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
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!).

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Thu, 19. Dec 13, 05:03

Joubarbe wrote: how to get the name of a class ?
RefObj-> get 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

Guest

Post by Guest » Thu, 19. Dec 13, 05:10

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
$Object.Class and $Ship.Type.Name are of datatype "string"
$Ship.Type is of datatype "ship type"
$Object.Class is of datatype "object class"

User avatar
Joubarbe
Posts: 4796
Joined: Tue, 31. Oct 06, 12:11
xr

Post by Joubarbe » Thu, 19. Dec 13, 09:13

Thank you for your answers.

Code: Select all

$Ship.Type.Name = sprint fmt: '%s', $Ship.Type, null, null, null, null
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 = sprint fmt: '%s', $Ship.Type, null, null, null, null
Because this will work too (that's what I use).

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22227
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow » Thu, 19. Dec 13, 10:28

Joubarbe wrote:Thank you for your answers.

Code: Select all

$Ship.Type.Name = sprint fmt: '%s', $Ship.Type, null, null, null, null
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 = sprint fmt: '%s', $Ship.Type, null, null, null, null
Because this will work too (that's what I use).
the sprint command is basically a way to setup a string using a serious of arguments, same as the c command, sprint.

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

Post Reply

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”