User Tag List

Results 1 to 5 of 5

Thread: [Tutorial] Using .NET in your App.

  1. #1
    Clicker Fusion 2.5
    Fusion 2.5 (Steam)
    BackStaged's Avatar
    Join Date
    Aug 2010
    0 Post(s)
    0 Thread(s)

    [Tutorial] Using .NET in your App.

    first: I'm French, so sorry for some bizzarre english sentences (i NOT use any translator!)

    [size:23pt][Tutorial] Using .NET in yours Applications or Games
    created with Multimedia Fusion 2 (STANDARD/DEV).[/size]
    [color:#999999] Yesterday, i was not able to post, because, the forum was unnaccessible (well.., yesterday.. rather soon this morning ) DNS could'nt response.
    BUT afterall, it not so bad, because, i had corrected a lot some MMF2 logic error (of my sample) !

    So.. Good reading![/color]

    Well, i do not think it's the most complete tutorial what i've wrote, coz, it's certainly not the case, therefore, i will try learn to you to using an extension, which can opening the door of .NET in your applications, you should know that i spend a lot of time in writing of this tutorial, and it is not a stupid copy/paste since i wrote myself.

    [size:14pt][color:#CC33CC]0) .NET ?? What is this??
    1) Prerequisites
    2) Installation of .net Script
    3) Initialization of .net Script
    4) Your first script (development) in .NET
    5) Using MMF2 by and with .NET (via .net Script)
    6) Conclusion, what i can do made with .NET via .net Script ?
    7) Comment!

    [size:17pt]0) .NET ?? What is this??[/size]

    .NET is a framework, developed by Microsoft and used for innumbrables applications.
    The Framework .NET is a free-download on the Microsoft's website or included (the most way) in some new recents softwares.

    .NET is a framework.. But.. Concretely, what's a framework?
    A Framework is a collection of libraries/functions which offer a large panoply of possibilities.

    Of course, one more time, you don't CERTAINLY using all it contents.

    .NET is always first attention by Microsoft, in this case, the power give you their hands, but also communauty (essentially english) is really active.

    .NET is the framework needed now in your panoply of Game or Soft Maker.

    In addition of .NET, C# (CSharp) and (Visual Basic) allow to develop with all flexibility which offered by .NET.

    Personnally, i have no gried against Visual Basic, but, i just found a less intuitive than CSharp.

    So, my tutorial, don't talk more of Visual Basic. (sorry).
    Before all things, you must equip you, undestanding the basis of .NET (but globally, my tutorial don't explain all the speficicities of .NET, over the Internet already exists some most complete tutorials on .NET)

    No no, me, i'm talking to you about the way of using .NET in MMF2 (Standard as Developper).

    (This tutorial can be also for Multimedia Fusion 2 DEVELOPER)

    [size:17pt]1) Prerequisites[/size]

    Prerequisites for develop in .NET under MMF2 are *lights*.

    1) A legal version (of course) and NOT A DEMO version of Multimedia Fusion 2 (the Developer version allow you to go more far complex system-coding grace to MDI (Multiple Document Interface), but the Standard version should be ok for all individuals developers).
    2) A recent version of FRAMEWORK .NET which must installed on your computer.
    3) The extension which opening doors of .NET in MMF2.
    4) Patience, Desire (of learning..), Drinks, Pizza..

    Ok, ready? Let's go!

    I think you have already a legal version of MMF2 and NOT A DEMO, so, well, you're ok for this point!

    For dispose of a recent version of Framework .NET (generally, it is, seeing Windows updating it automatically)
    so, if not, go to this link and follow recommandations for installing it:
    (take a equal or major version to 4)
    Note that here:
    it exist free AND officially legals versions of Microsoft Visual Studio Express Edition 2010.
    (personnally, i'm fixed to 2008, because it's implicate to uninstall all the ancient versions).

    Once Framework .NET is installed, (rebooting computer was perhaps necessary), we go to download the extension .NET.
    But before..
    A LESS OF history: .net Script was developed by : Greyhill, a huge thanks for him/her work!
    And so, history is finished, download extension:
    Official Page of l'extension: -- seems point to ClickTeam --
    See yourself:

    Perso, a little party with friends for decompressing, it work also, but you probably 'working nothing' if you want my opinion.
    Stand aswell to coca/water/gazeous water and YumYum (in case where you want eating something lol).

    [size:17pt]2) Installation of .net Script[/size]

    Warning, DO NOT INSTALL THIS EXTENSION VIA "Fusion Updater" it not make the registering of Scintilla's Assembly's DLLs which that required by the extension.

    The most easy way is surely to double-click on executable (installer) of .net Script and following the instructions.
    For that, i let you do this, you're not assisted persons right ?

    [size:17pt]3) Initialization of .net Script[/size]

    For initializing .net Script, nothing of difficult, this extension (as all others) must be added as object!
    Then create a new application project in Multimedia Fusion 2.
    Create a new frame
    AND add ".net Script" object on the frame.

    Now, you have logically the ".net Script" interface window beside yours eyes.
    ** in case of bug/crash due to assembly's erros of "Scintilla", reinstall the extension, the installation was erroned.

    So, in this interface, it is not with your mouse will you can coding.
    IN fact, it's as if you're in C# interface
    (you can take a look, if you want using Visual Basic code instead CSharp code, just tick on "").

    And with C#.. There is a lot things to do.
    But you must code all from the scratch.
    Ah, yes, you got it, C#.NET is a true programmation language, but, you must know, it's not so easy to learn instead Multimedia Fusion 2, hehe.

    Well, So, the fear passed? Are you ok?
    Drink a large glasse of fresh water and prepare yourself because,

    In the editable zone under ".net Code"..
    It's in C#.NET which you must code (or VB.NET if you tick on this option).

    [size:11pt] For start, the basis:[/size]

    a) In C#, we must define libraries to use, we calling this declarations.

    The only libraries i showing you will be : System, System.Windows, System.Windows.Forms, System.Text, System.Drawing, System.Collections.Generic, MMFInterface/MMFInterface.Objects.
    But i do not explain in details (help of C# and of .NET will be must amply sufficient to explain that)

    System : Required for initialize the file-system and services/libraries operating in concert with the system.
    System.Windows : [optional] Allow using some Windows aspect via the .NET language.
    System.Windows.Forms : [optional] Allow to display Message Box, System Message Box, well, so MessageBox will be possible with that.
    [color:#FF6666]However, take in note you CANNOT create Forms as if you're were in a application developed exclusively in .NET. (this, is logic AND you can do make (surely, you had already do that) Forms gracefully to MMF2, it just be called "Frame")[/color]
    System.Text : [optional] Allow using all of related-in String functions in C#
    System.Drawing : [optionel] Allow using images functions or drawing of .NET
    System.Collections.Generic : [optionnel] Allow using arrays (that MMF2 do not support, well, so, think to returning in VALUE or STRING in return).
    MMFInterface/MMFInterface.Objects : [optional] Allow to using IN .NET code objects which they are on the Frame IN Multimedia Fusion 2.

    [color:#0F6666]You want modifying/reading directly some parameters of your MMF2 Frame's objects via a calling event with .net Script
    WITHOUT specifying OBJECTS in this call..[/color]

    ======> [color:#CC33CC]It require theses declarations.[/color]
    [color:#0F6666]You want modifying/reading some Values Valeurs (can be of types String/Value) of your MMF2 Frame's object via a calling event with .net Script
    WITH specifying the values to change (and which objects) via a MMF2's calling event using .net Script:[/color]

    ======> [color:#CC33CC]Theses declaration are not necessary.[/color]

    ** Take in mind that declarations are not all, it exists SOME A LOT others, take a look inside .NET help or/and C#, and add them in consequence.

    b) In C#, you must code properly, and knowing this language do not accept any malformed lines, it is strict, and it is you to obey him, not inverse.

    ALL the NEW lines (not-empty.. not commented), must be finish by a ";"
    => EXCEPT if the line is a reference to a function/class or calling definition.
    AND all functions/class or calling definition, must contain their 'events' between "{" and "}".

    ** This should not depaysing you too much in terms of types (even if C# include more types), MMF2 is also strict (it do not authorizing use of NUMBERS (value) in a STRING if these NUMBERS (value) have not previously been casted (transtyped if you're not undesrtand me, or in simple word: converted) to STRING.)

    c) In C#, the debugguer will become your most fan and ally.

    Fan , because it talk you often, and it's not forcing that is for errors.
    Ally, because its integrated debugguer will finding often the exact place where errors are! It is efficiently and bluffing because fast!

    d) In C#, No matter to create a function, and choosing a type, and, finally returning an another type..

    After, so, it exist a way to ruse it, and using a "object" type which its is able to autoconvert its value instinctively.
    BUT, well.. It's not a good method, because it opening some doors for hacks that C# cannot controlling..

    [size:11pt]So, and now, you're up-to-ready for make a less of C#.[/size]

    [size:17pt]4) Your first script (development) in .NET[/size]

    So, well, yet, for accessing to the interface window of .net Script editor if you had closed, it's really simple:

    (In .net Script object parameter (in MMF2), click on tab "Configuration" and on button "Edit" near from "Script")

    Now, access to the editor please.

    Once time you are in, we type some code lines.
    (type, yes, because nothing is assisted in this replacement editor, the autocompletion exists only in official IDE, (Microsoft Visual C# 2010, which i advice you to installing it, as it is complete).)

    We creating a small class, and inside a function.
    The function will serve to replace a text in a given string by a other given string.
    Yes, I know an extension (StringReplacer) make already that (grace to LB), it's JUST for learning to you how a .NET works with MMF2.

    Here is the full code for our function.

    [color:#CC0000]DO NOT STUPIDLY COPY/PASTE, [size:14pt]learn to[/size] CODE (DEVELOPING) IN .NET!

      // The comment in #C will be above of a pair of "/"
       * That is also comments lines.
      // Introduce System libraries.
       using System;
      // Introduce Text libraries
       using System.Text;
      // Creating a public class (this can be for store a calling event for our functions.). This is make 'INSTANCES' functions.
      // Why "public" ?
      //  Because, as it, this class is accessible at all moment and everywhere
      //  (surely, for MMF2 can accessing to this class, we must give a public class. (due to keyword: public)
      // Next, we must giving a name, it will be useful for identifiying the class.
      // In our example, we calling it "CSharpOverride", i've found it a nice name :D  
       public class CSharpOverride
           // And, after, we creating a function also public. (keyword: public)
           // And, after, we want creating a static call method because we want returning something at the end (keyword: static)
            // About at keyword "static", note that signify you cannot have access to the keyword 'this'
            //  and, by the way, you're be not able to manipulating .NET objects (please note i have said .NET and not MMF2 objects ok?)
            //  For finish on a static note, take in mind the extension '.net Script' which we actually using can only use 
            //    static method (static) for returning a processed data by .NET
            // or empty  method  (void)  if your function must NOT return something (example: Create a picture, displaying a  messagebox).
           // That return a data of a type : string/numbers
           // That will be named StrReplacer
           // And, give to our new function 3 parameters (arguments), all of string type.
           //  Arguments/Parameters will be : "DansCa", "RemplaceCeci" et "ParCela"
           // Finally..
           // We obtaining this:
              public static string StrReplacer(string DansCa, string RemplaceCeci, string ParCela)
                  // Well, now, we are IN our class function.
                  // It is here you can make the logic and events for the function!
                  // We create a string type variable called "DonneeDeRetour" with the value "empty".
                  //  (the name can be anything, but for the type, i advise not to testing other thing if you're not familiar with the C# language)
                   string DonneeDeRetour = "";
                  // Next, we using the named object method ".Replace()" of C#.
                  // This is allow of initializing the find/replace engine of C#.
                  // This is made by this way:
                  // 1. We modifiying the variable value created before => DonneeDeRetour
                  // 2. By the result of this replacement:
                  //     FIND in value of given parameter: "DansCa"
                  //     IF the string value of given parameter "RemplaceCeci" exists
                  //     AND if yes, we replacing by the string value of given parameter "ParCela" 
                   DonneeDeRetour = DansCa.Replace(RemplaceCeci, ParCela);
                  // For finish, we returning our result, and for that, nothing of more easy.
                  // It enough of returning the before created and modified variable : DonneeDeRetour
                  // (return is the keyword to use for returning something after a processing event) 
                   return DonneeDeRetour;
    Click on "Compile" button and "OK" button.
    If you had an error in compilation.. It's your fault, because my code is well-formed and functionnal.
    You had certainly touch/modifiying/omitting a character or adding in bad place..
    Take the help of integrated debugguer for localizing easily yours errors.

    Comeback to the Multimedia Fusion 2 interface now !
    [size:11pt][color:#CC0000]WARNING: Name ".net Script" object of your frame to ".netExtensionFramework"
    (because for clarify my tutorial i will use THIS name soon).

    And so.. phew, it's finished for .NET code !
    In the next chapter, we offering to MMF2 the using of our Class.Function that we just created.

    [size:17pt]5) Using MMF2 by and with .NET (via .net Script)[/size]

    Well, now, we write (don't affraid of words) a sort of application in the main application, it can allow us to make a thing that MMF2 do not support natively..

    For that, we had must write some C#.NET code and for this the .net Script extension was required!

    And now, we had already make 80% of total work.

    10 % will be necessary for creating the interface.. so.. we do not catch headache, and make the task fast.

    Put: 1 Edit Box, named: "texte_Entrée"
    Put: 1 Edit Box, named: "texte_Sortie"
    Put: 1 Button, named: "boutton_Remplace" and for text value: "Remplacer"

    Organize as you wish, but do not make more objects.

    The interface was created, so, for now, it will be a childplay (less common but not difficult)!

    The remaining 10 %, will concern our events, a bit more "complex"

    I do not using forum CODE tag this time, because i want colorize myself.
    In this case, i will put some parts in highlights..

    1) At the start of your frame => Change Text of 'texte_Entrée' by: BackStaged was here
    or : Clickteam was here
    or ... What fo you want...
    2) On button 'boutton_Remplace' click
    => Change Text of 'texte_Sortie' by: CallFunction$( "[color:#CC0000].netExtensionFramework[/color]", "[color:#000099]CSharpOverride[/color][color:#CC33CC].[/color][color:#3333FF]StrReplacer[/color]", [color:#999999]Edittext$( "texte_Entrée" )[/color][color:#CC66CC]+"[/color]|[color:#FF9900]was[/color]|[color:#AFCC66]is always[/color]")

    Ok ok.. here, i must clarify, i think!
    (i do not tell you what is "+", i think you know that!

    1st expressions section to fill-up

    - CallFunction$ : Indicate to .net Script via MMF2 to make a call to a function of our .NET code that we had previously wrote.
    - [color:#CC0000].netExtensionFramework[/color] : The object to call is called : '.netExtensionFramework'.
    - [color:#000099]CSharpOverride[/color] : We want refer to the class named 'CSharpOverride' of .net Script object which is named'.netExtensionFramework'.
    - [color:#CC33CC].[/color] : Please, note this point (.), IT IS REQUIRED, it's for indicate the separator between CLASS.METHOD
    - [color:#3333FF]StrReplacer[/color] : This time, we indicate what method (function) of the class is for instance.

    2nd expressions section to fill-up

    - [color:#999999]Edittext$( "texte_Entrée" )[/color] : So, you know, we want catch the text of our Edit box which the name is: texte_Entrée
    For escaping a character, (thanks to Yves for tell me how), the character to escape must be doubled (example, escape a " by double the character: "")
    Which is pretty funny.. Because it's the escape syntax of Visual Basic..
    Comeback to our dissection: it is for follow the logic of that our function will be censed make; so then, the parameter 1 must be the string where searching.

    - | : Parameter separator (here we separating parameter 1 for write a 2nd)
    NOTE: It's the correct syntax for .net Script, do this ONLY IF you have a 2nd parameter.
    HERE: It's the case. So, we separating with a "|".

    - [color:#FF9900]was[/color] : So, it is for also follow the logic of that our function will be censed make; so then, the parameter 2 must be the string to find.

    - | : Parameter separator (here we separating parameter 2 for write a 3rd)
    NOTE: It's the correct syntax for .net Script, do this ONLY IF you have a 3rd parameter.
    HERE: It's the case. So, we separating with a "|".

    - [color:#AFCC66]is always[/color] : So, it is for also follow the logic of that our function will be censed make; so then, the parameter 3 must be the replaced string if the 2nd parameter is found in 1st parameter.

    NOTE that the C#.NET language support:
    * Numbers (called int/int32/int64/integer/System.Int)
    * String (called string/str/System.String
    * Arrays (called ArrayList/ (better way for using it): List<string> theArray = new List<string>(); (if String type).
    * The converting methods (-Transtyping, Castings simple-) : ConvertTo.To<newtype>(WhatConvert?);
    (it exists some other advanced methods of course.)
    Example: int Year = 1982; MessageBox.Show("I was born to: "+Convert.ToString(Year)+" !");
    Note that: System.Windows.Forms is required in "using" declaration otherwise the MessageBox won't not display.
    * other.. floats etc.. so, the help of C# can you help more and give you some indications.

    So, NOW, it's ** rephew ** finished!

    Finished, yes! The thing remaing, is compile your application via "Run" in the Multimedia Fusion 2 menu.

    You can see in a Editbox (textbox) the text: BackStaged was here
    (or an other what you want use instead mine of this tutorial..)
    The other Editbox (textbox) is empty.
    AND a button with value: Remplacer

    CLICK on the button, and you should have: BackStaged is always here
    in the Editbox that was empty.

    If yes.. The replacement is OK, did you see that?
    Powerful no?

    You had wrote a powerful function of string replacement, it act same of StringReplacer extension!

    For finish, CONGRATULATIONS to have patience for reading me, sorry (millions of sorry) for my simple english.

    [size:17pt]6) Conclusion, what i can do made with .NET via .net Script ?[/size]

    .NET limits are a bit as Multimedia Fusion 2..
    There is if you not enough imagine.

    .net Script limits are different, because if you're owner of Multimedia Fusion 2 Developer
    There is not.
    Otherwise, you can stuck with the MDI (Multiple Document Interface) and codes which make call to registry.

    So, One more time...

    THANKS GreyHill !
    These extension is very welcome !

    [size:17pt]7) Comment![/size]

    If this tutorial help you, (and i'm hoping for this, i spend for a long time to elaborate it), let me yours feedbacks, questions and critics.
    I would be happy (if I can) to help you or bring some answers

    THANKS for reading (me).
    THANKS to ClickTeam for had creating Multimedia Fusion 2, i'm loving it (Mc Donald©).
    THANKS to GreyHill for the .net extension !
    THANKS to Microsoft for the amazing Framework .NET and his IDE solutions (express) of developement !

    BUT THANKS ALL-OVER TO.. My keyboard, which supports taking regular fingers.
    (ok ok.. i'm outside.)

  2. #2
    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)

    Re: [Tutorial] Using .NET in your App.

    This is such a better good article. Thanks this!
    Cranktrain - Currently finishing a new game called The Cat Machine!
    @MattLuard on Twitter.

  3. #3
    Clickteam Clickteam
    LB's Avatar
    Join Date
    Jun 2007
    Richardson, Texas, North America
    2 Post(s)
    0 Thread(s)

    Re: [Tutorial] Using .NET in your App.

    Nice job on this!
    Working as fast as I can on Fusion 3

  4. #4

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator Pro
    nivram's Avatar
    Join Date
    Jul 2006
    Bandon, Oregon
    9 Post(s)
    0 Thread(s)

    Re: [Tutorial] Using .NET in your App.

    Thank you BackStaged. I enjoyed this and for me it took some mystery away.

    ​458 TGF to CTF 2.5+ Examples and games

  5. #5
    Clicker Fusion 2.5
    Fusion 2.5 (Steam)
    BackStaged's Avatar
    Join Date
    Aug 2010
    0 Post(s)
    0 Thread(s)

    Re: [Tutorial] Using .NET in your App.

    Thanks guys, i'm happy to seeing that you appreciate my work and help!

    @nivram : glad to see my tutorial help you, don't forget to read some .NET (only) tutorials over the net, in case you want go more far than my tutorial which is targetting only the ways to using .NET in MMF2

Similar Threads

  1. New INI Tutorial
    By redpandagames in forum SWF/Flash Export Module Version 2.0
    Replies: 11
    Last Post: 27th May 2013, 05:33 PM
  2. Looking for Tutorial
    By Gullyking in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 19th December 2010, 10:14 AM
  3. Ini Tutorial
    By FlinkGigitty in forum Multimedia Fusion 2 - Technical Support
    Replies: 16
    Last Post: 12th July 2010, 08:20 PM
  4. TCP IP \ LAN tutorial
    By Fant in forum Multimedia Fusion 2 - Technical Support
    Replies: 22
    Last Post: 2nd April 2009, 04:14 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