Variable "translation" in Actor clashes with Translation str

Sun Mar 17, 2019 3:27 pm

Tried making a colored lensflare that changes sprite depending on master's translation.
This doesn't work:

Code:
Class BD_PlasmaFlare : Actor
{
Default {
   +NOINTERACTION
   renderstyle "Add";
   alpha 0.4;
   scale 0.1;
   }
states
   {
   Spawn:
      LENB A 0 NoDelay {
         if (master && master.translation == Translation.GetId("GreenPlasma"))
            sprite = GetSpriteIndex("LENG");
         A_Warp(AAPTR_MASTER);
         }
      #### A 1 bright {
         if (!master)
            self.destroy();
         }
      wait;
   }
}


Error: Invalid expression on left hand side of GetID


This works, though:

Code:
class Extensions {
    static int GetTranslationID (name transname) {
        return Translation.GetID (transname);
    }
}

Class BD_PlasmaFlare : Actor
{
Default {
   +NOINTERACTION
   renderstyle "Add";
   alpha 0.4;
   scale 0.1;
   }
states
   {
   Spawn:
      LENB A 0 NoDelay {
         if (master && master.translation == Extensions.GetTranslationID("GreenPlasma"))
            sprite = GetSpriteIndex("LENG");
         A_Warp(AAPTR_MASTER);
         }
      #### A 1 bright {
         if (!master)
            self.destroy();
         }
      wait;
   }
}

Re: Variable "translation" in Actor clashes with Translation

Tue Mar 19, 2019 12:56 pm

This isn't really a bug. Unfortunately I do not have a good idea how to resolve this clash in a simple fashion.