Gewählte Sprache speichern?

  • #1, by darkconsulTuesday, 29. August 2017, 22:18 7 years ago
    Umschalten einer Sprache klappt wunderbar, wie kann ich nun dafür sorgen, dass beim Neustart des Spiels automatisch die eingestellte Sprache oder auch andere Settings bleiben?



    Newbie

    40 Posts


  • #2, by sebastianTuesday, 29. August 2017, 22:23 7 years ago
    dafür brauchst du eine config.ini Datei, die vom Spiel gelesen bzw beschrieben werden kann. Im Wiki gibts dazu ein Beispielskript:


    EDIT: das Forum scheint das (CMS) nicht in den Link zu integegrieren. bitten die obige Zeile komplett markieren und in die Adresszeile einfügen.

    Grüße
    Sebastian

    Thread Captain

    2346 Posts

  • #3, by MachtnixWednesday, 30. August 2017, 01:55 7 years ago
    Kommt aber trotzdem das, mit oder ohne CMS:

    There is currently no text in this page. You can search for this page title in other pages, or search the related logs, but you do not have permission to create this page.

    wink

    Thread Captain

    1097 Posts

  • #4, by sebastianWednesday, 30. August 2017, 01:59 7 years ago
    notfalls im wiki nach config.ini suchen 

    Thread Captain

    2346 Posts

  • #5, by MachtnixWednesday, 30. August 2017, 02:51 7 years ago
    Ich glaube, da ist immer ein Leerzeichen vor dem (CMS) zuviel:

    https://wiki.visionaire-tracker.net/wiki/Read/Write_Config.ini_(CMS)

    Thread Captain

    1097 Posts

  • #6, by darkconsulWednesday, 30. August 2017, 20:36 7 years ago
    Ok Danke.

    Newbie

    40 Posts

  • #7, by darkconsulSaturday, 16. September 2017, 12:21 7 years ago
    Nun das config-file wird gespeichert und gelesen. Mit der Musik funktioniert das schonmal.

    Wie setze ich nun die standardsprache anders? auch habe ich das gefühlt das "TextLanguage" + "SpeechLanguage" nicht greifen.  Folgendes klappt bei mir noch nicht
    - Standardsprache dauerhaft umstellen
    - fullscreen als default



    Hier die aktuell geschriebene config.ini
    File = Data.vis
    
    #
    
    # Fullscreen = {Yes|No}
    
    # Yes: starts the game in fullscreen
    
    # No: starts the game in a window
    
    Fullscreen = No
    
    #
    
    # Subtitles = {Yes|No}
    
    # Yes: show subtitles during the game, cut scenes & videos
    
    # No: do not show subtitles during the game, cut scenes or videos
    
    Subtitles = No
    
    #
    
    # TextLanguage = {English|French|German|Spanish}
    
    # this will display subtitles in the specified language
    
    TextLanguage = Deutsch
    
    #
    
    # SpeechLanguage = {English|French|German|Spanish}
    
    # this will play speech files linked to the specified language
    
    # if no speech language is provided then the speech language will default to the standard language
    
    SpeechLanguage = Deutsch
    
    #
    
    # ColorBlindMode = {Yes|No}
    
    # Yes: enable color blind support (graphic replacement, on screen indicators etc)
    
    # No: show the game as it's meant to be played
    
    ColorBlindMode = No
    
    #
    
    # MusicVolume|SoundVolume|SpeechVolume|MovieVolume|GlobalVolume = int value {0-100}
    
    MusicVolume = 100
    
    SoundVolume = 100
    
    SpeechVolume = 100
    
    MovieVolume = 100
    
    GlobalVolume = 20
    

    Newbie

    40 Posts

  • #8, by sebastianSaturday, 16. September 2017, 15:24 7 years ago
    wie sieht denn nun dein config-script aus, welches du verwendest?

    Thread Captain

    2346 Posts

  • #9, by darkconsulSaturday, 16. September 2017, 18:46 7 years ago
    Visionaire 5 RC2 ist im Einsatz. Ich vermnute fast, dass ich in die Variable: "VGameStandardLanguage" lesen/schreiben muss. Eigentlich das reduzierte default config-skript:

    --[[
    Read/Write Config.ini [v2] (02/03/2014)
    Written by AFRLme [Lee Clarke]
    -- + --
    alternatingfrequencies@hotmail.com | skype @ AFRLme
    -- + --
    This script is donation optional. In game credit is non-negotiable.
    You are free to: ¹ use it in your game(s). ² modify the script.
    Do not remove - or edit - this comment block.
    --]]
    -- * local variables * --
    local fn = "config.ini" -- store filename
    -- * --
    local wm = getObject("Conditions[cfg_wm]") -- window mode [fullscreen/windowed]
    local res = getObject("Values[cfg_res]") -- resolution [fullscreen mode only]
    local subs = getObject("Conditions[cfg_subs]") -- subtitles [on/off]
    local fx = getObject("Values[cfg_fx]") -- fx level [low/medium/high] (controls which animations will be displayed)
    local cbm = getObject("Conditions[cfg_cbm]") -- color blind mode [on/off]
    -- * fallback * --
    local df = "Data.vis" -- filename should reflect exported .vis file
    game:setValue(VGameSpeechLanguage, game:getLink(VGameStandardLanguage)) -- default speech language to stndard language
    -- * tables * --
    local t_res = {"Auto","Desktop","640x480","800x600","1024x768","1280x720","1280x1024","1680x1050","1920x1080"} -- add available resolutions here
    local t_lang = game:getLinks(VGameLanguages) -- store all available languages into a table
    -- * function used to read data from the config.ini file * --
    function read_ini()
     local fr = io.open(localAppDir .. fn, "r") -- read from config.ini
     -- * --
     if fr then -- if file exists then...
      lines = fr:read() -- read currently selected line
      print("-- * --")
      print(fn .. " exists")
      print("retrieving settings from " .. fn)
      for lines in io.lines(localAppDir .. fn) do
       line = string.lower(lines) -- convert all line content to lowercase
       if not line:find("#") then -- skip all lines containing "#"
        if line:find("file =") then df = string.sub(lines, 8); print("file is currently linked to " .. df) end
        -- * window mode * --
        if line == "fullscreen = no" then wm:setValue(VConditionValue, false); print("window mode is currently set to Windowed") end
        if line == "fullscreen = yes" then wm:setValue(VConditionValue, true); print("window mode is currently set to Fullscreen") end
        -- * subtitles * --
        if line == "subtitles = no" then subs:setValue(VConditionValue, false); print("subtitles are currently set to Off") end
        if line == "subtitles = yes" then subs:setValue(VConditionValue, true); print("subtitles are currently set to On") end
        -- * text language * --
        for i = 1, table.maxn(t_lang) do if line == ("textlanguage = " .. string.lower( t_lang:getName() )) then game:setValue(VGameStandardLanguage, t_lang); print("text language is currently set to " .. game:getLink(VGameStandardLanguage):getName()) end end
        -- * speech language * --
        for i = 1, table.maxn(t_lang) do if line == ("speechlanguage = " .. string.lower( t_lang:getName() )) then game:setValue(VGameSpeechLanguage, t_lang); print("spoken language is currently set to " .. game:getLink(VGameSpeechLanguage):getName()) end end
        -- * color blind mode * ---
        if line == "colorblindmode = no" then cbm:setValue(VConditionValue, false); print("color blind mode is currently set to Off") end
        if line == "colorblindmode = yes" then cbm:setValue(VConditionValue, true); print("color blind mode is currently set to On") end
        -- * sound levels * --
        if line:find("musicvolume =") then print("music volume = " .. getVolume(eMusicVolume)) end
        if line:find("soundvolume =") then print("sound volume = " .. getVolume(eSoundVolume)) end
        if line:find("speechvolume =") then print("speech volume = " .. getVolume(eSpeechVolume)) end
        if line:find("movievolume =") then print("movie volume = " .. getVolume(eMovieVolume)) end
        if line:find("globalvolume =") then print("global volume = " .. getVolume(eGlobalVolume)) end
       end
      end
      fr:close()
      print("successfully retrieved settings from " .. fn)
     else
      print(fn .. " does not exist")
     end
    end
    -- * function used to write data to the config.ini file * --
    function write_ini()
     local fw = io.open(localAppDir .. fn, "w") -- write to config.ini
     print("-- * --")
     print("writing new settings to " .. fn)
     -- * data file * --
     fw:write("File = " .. df .. "\n")
     -- * window mode * --
     fw:write("#\n")
     fw:write("# Fullscreen = {Yes|No}\n")
     fw:write("# Yes: starts the game in fullscreen\n")
     fw:write("# No: starts the game in a window\n")
     fw:write("Fullscreen = ")
     if wm:getBool(VConditionValue) then fw:write("Yes\n") else fw:write("No\n") end
      -- * subtitles * --
     fw:write("#\n")
     fw:write("# Subtitles = {Yes|No}\n")
     fw:write("# Yes: show subtitles during the game, cut scenes & videos\n")
     fw:write("# No: do not show subtitles during the game, cut scenes or videos\n")
     fw:write("Subtitles = ")
     if subs:getBool(VConditionValue) then fw:write("Yes\n") else fw:write("No\n") end
     -- * text language * --
     fw:write("#\n")
     fw:write("# TextLanguage = {English|French|German|Spanish}\n")
     fw:write("# this will display subtitles in the specified language\n")
     fw:write("TextLanguage = " .. game:getLink(VGameStandardLanguage):getName() .. "\n")
     -- * speech language * --
     fw:write("#\n")
     fw:write("# SpeechLanguage = {English|French|German|Spanish}\n")
     fw:write("# this will play speech files linked to the specified language\n")
     fw:write("# if no speech language is provided then the speech language will default to the standard language\n")
     fw:write("SpeechLanguage = " .. game:getLink(VGameSpeechLanguage):getName() .. "\n")
     -- * color blind mode * --
     fw:write("#\n")
     fw:write("# ColorBlindMode = {Yes|No}\n")
     fw:write("# Yes: enable color blind support (graphic replacement, on screen indicators etc)\n")
     fw:write("# No: show the game as it's meant to be played\n")
     fw:write("ColorBlindMode = ")
     if cbm:getBool(VConditionValue) then fw:write("Yes\n") else fw:write("No\n") end
     -- * volume settings * --
     fw:write("#\n")
     fw:write("# MusicVolume|SoundVolume|SpeechVolume|MovieVolume|GlobalVolume = int value {0-100}\n")
     fw:write("MusicVolume = " .. getVolume(eMusicVolume) .. "\n")
     fw:write("SoundVolume = " .. getVolume(eSoundVolume) .. "\n")
     fw:write("SpeechVolume = " .. getVolume(eSpeechVolume) .. "\n")
     fw:write("MovieVolume = " .. getVolume(eMovieVolume) .. "\n")
     fw:write("GlobalVolume = " .. getVolume(eGlobalVolume) .. "\n")
     print("new settings successfully written to " .. fn)
     fw:close()
    end

    Newbie

    40 Posts

  • #10, by sebastianSaturday, 16. September 2017, 22:45 7 years ago
    heißt die Sprache, die du verwendet hast auch "Deutsch" oder ggf. "German"? Muss exakt so heißen, wie du sie im Editor genannt hast. Ansonsten setzen die in deinem Skript genutzten Befehle:

    game:setValue(VGameStandardLanguage, t_lang);

    und

    game:setValue(VGameSpeechLanguage, t_lang);

    die Sprachen für Text und Audio, was korrekt ist.

    Erscheint irgendetwas diesbezüglich in der Konsole, wenn du das Spiel startest und das Skript ausführst?

    Grüße
    Sebastian

    Thread Captain

    2346 Posts

  • #11, by darkconsulSunday, 17. September 2017, 16:03 7 years ago
    Sprache:
    Nach Durchsicht der offizellen config.ini und ihrer möglichen Werten konnte ich das Problem lösen.  Die Variable heisst "Language",schreibe ich diese klappt alles mit der Sprache.

    Folgendes geht noch schief:

    16:07:35.056:The command line parameter 'resolution' can only be used in fullscreen mode. Parameter is ignored.
    16:07:35.125:Can't find object "cfg_wm" in table "Conditions".
    16:07:35.125:Can't find object "cfg_subs" in table "Conditions".
    16:07:35.163:Failed to run string in Lua:
    16:07:35.163:String content: read_ini()

    sprache speichern klappt:
     fw:write("Language = " .. game:getLink(VGameStandardLanguage):get<span>Name() .. "\n")
    </span>

    Newbie

    40 Posts