Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest WME version: WME 1.9.1 (January 1st, 2010) - download

Author Topic: Constant Values  (Read 3563 times)

0 Members and 1 Guest are viewing this topic.

Daniel

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 124
  • I'm *not* a llama!
    • View Profile
Constant Values
« on: April 30, 2004, 10:11:29 PM »

Is there a way to define literals or constant values in my code, something like to the #define statement in C/C++? The closest thing I found in the demos is the const.inc file but it uses global variables. To tell the truth, the global variables were good enough but then I implemented my "New Game" feature in my Main Menu that makes use of the new Game.Reset() method. Since my constants are all global variables, Game.Reset() wipes them all to nulls so my only workaround is to make some InitConstants() functions to set values to all my constants (including DI_UP, DI_UPRIGHT, etc.) and that seems a bit strange. Is there another way?
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Constant Values
« Reply #1 on: May 01, 2004, 07:28:11 AM »

I can't think of any other way. But it's a good point, it didn't occure to me, since the constants in standard WME scripts are #included in every script, therefore they're restored immediately after a new script is execuded. Still, a "const" keyword preventing global variables from being deleted by Game.Reset() would be a good addition...
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

MMR

  • Global Moderator
  • Frequent poster
  • *
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 349
  • http://mmrdeveloper.wordpress.com/
    • View Profile
    • TinyWME
Re: Constant Values
« Reply #2 on: May 01, 2004, 02:30:09 PM »

Quote
Still, a "const" keyword preventing global variables from being deleted by Game.Reset() would be a good addition...

Yep, in the way C++ works. I thought about this some time ago.
Logged
 

Page created in 0.028 seconds with 23 queries.