Results 1 to 10 of 10

Thread: About no variables. No comparison of non-constant values.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default About no variables. No comparison of non-constant values.

    I am sorry I just need to recheck this even short answer such as NO TO ALL will suffice.

    I have read that M2TW scripting engine does not support variables. No comparison of non-constant values and etc...

    This is basically true and unchanged right?


    This means I couldn't declare a variable of type INTEGER , STRING, FLOAT or ARRAY and then assign them values I want after performing calculations and different type of mathematical operations or is was that meant for only more complex variables [though each variable of type string is already complex since it is made of characters and arrays are even more complex (nvm that strings are character arrays )but that is not what I meant ]
    How many of those variables could I declare (not number of types but total of variables) and does anyone know at how many do you start to notice significant slowdown (but then again number could be ZERO).
    Could M2TW engine be made to change those declared variables while player is playing the game, store new needed values and then retrieve and perform mathematical operations I pre-programmed? (provided I could assign them of course ).

    Basically what I would like to know is how complex can an operations be and what type of variables can I declare inside campaign_script.txt and descr_strat.txt ORr ANY file I could edit or make and M2TW engine can use. To be accesed during gameplay and then executed via script from inside campaign_script.txt and descr_strat.txt files (and few others but for now even those 2 would suffice).

  2. #2
    Augustus Lucifer's Avatar Life = Like a beanstalk
    Patrician Citizen

    Join Date
    Aug 2006
    Location
    Mote of Dust
    Posts
    10,725

    Default Re: About no variables. No comparison of non-constant values.

    The scripting engine doesn't support variables, at least not in a programming sense. You can't say:

    monkey = 5 * cheese / 29
    cheese = 10

    if factionatwar
    cheese = 20
    elif factionatwar x 2
    cheese = 40
    else
    cheese = 10

    Nothing like that. Event counter and counters can provide some fleeting ability to store values, but variables and fetched parameters are unachievable.

  3. #3

    Default Re: About no variables. No comparison of non-constant values.

    Quote Originally Posted by Augustus Lucifer View Post
    The scripting engine doesn't support variables, at least not in a programming sense. You can't say:

    monkey = 5 * cheese / 29
    cheese = 10

    if factionatwar
    cheese = 20
    elif factionatwar x 2
    cheese = 40
    else
    cheese = 10

    Nothing like that. Event counter and counters can provide some fleeting ability to store values, but variables and fetched parameters are unachievable.
    Thank you that is precisely what I asked. It seems very limited unfortunately.
    One can only hope Creative Assembly releases free source code for ROME (yea right ) so we can do some really INTERESTING stuff with it .

  4. #4
    EarendilElenthol's Avatar Artifex
    Join Date
    Apr 2008
    Location
    The Netherlands
    Posts
    998

    Default Re: About no variables. No comparison of non-constant values.

    I haven't seen a variable in a .txt file declared as INTEGER , STRING, FLOAT or ARRAY. In .xml files most are. But the .xml files are pretty specific and I dont think you can add something new there and get it working.

  5. #5

    Default Re: About no variables. No comparison of non-constant values.

    Quote Originally Posted by EarendilElenthol View Post
    I haven't seen a variable in a .txt file declared as INTEGER , STRING, FLOAT or ARRAY. In .xml files most are. But the .xml files are pretty specific and I dont think you can add something new there and get it working.
    Thank you .

  6. #6
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,851
    Blog Entries
    10

    Default Re: About no variables. No comparison of non-constant values.

    You can only declare counters, which basically are integers.

    You cannot multiply/divide them, but you can add/subtract and compare them.

  7. #7
    EarendilElenthol's Avatar Artifex
    Join Date
    Apr 2008
    Location
    The Netherlands
    Posts
    998

    Default Re: About no variables. No comparison of non-constant values.

    Am I right that most bonuses in the EDB are integers as well ? It seems I can use positive and negative values, but 3.9 it will read as 3

  8. #8

    Default Re: About no variables. No comparison of non-constant values.

    Quote Originally Posted by GrnEyedDvl View Post
    You can only declare counters, which basically are integers.

    You cannot multiply/divide them, but you can add/subtract and compare them.
    I wonder what genius thought it would be fun to deprives us of multiplication and division operations, I guess they taught extra work will do us good eh..

    AT least with allowing ONLY integers they can say it saves RAM but it also makes us more .

  9. #9
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,851
    Blog Entries
    10

    Default Re: About no variables. No comparison of non-constant values.

    Quote Originally Posted by EarendilElenthol View Post
    Am I right that most bonuses in the EDB are integers as well ? It seems I can use positive and negative values, but 3.9 it will read as 3
    Correct, integers only.


    Quote Originally Posted by Grimblade View Post
    I wonder what genius thought it would be fun to deprives us of multiplication and division operations, I guess they taught extra work will do us good eh..

    AT least with allowing ONLY integers they can say it saves RAM but it also makes us more .
    Somewhere around here is a really long rant by me about this and other issues. Believe me I feel your pain.

  10. #10
    alhoon's Avatar Comes Rei Militaris
    Join Date
    Apr 2008
    Location
    Chania, Greece
    Posts
    24,233

    Default Re: About no variables. No comparison of non-constant values.

    Me too. I can't understand why they made their pseudo-programming language like this. I haven't studied computer science but I don't think it would be THAT hard to implement the "X = 3 * Y" comparing to the things we could do with this.
    alhoon is not a member of the infamous Hoons: a (fictional) nazi-sympathizer KKK clan. Of course, no Hoon would openly admit affiliation to the uninitiated.
    "Angry Uncle Gordon" describes me well.
    _______________________________________________________
    Beta-tester for Darthmod Empire, the default modification for Empire Total War that does not ask for your money behind patreon.
    Developer of Causa Belli submod for Darthmod, headed by Hammeredalways and a ton of other people.
    Developer of LtC: Random maps submod for Lands to Conquer (that brings a multitude of random maps and other features).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •