User Tag List

Results 1 to 2 of 2

Thread: Basic Python Object Help

  1. #1
    Forum Moderator Multimedia Fusion 2 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export ModuleXNA Export Module
    DizzyDoo's Avatar
    Join Date
    Oct 2006
    South England
    0 Post(s)
    0 Thread(s)

    Basic Python Object Help

    Quote Originally Posted by Mathias
    Using the extension should be straight forward, and shouldn't really require documentation
    Well, apparently I'm not smart enough to pick it up myself. Luckily then, I'm fine with looking stupid and asking questions!

    Running Python files works wonderfully, I'm very much enjoying that control. What I don't know how to do yet is run a function (with arguments) and get the return value in MMF2.

    So what events/actions do I need to run this function from the python file:

    def echo(string):
        return string
    Making games at Cranktrain.
    @MattLuard on Twitter.

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleSWF Export ModuleXNA Export Module
    Fusion 2.5 (Steam)
    Mathias's Avatar
    Join Date
    Jun 2006
    Copenhagen, Denmark
    9 Post(s)
    0 Thread(s)

    Re: Basic Python Object Help

    Well, have a look at the example file "python_functions.mfa". Basically, you can either register the function, or call it by name:
    import interface
    def my_echo_function(string):
        return string
    def echo(string):
        return string
    and in your MFA, first run the script, then add a string argument (Add parameter String$("Python object", "Hi!")), then call either the registered function (Call registered function "echo") or the global function (Call global "echo"). To get the return value, you simply do StringValue$("Python object", Return( "Python object", 0)), and that's about it

Similar Threads

  1. Python object
    By Mathias in forum Released Extensions
    Replies: 12
    Last Post: 8th August 2022, 06:54 AM
  2. Python not working correctly when exported (and Python with iOS)
    By iOSC in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 20th April 2013, 12:10 PM
  3. BASIC object
    By markymoniom in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 5th February 2013, 09:51 PM
  4. Python object bug with long path.
    By iOSC in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 27th March 2012, 07:49 AM
  5. Python Object - Get Python Variables from MMF2
    By DizzyDoo in forum Python Scripting
    Replies: 2
    Last Post: 26th December 2011, 01:57 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