display subtitle text: text =<Var/String> duration =<Var/Number> ms

This forum serves as MSCI Reference at EGOSOFT. It's Read-Only for non MSCI Group members.

Moderators: Scripting / Modding Moderators, MSCI Moderators

mark_a_condren
Posts: 1468
Joined: Wed, 3. Aug 05, 05:05
x3tc

display subtitle text: text =<Var/String> duration =<Var/Number> ms

Post by mark_a_condren » Tue, 21. Sep 10, 16:42

display subtitle text: text =<Var/String> duration =<Var/Number> ms


<Var/String> = The message you wish to display as a subtitle.
<Var/Number> = The length of time to display the subtitle in milliseconds.


This command displays a text string as a message along the bottom of the screen for the prescribed period of time.

When wishing to display objects in a subtitle message, the 'sprintf' command should be used to first convert the 'objects display text' into a string format. As 'objects' returned by most commands are in fact only 'pointers' to there location in memory, this needs to be converted into a format readable by humans.


Examples:

display subtitle text: text = 'I want this text displayed at the bottom of the screen for 3 seconds. duration = 3000 ms

-----------------------------------------

$player.credits = get player money
$player.credits.str = convert number $player.credits to string
$sub.message = sprintf: fmt = 'Congratulations on having %scr in your account.', $player.credits.str, null, null, null, null

display subtitle text: text = $sub.message duration = 3000 ms

This would display the congratulations message containing the players current credits as a subtitle for the required 3 seconds.

-----------------------------------------

$sector = [PLAYERSHIP] get sector
$sub.message = sprintf: fmt = '%s', $sector, null, null, null, null
display subtitle text: text = $sub.message duration = 3000 ms

As $sector is an 'object', it needs to first be converted into a string format before it can be displayed. Failure to do this will result in No message being displayed.


Note:

If you try to display multiple subtitles straight after each other without waiting for the previous one to be displayed, you will effectively overwrite all previous messages and only have the last one displayed.


Command Location:

User avatar
X2-Illuminatus
Moderator (Deutsch)
Moderator (Deutsch)
Posts: 24969
Joined: Sun, 2. Apr 06, 16:38
x4

[TiP][49] 287367

Post by X2-Illuminatus » Mon, 18. Oct 10, 10:25

display subtitle text: text = <Var/String> duration = <Var/Number> ms


<Var/String> = Die Nachricht, die du als Untertitel anzeigen lassen möchtest.
<Var/Number> = Die Zeitlänge in Millisekunden, die du den Untertitel anzeigen lassen möchtest.


Dieser Befehl zeigt eine Zeichenkette (string) als Nachricht am unteren Rand des Bildschirms für die gewählte Zeitdauer an.

Wenn Objekte in einem Untertitel angezeigt werden sollen, sollte zunächst der sprintf Befehl genutzt werden, um den anzuzeigenden Text des Objekts in das Format einer Zeichenkette zu formatieren. Da "Objekte", wie sie von den meisten Befehlen zurückgegeben werden, nur "Zeiger" (pointers) auf ihre Positionen im Speicher sind, müssen diese in ein für Menschen lesbares Format umgewandelt werden.


Beispiele:

display subtitle text: text = 'Ich moechte diesen Text am unteren Rand des Bildschirms für 3 Sekunden lang anzeigen.' duration = 3000 ms

-----------------------------------------

$player.credits = get player money
$player.credits.str = convert number $player.credits to string
$sub.message = sprintf: fmt = 'Gratulation, Sie haben %scr auf Ihrem Konto.', $player.credits.str, null, null, null, null

display subtitle text: text = $sub.message duration = 3000 ms

Dies würde die Gratulationsnachricht mit den derzeitigen Credits des Spielers für drei Sekunden lang als Untertitel anzeigen.

-----------------------------------------

$sector = [PLAYERSHIP] get sector
$sub.message = sprintf: fmt = '%s', $sector, null, null, null, null
display subtitle text: text = $sub.message duration = 3000 ms

Da $sector ein 'Objekt' ist, muss es vor der Anzeige in das Format einer Zeichenkette gebracht werden. Sollte dies nicht geschehen, wird überhaupt keine Nachricht angezeigt.


Beachte:

Wenn du versuchst, mehrere Untertitel direkt hintereinander anzeigen zu lassen, ohne auf die Anzeige der vorherigen zu warten, so werden alle vorherigen Nachrichten überschrieben und nur die letzte wird angezeigt.


Zu finden unter:

Return to “MSCI Reference”