Auslesen des [Money]-Pack-Namens aus der Global.cfg

Das Forum befindet sich im reduzierten Betrieb. Die Addon- und Supportforen bleiben weiterhin verfügbar.
Bitte beachte, dass OMSI nicht mehr weiterentwickelt wird. Ein Teil der Entwickler widmet sich inzwischen der Entwicklung eines neuen Simulators. Weitere Informationen zum LOTUS-Simulator findest Du hier.
  • Moin Leute,


    ist es möglich, und wenn ja wie, den Namen des aktuell verwendeten [Money]-Packs aus der global.cfg der jeweiligen Karte auszulesen.

    Ich möchte das gern als automatischen Schalter für meinen Texturwechsel der Kasse verwenden.


    Wenn das funktionieren würde, wär das alles schon toppi.


    Edit: Habe mir gerade mal das Money-Pack DM (Berlin) angeschaut und dabei die Variable


    [currency]

    DM

    2


    gefunden.

    Wie könnte man die in einem Script im Bus auslesen?



    mfg

    Daniel

  • fOcUs04

    Hat den Titel des Themas von „Auslesen des [Money]-Packs aus der Global.cfg“ zu „Auslesen des [Money]-Pack-Namens aus der Global.cfg“ geändert.
  • Hello,


    There seem to be no documented variables, triggers, or macros for that purpose, hence effective money-pack info (and global.cfg info in general) is likely just one more among the many kinds of data-sets that OMSI simply never bothered exposing to its users. Then again documentation has always been lacking, so, who knows, maybe there actually just so happens to be some arcane variable/trigger/macro after all, mentioned somewhere in the depths of these fora...


    In the meantime one could of course always attempt to write an OMSI plugin that parses the global.cfg (but which one of them all? there's no reliable way of programmatically telling which map you're currently on -- only which hof your vehicle has been assigned to), or alternatively dumps the OMSI process's memory, so as to extract the targeted information and ultimately communicate it back to specific vehicle script variables for further processing. It's just a question of cost vs benefit.


    (Edit) Maybe the most reasonable compromise would be a mere ".hof-constant":

    Code
    1. [global_strings]
    2. ...
    3. 1


    Then in the script:


    Code
    1. ' example: custom currency "constant" is the 7th global_string (index is zero-inclusive)
    2. 6 (M.V.GetDepotStringGlobal) $StrToFloat s0 -1 =
    3. {if}
    4. '   no value specified
    5.     0 s0
    6. {endif}
    7. l0 (S.L.currency)


    Lastly in the model.cfg you can swap textures in the usual ways (e.g. via [matl_item], [visible], ...). When the currency variable is 0 you can assume a default texture you'd use most often (I'd guess EUR or DM), so that you're not forced to specify that default in every .hof-file.