User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 14

Thread: Future ZScript needs to allow NON-CONSTANT globals to be set

  1. #1
    Quest Builder Anarchy_Balsac's Avatar
    Join Date
    Nov 2005
    Posts
    751
    Mentioned
    11 Post(s)
    Tagged
    2 Thread(s)
    vBActivity - Stats
    Points
    2,592
    Level
    16
    vBActivity - Bars
    Lv. Percent
    64.01%

    Future ZScript needs to allow NON-CONSTANT globals to be set

    See topic.

    That is VERY annoying.

    For the non-programmer types, globals have a TON of advantages over locals. Locals have a small advantage if you want to reuse the name, or a big advantage if you want to have, say, one defined variable track multiple health bars or such. In all other circumstances, globals are more efficient. Some people cry foul that it makes your code "sloppy" or "unreadable", but that's stupid.
    Last edited by Anarchy_Balsac; 08-31-2015 at 01:54 PM.

  2. #2
    The Time-Loop Continues ZC Developer
    Gleeok's Avatar
    Join Date
    Apr 2007
    Posts
    4,826
    Mentioned
    259 Post(s)
    Tagged
    10 Thread(s)
    vBActivity - Stats
    Points
    12,958
    Level
    33
    vBActivity - Bars
    Lv. Percent
    26.12%
    ZScript actually does allow global variables and arrays. std.zh just doesn't define any since there is a limit of 256 currently. Also const int is basically the script version of a c #define in case anyone was wondering; can't recall if they obey normal scope rules though.
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

  3. #3
    Quest Builder Anarchy_Balsac's Avatar
    Join Date
    Nov 2005
    Posts
    751
    Mentioned
    11 Post(s)
    Tagged
    2 Thread(s)
    vBActivity - Stats
    Points
    2,592
    Level
    16
    vBActivity - Bars
    Lv. Percent
    64.01%
    Quote Originally Posted by Gleeok View Post
    ZScript actually does allow global variables and arrays. std.zh just doesn't define any since there is a limit of 256 currently. Also const int is basically the script version of a c #define in case anyone was wondering; can't recall if they obey normal scope rules though.
    IIRC, it was when I tried to set one to a value that I encountered the problem, and it said something about defining non-constant globals.

  4. #4
    Here lies mero. Died by his own dumbassitude.
    Join Date
    May 2011
    Posts
    929
    Mentioned
    102 Post(s)
    Tagged
    2 Thread(s)
    vBActivity - Stats
    Points
    5,527
    Level
    23
    vBActivity - Bars
    Lv. Percent
    13.96%
    Is it an int or float?
    As far as I know, only those work.

  5. #5
    Quest Builder Anarchy_Balsac's Avatar
    Join Date
    Nov 2005
    Posts
    751
    Mentioned
    11 Post(s)
    Tagged
    2 Thread(s)
    vBActivity - Stats
    Points
    2,592
    Level
    16
    vBActivity - Bars
    Lv. Percent
    64.01%
    TBH, I don't remember at this point. I just remember it was a restriction that I didn't have to deal with in C#.

  6. #6
    Here lies mero. Died by his own dumbassitude.
    Join Date
    May 2011
    Posts
    929
    Mentioned
    102 Post(s)
    Tagged
    2 Thread(s)
    vBActivity - Stats
    Points
    5,527
    Level
    23
    vBActivity - Bars
    Lv. Percent
    13.96%
    Here's the deal though a bunch of the types have a scope to one screen. So making a global pointer would cause it to return god only knows what when you change screens. It could be valid or not valid. There's no telling because ZASM is awful. Correct me if I'm wrong here @Gleeok .

  7. #7
    The Time-Loop Continues ZC Developer
    Gleeok's Avatar
    Join Date
    Apr 2007
    Posts
    4,826
    Mentioned
    259 Post(s)
    Tagged
    10 Thread(s)
    vBActivity - Stats
    Points
    12,958
    Level
    33
    vBActivity - Bars
    Lv. Percent
    26.12%
    I would of prefered globals of all types, actually. Error prone? Maybe. Smaller scripts and less typing? Sure.
    This post contains the official Gleeok seal of approval. Look for these and other posts in an area near you.

  8. #8
    Quest Builder Anarchy_Balsac's Avatar
    Join Date
    Nov 2005
    Posts
    751
    Mentioned
    11 Post(s)
    Tagged
    2 Thread(s)
    vBActivity - Stats
    Points
    2,592
    Level
    16
    vBActivity - Bars
    Lv. Percent
    64.01%
    Quote Originally Posted by Gleeok View Post
    I would of prefered globals of all types, actually. Error prone? Maybe. Smaller scripts and less typing? Sure.
    Exactly, besides which programming involves a LOT of trial and Error, and a LOT of bug aversions in the first place. I understand some gamers need their hands held, but by the time you're at the level of an actual programmer, it's just annoying.

  9. #9
    Here lies mero. Died by his own dumbassitude.
    Join Date
    May 2011
    Posts
    929
    Mentioned
    102 Post(s)
    Tagged
    2 Thread(s)
    vBActivity - Stats
    Points
    5,527
    Level
    23
    vBActivity - Bars
    Lv. Percent
    13.96%
    Me too Omae, me too. I would make backbeard if i could have global npcs.

  10. #10
    Quest Builder Anarchy_Balsac's Avatar
    Join Date
    Nov 2005
    Posts
    751
    Mentioned
    11 Post(s)
    Tagged
    2 Thread(s)
    vBActivity - Stats
    Points
    2,592
    Level
    16
    vBActivity - Bars
    Lv. Percent
    64.01%
    Quote Originally Posted by Tamamo View Post
    Me too Omae, me too. I would make backbeard if i could have global npcs.
    Backbeard eh? Is that a pirate with a really hairy back?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Armageddon Games is a game development group founded in 1997. We are extremely passionate about our work and our inspirations are mostly drawn from games of the 8-bit and 16-bit era.
Social