User Tag List

Results 1 to 9 of 9

Thread: Use string() command to determine global value.

  1. #1
    Clicker Fusion 2.5Android Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    MasochisticGamer's Avatar
    Join Date
    Nov 2012
    Location
    Gravois Mills. MO USA
    Posts
    76
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Use string() command to determine global value.

    I'll try to explain this the best I can. Basically, the game I'm working on has 8 slots for weapons. The player can map which weapon goes to which slot (allows for player customization). My question to you is, can I use the built in () commands to pick which global value to read?

    Global Values:
    CurrWeapon (This will determine which slot is active)
    Weapon1
    Weapon2
    Weapon3
    Weapon4
    Weapon5
    Weapon6
    Weapon7
    Weapon8

    If I were to select "Compare Two General Values" and add this into the first box:

    "Weapon"+string(CurrWeapon)

    Would this read the correct global value? I'd really like to avoid making copies of the same weapon events for each slot. My thinking is that this would consolidate the events into one set, rather than 8.

  2. #2
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export ModuleXNA Export Module
    ProdigyX's Avatar
    Join Date
    Jan 2011
    Posts
    1,197
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    in terms of syntax where you could do something like 'Global Value A', no.

    Global Values cannot be referenced by strings; only by integers (with Global Value A as 1).
    So you can try to reference the value of the respective global value by an integer via "Global Value( >Enter number here< )"

  3. #3
    Clickteam Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Simon's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    2,735
    Mentioned
    65 Post(s)
    Tagged
    3 Thread(s)
    You can pick a global value using a calculation, via an integer... so you could turn a string containing an integer into an integer to use here.

  4. #4
    Clicker Fusion 2.5Android Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    MasochisticGamer's Avatar
    Join Date
    Nov 2012
    Location
    Gravois Mills. MO USA
    Posts
    76
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Use string() command to determine global value.

    Simon, can you show me an example?

  5. #5
    Clickteam Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Simon's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    2,735
    Mentioned
    65 Post(s)
    Tagged
    3 Thread(s)
    I have just gotten into bed and switched PC off... I'll post one tomorrow if noone else has by then

    IIRC, when you go to retrieve or set a global, next to the drop-down box there should be a "calc" button to press. In there you can enter a number starting from 1 (I think, check that - it'll say in the window title). So Global Value A will be 1, B = 2 and so on. If you convert a string "weapon1" to a number using val("weapon1") you'll be able to reference your globals that way... if the first weapon in the list is the 5th global value (E) just add 4 to the val() to offset the index.

    I hope that all makes sense

  6. #6
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Tuna's Avatar
    Join Date
    Feb 2008
    Location
    Central Texas
    Posts
    1,853
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    If I understand what you're saying you can do this:

    Right$(CurrentWeapon,1) will return "1"

    so you want to turn that string "1" into a value:

    Val(Right$(CurrentWeapon,1)) which returns 1 (notice no quotes... this is an integer, not a string)

    EDIT: Simon, I've never tried using Val("Weapon1")... are you sure this will return 1? if so, that's awesome.

    EDIT2: Simon - testing shows that Val("Weapon1") returns 0... Val(Right$("Weapon1",1)) returns 1



    Hope this helps

  7. #7
    Clicker Fusion 2.5Android Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    MasochisticGamer's Avatar
    Join Date
    Nov 2012
    Location
    Gravois Mills. MO USA
    Posts
    76
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Use string() command to determine global value.

    So let me see if I'm on the right page here:

    Player 1 Pressed Fire
    Global Value val(Right$(CurrWeapon,1) + Offset = 2
    ~Shoot "Bullet" in direction of Player

    Does that sound about right? (I'll try it when I get home, as I lack PC access at work.)

  8. #8
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Tuna's Avatar
    Join Date
    Feb 2008
    Location
    Central Texas
    Posts
    1,853
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Sorry i didn't see your reply earlier - it seems about right but I'm not sure what your + Offset is supposed to do. I assume by now you're home and you've tried it... did it work?

  9. #9
    Clicker Fusion 2.5Android Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    MasochisticGamer's Avatar
    Join Date
    Nov 2012
    Location
    Gravois Mills. MO USA
    Posts
    76
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Sadly, no. This method didn't work. I did, however, found a simpler way to make this work. Example:

    CurrWeapon: (Which slot is currently selected)
    Weapon1:
    Weapon2:
    Weapon3:
    Etc.

    ~CurrWeapon = <Insert Value Here>
    ~Only one action when event loops
    >>Set Alterable Value W (Player) to <Corresponding Global Value>

    Then, you can have the player fire bullets based on Alterable Value W (This could also be a hidden counter, but I used alterable values for the test).

    Example:

    ~Player pressed fire 1
    ~Alterable Value W (Player) = 1
    >>Shoot "Pea Shooter" in direction of Player

    ~Player pressed fire 1
    ~Alterable Value W (player) = 2
    >>Shoot "Spreader" in direction of Player

    This gives me the function I want without all the headaches. Perhaps this would help others as well.

Similar Threads

  1. Using a Global Value within Global String?
    By ratty in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 20th August 2013, 12:32 PM
  2. Add to a global string
    By wizlore in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 18th September 2011, 05:21 PM
  3. [BUG] Global Value and Global String the same name
    By LB in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 18th January 2010, 09:11 PM
  4. command for current directory string?
    By Dave in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 13th February 2008, 10:40 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
  •