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.

Save And Restore State Of A Block

Discussion in 'Programming (In-game)' started by Bullet_Force, Jul 29, 2018.

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

    Messages:
    366
    Is there a way to save the state of a block (all its properties and settings) and then at a later point restore it?

    I am currently saving the On/Off state to the Custom Data field of the block but I would like a way to serialize all the other settings which can very from block to block.
     
  2. Wicorel Senior Engineer

    Messages:
    1,258
    Sure.

    You can write code to get and serialize the current settings.

    Then deserialize and set the settings.
     
  3. Ronin1973 Master Engineer

    Messages:
    4,945
  4. Malware Master Engineer

    Messages:
    9,861
  5. Bullet_Force Apprentice Engineer

    Messages:
    366
    Hi I am wondering is it possible to get the values of all the properties of a block.

    I have the following code to get all the properties of a block but it doesn't seem to offer a way to get the value. It lets me get the Id of the property but not a value?
    Code:
     List<ITerminalProperty> properties = new List<ITerminalProperty>();
    myblock.GetProperties(properties);
    foreach(var p in properties)
    {
    	Echo(TerminalPropertyExtensions.GetValue<string>(myblock,p.Id.ToString()));						
    }
     
    Last edited: Aug 24, 2018
  6. Malware Master Engineer

    Messages:
    9,861
    Not all values are strings.
     
    • Informative Informative x 1
Thread Status:
This last post in this thread was made more than 31 days old.