User Tag List

Page 2 of 2 FirstFirst 1 2
Results 11 to 15 of 15

Thread: Using expressions in strings?

  1. #11
    No Products Registered

    Join Date
    Aug 2006
    Posts
    71
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Using expressions in strings?

    Sorry to be a bother but how would I do this? I tried looking at the help and example but I'm pretty much a maroon on terms like "functions" and "operators" and such.

  2. #12
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Jun 2006
    Location
    England
    Posts
    3,512
    Mentioned
    3 Post(s)
    Tagged
    1 Thread(s)

    Re: Using expressions in strings?

    If you contact raytrace I believe he made a Lua calculator example a while back.

    Example using the expression evaluator object (requires ExpEval Object and two Edit Boxes):
    Code:
    * (Storyboard) Start of frame
    - (ExpEval Object) : Define MMF Operator, "seconds", 0 params, don't evaluate
    - (ExpEval Object) : Define MMF operator, "random", 1 params, evaluate
    
    * (Keyboard and mouse) Upon pressing "Enter"
    - (ExpEval Object) : Evaluate "result="+Edittext$("Edit Box")
    - Edittext$("Edit Box 2") : Set text to Evaluate$( "ExpEval Object", "result")
    
    * (ExpEval Object) On Function "seconds"
    - (ExpEval Object) : Return str$(seconds)
    
    * (ExpEval Object) On Function "random"
    - (ExpEval Object) : Return Str$(Random(Val(Evaluate$( "ExpEval Object", "p1"))))
    ...Then you can type 7*seconds()+random(10+1) or random(seconds())/2 into edit box 1 and press enter, and it'll set edit box 2 to the evaluated result. Instead of having functions to retrieve the number of seconds, you can have functions to retrieve object values.
    .:::.Joshtek.:::.

  3. #13
    Clicker 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)

    Join Date
    Nov 2012
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How did you get the random one to work? For me, it always shows "Error"...

    expeval_random.mfa

  4. #14
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Jun 2006
    Location
    England
    Posts
    3,512
    Mentioned
    3 Post(s)
    Tagged
    1 Thread(s)
    In my original code I think "Define MMF Operator" should have read "Define MMF Function".

    To get expeval_random.mfa to work you need to:
    1) In Event 1, instead of the current ExpEval action use "Define MMF Function" ("random", 1, 1)
    2) In Event 2, instead of the current code use an action on the ExpEval object to evaluate "result=" + Edittext$( "Edit Box" ), then return MMF value of Evaluate$( "ExpEval Object", "result" ). Make sure the two events are in the right order.

    There might be an easier way, but the reason it is a bit convoluted is because the code doesn't allow you to call a MMF Function from within any old expression, you have to do it inside the ExpEval's dedicated action.

    In the future, if you want to debug you could add a list object then add an ExpEval event "On error (immediate)" then add as its actions add as text to the list the ExpEval objections's last error string.
    .:::.Joshtek.:::.

  5. #15
    Clicker 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)

    Join Date
    Nov 2012
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Works great, thanks.

Page 2 of 2 FirstFirst 1 2

Similar Threads

  1. How to use quotes in expressions without them ending strings?
    By Pecon7 in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 30th October 2011, 12:09 AM
  2. Scan Global Strings and Other strings
    By Ausomeman in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 19th May 2010, 04:01 PM
  3. FastFunction not returning strings in expressions
    By jdv in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 9th April 2009, 02:42 PM
  4. strings and expressions
    By taciturn in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 22nd September 2008, 02:37 PM
  5. Using Global Strings embedded in larger strings
    By Mudstick in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 12th May 2008, 01:23 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
  •