Welcome to Keen Software House Forums! Log in or Sign up to interact with the KSH community.
  1. You are currently browsing our forum as a guest. Create your own forum account to access all forum functionality.

I need help with displaying float on IMyTextPanel

Discussion in 'Programming Questions and Suggestions' started by Ormmwar, Nov 17, 2017.

Thread Status:
This last post in this thread was made more than 31 days old.
  1. Ormmwar Trainee Engineer

    Messages:
    5
    My problem is exactly what title says. Can someone explain to me how "LCD.WritePublicText();" works? I know C++ and i'm used to using "printf("%f",myfloat);". Is there a easy way to display that on lcd's? Using forum's search engine i've found 1 topic, with rotor and piston specific codes without any explanation.
     
  2. Georgik Apprentice Engineer

    Messages:
    215
    It prints strings.
    You can start with
    Code:
    float num = 1.23456;
    LCD.WritePublicText(num.ToString() );
    LCD.WritePublicText(""+num);
    If you need more formatting, internet will tell you everything you want.
     
    • Like Like x 1
  3. Ormmwar Trainee Engineer

    Messages:
    5
    THANK YOU! I can finally continue with my program :D
     
  4. Sinbad Senior Engineer

    Messages:
    2,788
    also check out MSDN for options on custom formatting like adding a comma or decimal every 3 characters, truncating to two decimal places, adding labels and justification etc.
    it may be in a game, but that game still uses the basic libraries that come with C#.
    https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-numeric-format-strings
    StackOverFlow is also a great place to look for help on an issue, guaranteed someone has tried to do something similar to anything you want to try to do and has asked about it there.
    https://stackoverflow.com/questions/4671610/why-use-string-format
     
  5. Ormmwar Trainee Engineer

    Messages:
    5
    OK, i think i'm out of programming anyways. There is not even one good SE in-game scripting tutorial, there are no lists with all functions available for all block. I wonder why learning how to script is so hard, hmm...
     
  6. Malware Master Engineer

    Messages:
    9,510
    Visual Studio man. Also
    https://github.com/malware-dev/MDK-SE/wiki/Quick-Introduction-to-Space-Engineers-Ingame-Scripts
    --- Automerge ---
    Not to mention the programming-in-game channel on Discord
     
  7. Sinbad Senior Engineer

    Messages:
    2,788
    I learned from The Yellow Book by Rob Miles.
    http://www.csharpcourse.com/
    its a free pdf textbook that assumes no prior knowledge of programming (most other books assume knowledge of at least one other language). I read the book over a few days, taking a couple of pages of notes as a sort of condensed cheat sheet that I used as a quick reference for the first few months of in game programming.
    it won't help you with the Keen specific object heirarchy though. for that visual basic is great as it allows you to use the game files as a lookup library by using the definition function. it will tell you everything you need to know as long as you know enough c# jargon to read it (thats where the book comes in)
     
  8. Ormmwar Trainee Engineer

    Messages:
    5
    Too bad i'm studying right now so i don't have a lot of free time, some important exams coming. I don't think i can do a lot of programming, because my base BARELY runs at 1.0 sim speed, 80% - 90% CPU usage. SE uses only 4 cores, and that stinks too. Anyways, thanks for the help guys, maybe i can slowly figure it out.
     
    • Friendly Friendly x 1
Thread Status:
This last post in this thread was made more than 31 days old.