User Tag List

Results 1 to 9 of 9

Thread: Import variable value to xLua function

  1. #1
    No Products Registered

    Join Date
    May 2015
    Location
    Poland
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Import variable value to xLua function

    I need to use a custom function with xLua object wich needs some elements from other objects.
    O course, I would use "Push variable into lua function" but in this case will not help me.

    What I want achieve is something like this:

    LUA syntax

    Code:
    CONST_BASE_HP = 500
    
    function ComputeHP()
    	return tonumber(math.abs(math.ceil(CONST_BASE_HP + (CONST_BASE_HP * Active1.SomeGlobalValue))))
    end
    Also antother question:

    If there is no way to use sprite objects directly in xLua and the only
    way is use "Push Variable" , how the heck clear function argument(s) if i need this one with another object?

  2. #2
    Clickteam Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleInstall Creator Pro
    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)
    BartekB's Avatar
    Join Date
    Aug 2013
    Posts
    667
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    In Fusion, you can do:

    In Lua>>
    Active(5)

    xLua: On Function "Active">>
    Push integer Return Value: Alterable Value (Integer Parameter 1)

    or, even better, have active names in the first alterable string and do this:

    In Lua>>
    Active("Player",5)

    xLua: On Function "Active">>
    For Each Loop of all Actives (Group perhaps?)


    On For Each Loop of Group.Actives>>
    +If Group.Active's Alterable String A == Lua String Parameter 1
    Push Integer Return Value: Alterable Value (Integer Parameter 2)


    If that's not what you're looking for, then I probably misunderstood your question.
    - BartekB, a.k.a Uppernate
    Join the Click Converse Discord! - https://discord.gg/R3WuvF3mHr

  3. #3
    No Products Registered

    Join Date
    May 2015
    Location
    Poland
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, but I think you misunderstod my question, let me refrase question:

    Is there a way to put global value of any object inside xLua function without pushing variable as functions argument?
    (I made a photo what I', thinking)

  4. #4
    Clickteam Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleInstall Creator Pro
    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)
    BartekB's Avatar
    Join Date
    Aug 2013
    Posts
    667
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    To do that, you'll need to constantly make a list and write things into it, which is probably worse than using a function.
    If you really want to do this, I can explain how to create what you want.

    fyi, "dx_bar.progress" is basically a list called dx_bar that has the integer called progress.
    - BartekB, a.k.a Uppernate
    Join the Click Converse Discord! - https://discord.gg/R3WuvF3mHr

  5. #5
    No Products Registered

    Join Date
    May 2015
    Location
    Poland
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Which leads to conclusion... Best option is using "LUA function -> Push /type of var/ parameter"

  6. #6
    Clickteam Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleInstall Creator Pro
    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)
    BartekB's Avatar
    Join Date
    Aug 2013
    Posts
    667
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    Yes, Push Return Value is the easiest and probably least memory-consuming event you can do.
    - BartekB, a.k.a Uppernate
    Join the Click Converse Discord! - https://discord.gg/R3WuvF3mHr

  7. #7
    No Products Registered

    Join Date
    May 2015
    Location
    Poland
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, another question but I bet what you tell me...

    xLua -> Call Lua function ("xLua", "function_name")

    Which one will be more safe to eun this on Event?

    a) Timer -> Periodic Event ( val )
    b) Always

  8. #8
    Clickteam Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleInstall Creator Pro
    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)
    BartekB's Avatar
    Join Date
    Aug 2013
    Posts
    667
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    Depends how much you want it updated, you can use Always for the function to be ran 60 times.
    - BartekB, a.k.a Uppernate
    Join the Click Converse Discord! - https://discord.gg/R3WuvF3mHr

  9. #9
    No Products Registered

    Join Date
    May 2015
    Location
    Poland
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well their a very simple functions, calculating player values such as HP, MP etc.

Similar Threads

  1. How to Get result of function embedded in xLua?
    By Lazarus1988 in forum Fusion 2.5
    Replies: 1
    Last Post: 21st September 2015, 03:06 PM
  2. Function Eggtimer problem // Power Function for MMF2 Android?
    By ogrgkyle in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 24th May 2013, 03:17 AM
  3. Global variable = alterable variable
    By Jibs in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 1st November 2011, 08:54 PM
  4. TGF_MMF Notion Variable, “Système Variable”.
    By SpringUp in forum File Archive
    Replies: 2
    Last Post: 13th March 2009, 12:43 AM
  5. MMF2 Frameditor import function expansion!!!
    By Maxx_Games in forum Multimedia Fusion 2 - Technical Support
    Replies: 22
    Last Post: 14th September 2006, 02:56 AM

Posting Permissions

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