Femics Questions & Answers Q&A

Discussion in 'Fallout General Modding' started by Femic, Aug 5, 2021.

  1. Femic

    Femic First time out of the vault

    23
    Nov 22, 2015
    Hi all,

    why should I use the keyword export variable and import variable?
    Are they any advantages opposite to LVAR MVAR and GVAR?

    Let's assume I do this:
    Code:
    ScriptA.ssl
    
    export variable C
    C := 99;
    
    Code:
    ScriptB.ssl
    
    import variable C
    
    Will variable C contain value 99 after importing it?

    Thanks and regards.
     
  2. Mr.Stalin

    Mr.Stalin Agent of Enclave Modder

    522
    Oct 29, 2015
    Yes.
     
    • [Rad] [Rad] x 1
  3. Lexx

    Lexx Testament to the ghoul lifespan
    Moderator Modder

    Apr 24, 2005
    That variable is temporary and will be forgotten on map change / game load. LVARs etc. are saved and remembered.
     
    • [Rad] [Rad] x 1
  4. Femic

    Femic First time out of the vault

    23
    Nov 22, 2015
    What is the difference between these three macros?
    In Sfall Script Editor following happens.
    When I hover over the yellow macro I get a description that looks like a basic command description but it doesn't tell me where this macro has been defined.
    The description of the purple and white macro shows the whole content that has been replaced by the macros and it tells me where is has been defined.





     
    Last edited: Aug 5, 2021
  5. Mr.Stalin

    Mr.Stalin Agent of Enclave Modder

    522
    Oct 29, 2015
    The import/export variable value will be saved while the script is running, i.e. before unloading the script in which the export is defined (usually the export is done to the map script). If the export is declared in a global script, it will be permanent.
     
    • [Rad] [Rad] x 1
  6. Mr.Stalin

    Mr.Stalin Agent of Enclave Modder

    522
    Oct 29, 2015
    The dark-orange ones are not macros, they are vanilla opcodes of the engine.
    The yellow ones are standard macros. A standard description is defined for them. (can go to the macro via the context menu)
    Macros of purple and other colors do not have a specific description. The white ones are usually user macros.
     
    Last edited: Aug 5, 2021
    • [Rad] [Rad] x 1
  7. burn

    burn A Smooth-Skin
    Modder

    626
    Apr 22, 2012
    I never got how export/import work.
    Do they get exported into global namespace? What if multiple scripts import the same var? Will they work with the same instance of it or private copies?
    Also, it says "export variable" Is it possible to export, say, procedures or something else?
     
  8. Mr.Stalin

    Mr.Stalin Agent of Enclave Modder

    522
    Oct 29, 2015
    >Do they get exported into global namespace?
    ---
    yes.

    >What if multiple scripts import the same var?
    ---
    everyone will get the exported value.

    >Also, it says "export variable" Is it possible to export, say, procedures or something else?
    ---
    You can export procedures.
     
    • [Rad] [Rad] x 1
  9. Femic

    Femic First time out of the vault

    23
    Nov 22, 2015
    What is meant by "global namespace"?
    Does it mean that if you declare "export variable" into a global script or a header file like global.h, the name of the exported variable can only be used once anywhere?
     
  10. Femic

    Femic First time out of the vault

    23
    Nov 22, 2015
    What does this do? I don't get what obj_art_fid is good for, what FID_HMWARR and FID_HFPRIM mean.

    Code:
    procedure talk_p_proc begin
    
       if ((obj_art_fid(dude_obj) == FID_HMWARR) or (obj_art_fid(dude_obj) == FID_HFPRIM)) then begin
     
  11. Lexx

    Lexx Testament to the ghoul lifespan
    Moderator Modder

    Apr 24, 2005
    FID is the defined art ID of the current critter (artfid.h). In this case it checks if the player is male or female tribal.
     
    • [Rad] [Rad] x 1