write to player logbook: printf: fmt =<Var/String>, <Value>, <Value>, <Value>, <Value

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

Moderators: Scripting / Modding Moderators, MSCI Moderators

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

write to player logbook: printf: fmt =<Var/String>, <Value>, <Value>, <Value>, <Value

Post by mark_a_condren » Fri, 17. Sep 10, 16:37

write to player logbook: printf: fmt = <Var/String>, <Value1>, <Value2>, <Value3>, <Value4>, <Value5>


<Var/String> = The formatting you wish to use for your message.
<Value1 - 5> = The value(s) to be inserted into your message.


Formats and writes a message to the player's logbook.
Formatting is performed the same as for the sprintf instruction.


Example:

$station.credits = $station get money
$station.credits.string = convert number $station.credits to string
$station.name = $station get name
$station.sector = $station get sector

write to player logbook: printf: fmt = 'Your Station, %s, in sector %s, has %scr in its account.' , $station.name, $station.sector, $station.credits.string, null, null

Each time %s is encountered, the corresponding <Value> is inserted into the message and the the compiled message is printed to the player logbook.

The resulting message may look something like this,
'Your Station, Your Solar Power Plant XL alpha, in sector The Wall, has 2,343,548cr in its account.'


Command Location:
  • »» Logbook Commands
    • write to player logbook: printf: fmt=<Var/String>, <Value>, <Value>, <Value>, <Value>, <Value>

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

[TiP][49] 287086

Post by X2-Illuminatus » Thu, 14. Oct 10, 18:43

write to player logbook: printf: fmt = <Var/String>, <Value1>, <Value2>, <Value3>, <Value4>, <Value5>


<Var/String> = Das Format, das du für deine Nachricht nutzen möchtest.
<Value1 - 5> = Die Werte, die in deine Nachricht eingegeben werden.


Formatiert und schreibt eine Nachricht ins Spieler Logbuch.
Die Formatierung wird genauso wie der 'sprintf'-Befehl durchgeführt.


Beispiel:

$station.credits = $station get money
$station.credits.string = convert number $station.credits to string
$station.name = $station get name
$station.sector = $station get sector

write to player logbook: printf: fmt = 'Ihre Station, %s, im Sektor %s, hat %scr auf ihrem Konto.' , $station.name, $station.sector, $station.credits.string, null, null

Jedes Mal wenn ein %s vorgefunden wird, wird der zugehörige Wert <Value> an dieser Stelle in die Nachricht eingetragen. Die zusammengestellte Nachricht wird dann ins Spieler Logbuch geschrieben.

Die resultierende Nachricht sieht möglicherweise, wie folgt, aus:
'Ihre Station, Ihr Sonnenkraftwerk XL alpha, im Sektor Linie der Energie, hat 2.343.548cr auf ihrem Konto.'


Zu finden unter:
  • »» Logbook Commands
    • write to player logbook: printf: fmt=<Var/String>, <Value>, <Value>, <Value>, <Value>, <Value>

Locked

Return to “MSCI Reference”