Author Topic: environment variable  (Read 885 times)

treba

  • Guest
environment variable
« on: 9 May 2012, 15:24:50 »
hey everyone!

i want to ask if it's possible to set a Lua environment variable in scenarios that indicates that the scenario is played in mg or gae. this would make it much easier to make scenarios work on both engines.

MuwuM

  • Ornithopter
  • *****
  • Posts: 426
  • No Game without Move(ment)
    • View Profile
    • MuwuM - Lexicons
Re: environment variable
« Reply #1 on: 9 May 2012, 17:37:28 »
I assume that would not be so easy, because you would need different xml types, a work-arround would be to set a variable to 1 in the <globals> tag of megaglest and ask in startup, wether it's set, or not.

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: environment variable
« Reply #2 on: 9 May 2012, 18:57:33 »
I assume that would not be so easy, because you would need different xml types, a work-arround would be to set a variable to 1 in the <globals> tag of megaglest and ask in startup, wether it's set, or not.
That wouldn't work well, though, as it would only stop MG-only scenarios from playing on GAE, but not the other way around. Not sure what you mean by "you would need different xml types".
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

MuwuM

  • Ornithopter
  • *****
  • Posts: 426
  • No Game without Move(ment)
    • View Profile
    • MuwuM - Lexicons
Re: environment variable
« Reply #3 on: 9 May 2012, 20:43:52 »
I assume that would not be so easy, because you would need different xml types, a work-arround would be to set a variable to 1 in the <globals> tag of megaglest and ask in startup, wether it's set, or not.
That wouldn't work well, though, as it would only stop MG-only scenarios from playing on GAE, but not the other way around. Not sure what you mean by "you would need different xml types".
in Globals:
Code: [Select]
megaglest = 1
in startup:
Code: [Select]
megaglest = megaglest or  0

if megaglest == 1 then
     -- do something for MG
else
     -- do something for GAE
end

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: environment variable
« Reply #4 on: 10 May 2012, 01:25:27 »
I assume that would not be so easy, because you would need different xml types, a work-arround would be to set a variable to 1 in the <globals> tag of megaglest and ask in startup, wether it's set, or not.
That wouldn't work well, though, as it would only stop MG-only scenarios from playing on GAE, but not the other way around. Not sure what you mean by "you would need different xml types".
in Globals:
Code: [Select]
megaglest = 1
in startup:
Code: [Select]
megaglest = megaglest or  0

if megaglest == 1 then
     -- do something for MG
else
     -- do something for GAE
end
Ah, I see.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert