User Tag List

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

Thread: Choosing global variables with a calculation.

  1. #1
    No Products Registered

    Join Date
    May 2008
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Choosing global variables with a calculation.

    I'm attempting to set up a procedure that will retrieve a value from an ini file, then get the global variable with that value and set it to a given number.

    I'm certain that the procedure is being activated, because if I simply set it to change, say "global variable 4" to 1, it'll work just fine. However, when I tell it to set "global variable (value of ini)" to 1, it doesn't work.

    Am I going about this the wrong way, or can it not be done at all?

  2. #2
    Clicker Fusion 2.5 Developer

    Join Date
    Jun 2006
    Location
    Hampshire, UK
    Posts
    963
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Choosing global variables with a calculation.

    The easiest way would be to use an array and set the Y position to the value you want to change. That's what i'd do.

  3. #3
    Forum Moderator Fusion 2.5 DeveloperHTML5 Export ModuleiOS Export ModuleSWF Export Module
    DavidN's Avatar
    Join Date
    Jun 2006
    Location
    Boston, MA, USA
    Posts
    4,044
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Choosing global variables with a calculation.

    The "Set global variable (result of calculation)" action chooses the index of the global variable to set based on the result of the calculation - it doesn't look for a global variable that already has the result of that calculation. I think that's where you're going wrong, reading your description, at least.

    What is it you're trying to do, on a more general level? Perhaps there's an easier approach.

  4. #4
    No Products Registered

    Join Date
    May 2008
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Choosing global variables with a calculation.

    Quote Originally Posted by DavidN
    The "Set global variable (result of calculation)" action chooses the index of the global variable to set based on the result of the calculation - it doesn't look for a global variable that already has the result of that calculation. I think that's where you're going wrong, reading your description, at least.
    No no.

    Let's say that the value I've set in the ini file is 5. When I run the procedure, I want it to get, as you say, the global variable with the index of 5, not the global variable that has a value of 5. Sorry that wasn't clear enough.

    What I'm basically doing here is setting up a dialogue system, and certain variables may need to be set when a conversation is finished. For example, if someone gives you a key, it should set the variable "playerHasKey" to 1 when the conversation's over.

    The conversations are stored in an ini file, and I'm attempting to set it up so that if there's a "set variable" line in the current conversation group, it'll set the variable with the index of (value) to a number, usually 1.

  5. #5
    No Products Registered

    Join Date
    May 2008
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Choosing global variables with a calculation.

    Upon further investigation, the feature doesn't seem to be working at all.

    I can literally declare an "Always" event at the very start of the editor telling the program to set a global value and simply put "4" (or any number, minus the quotes of course) into the expression window for calculating which value to set...and yet it doesn't work. Global value 4 remains unchanged.

    However, if I select the name of the global value from the drop-down list, it works perfectly.

    Am I missing something here? The index of a global value is the number that comes before its name, right?

  6. #6
    Clicker Fusion 2.5 Developer

    Join Date
    Jun 2006
    Location
    Hampshire, UK
    Posts
    963
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Choosing global variables with a calculation.

    I've never used the feature you're using, but i know as a fast my suggestion workds perfectly, as i used it regularly.

  7. #7
    No Products Registered

    Join Date
    May 2008
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Choosing global variables with a calculation.

    I'll give your solution a try if the way I'm doing it now isn't possible, but in all honesty I'd prefer to simply use global values. They're easier to keep track of given that you can name them, and if you change frames you don't need to worry about them transitioning properly.

  8. #8
    Clicker Multimedia Fusion 2

    Join Date
    Jun 2007
    Location
    Suffolk, UK
    Posts
    435
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Choosing global variables with a calculation.

    Quote Originally Posted by Meanderer
    I'd prefer to simply use global values. They're easier to keep track of given that you can name them, and if you change frames you don't need to worry about them transitioning properly.
    If you can't get your original way to work, you could use the named variable object. That will allow you to name your values and you can make it global to your app

  9. #9
    No Products Registered

    Join Date
    May 2008
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Choosing global variables with a calculation.

    Fair enough.

    Isn't this basically a bug, though? I mean, unless I'm completely barking up the wrong tree here, the function allowing you to choose a global value based on an expression just...isn't working. At all. Even with the simplest expression possible, that being a single integer.

    EDIT: OK. This has actually been my error from the beginning.

    When you look at the list of global values, they've all been numbered, starting from 0. I naturally assumed that these were the indexes of the values, but apparently they aren't, and in actual fact the numbering starts at 1. So basically the reason it wasn't working is that I was altering the values that were 1 index lower than the ones I actually wanted to alter.

    Sorry, folks. Thanks for the help anyway, though.

  10. #10
    Clicker Multimedia Fusion 2

    Join Date
    Jun 2007
    Location
    Suffolk, UK
    Posts
    435
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Choosing global variables with a calculation.

    Just did a check look and it seems the index for global values using the expression is 1-based rather than the 0-based that they are shown as in the app properties.
    Seems to be for both setting the global value and also retrieving it's value

    Edit: Opps, you've already found it

Page 1 of 2 1 2 LastLast

Similar Threads

  1. MMF2 - Global Variables
    By droberson in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 27th March 2010, 05:54 PM
  2. Pylacewing - global variables
    By izac in forum Lacewing
    Replies: 5
    Last Post: 8th February 2010, 12:16 PM
  3. global variables
    By bufferOverflow in forum Extension Development
    Replies: 2
    Last Post: 19th June 2007, 08:01 AM
  4. Global Variables
    By stuckboy in forum Multimedia Fusion 2 - Technical Support
    Replies: 25
    Last Post: 17th July 2006, 03:33 PM

Posting Permissions

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