Changing of a string inside a model sometimes fails

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

Moderator: Moderators

User avatar
rrTea
Posts: 296
Joined: Sat Feb 15, 2014 9:54 am

Changing of a string inside a model sometimes fails

Postby 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 = &quot;Hello!&quot;;"/>
    <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 (&quot;ReactorString received: &quot; + MessageString);"/>
      </OnSpawn>
    </Model>
    <Model Name="ReactorNumber">
      <Definitions>
        <Variable Name="MessageNumber" Type="1"/>
      </Definitions>
      <OnSpawn>
        <ZExpression Expression="trace (&quot;ReactorNumber received: &quot; + intToStr(MessageNumber) );"/>
      </OnSpawn>
    </Model>
  </Content>
</ZApplication>

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

Postby 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


Return to “Bug reports”

Who is online

Users browsing this forum: No registered users and 3 guests