Page 1 of 1

Changing of a string inside a model sometimes fails

Posted: Thu Feb 05, 2015 12:17 am
by rrTea
Setting the string inside the model sometimes fails - same thing works perfectly with integers... The console output of the example below reads:

ReactorString received:
ReactorNumber received: 10000

Code: Select all

<?xml version="1.0" encoding="iso-8859-1" ?> 
<ZApplication Name="App" Caption="ZGameEditor application" FrameRateStyle="2" FixedFrameRate="60" NoSound="1"> 
  <OnLoaded> 
    <ZExpression Expression="MessageString = "Hello!";"/> 
    <SpawnModel Model="ReactorString"/> 
    <ZExpression Expression="MessageNumber = 10000;"/> 
    <SpawnModel Model="ReactorNumber"/> 
  </OnLoaded> 
  <Content> 
    <Model Name="ReactorString"> 
      <Definitions> 
        <Variable Name="MessageString" Type="2"/> 
      </Definitions> 
      <OnSpawn> 
        <ZExpression Expression="trace ("ReactorString received: " + MessageString);"/> 
      </OnSpawn> 
    </Model> 
    <Model Name="ReactorNumber"> 
      <Definitions> 
        <Variable Name="MessageNumber" Type="1"/> 
      </Definitions> 
      <OnSpawn> 
        <ZExpression Expression="trace ("ReactorNumber received: " + intToStr(MessageNumber) );"/> 
      </OnSpawn> 
    </Model> 
  </Content> 
</ZApplication>

Posted: Thu Feb 05, 2015 9:32 am
by VilleK
Hi,

The problem is that the cloned model does not clone the string value. Same problem happens with vec/mat variables. I'll see if I can fix it.

/V