Changing of a string inside a model sometimes fails

Found a bug? Post information about it here so we can fix it!

Moderator: Moderators

Post Reply
User avatar
rrTea
Posts: 323
Joined: Sat Feb 15, 2014 9:54 am

Changing of a string inside a model sometimes fails

Post by rrTea » Thu Feb 05, 2015 12:17 am

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>

User avatar
VilleK
Site Admin
Posts: 1924
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK » Thu Feb 05, 2015 9:32 am

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

Post Reply