Skip to content

Releases: defisym/OpenFusionExamples

Android Utilities Ext B220723

17 Jul 14:44

Choose a tag to compare

Extract binary files.

FindTheWay Ext B220424

24 Apr 03:39

Choose a tag to compare

What's new

  • Android support!

image

Note: SetMapByPicture, SetMapBySurface is unusable due to platform limitations

  • isometric

need not to care about coord conversion, extension will handle it all for you.

image

  • debugger

image

  • Disable incompatible A/C/Es

image

  • new action: CreateAOEByName, CreateGrid, SetGridSize, SetMapByActive, SetMapBySurface

Bug fix

  • memory Leak in SetMapByPicture
  • protection for null LPRO
  • protection for non active object
  • fix size_t layer = -1 overflow
  • fix default layer = 2
  • fix possible crash when loading from surface due to /MT
  • LPCTSTR->LPCWSTR
  • update map when output
  • don't stash if stash is off when finding

Known issue

If you encounter grid offset in android:

image

please unzip ext and navigate to CRunFindTheWay.java

import static _3rdLib.ObjectCreationClass.GetEvtParam;
import static RunLoop.CRun.OBSTACLE_TRANSPARENT;

public class CRunFindTheWay extends CRunExtension {
    // TODO DEBUG
    private static final boolean DEBUG = true;
    // private static final boolean DEBUG = false;

    // Define ACE ID here
    // Condition
    final int CND_CONDITION_SMBS = 0;
    final int CND_CONDITION_SMBB = 1;

then toggle DEBUG flag.

Fini Ext B220415

15 Apr 13:30

Choose a tag to compare

Fini Update 220415

New features in brief

This update allows you to save/load all alterable values of one object in one event, compatible with 2.5/2.5+/2.5+ allow for string & counter.

Properties

  • Settings
    • 2.5 Plus
      • used when saving object's alterable value, as 2.5+ unlimited alterable values has a different data struct as 2.5
    • Allow alterable values for counters and strings
      • only available when 2.5 Plus is checked, to determine save string & counter's alterable value or not

Action

  • Load Alterable Value
    • load from base64
  • Load Position
    • load from base64

Expression

  • Save Alterable Value
    • Save alterable value/string/flag to base64
  • Save Position
    • Save to base64

FindTheWay Ext B220406

06 Apr 13:16

Choose a tag to compare

Pre-release

FindTheWay

Description

A* Path Find, open source, 5X faster than Path Finding Object, all runtime compatible.

Properties

This object has no properties

Terminology

  • Map type

    • Map is split to two part, terrain & dynamic, you don't need to compare if it's obstacle before handling dynamic part
    • the real map will be generated automatically once needed
    • Set : terrain & dynamic
    • Retrieve : real map & terrain & dynamic
  • Cost

    • 0 ~ 255, 255 = obstacle, others = path
  • UseRealCoord

    • convert input to gird coord
  • UseIterateCoord

    • use internal coord in On ... events
  • Path name

    • keep it empty to retrieve last path

Action

  • Continue

    • This extension put find/calc area in condition to check if params area valid. If you don't need following actions immediately, use this action to avoid fusion remove the empty event
  • Set Stash

    • with this on, path & area will be stashed, then retrieve it with out calculate if states are the same (map/zoc/ignore flag, etc.)
    • stash will be clear automatically once map updated
    • disable stash will clear everything stashed
    • disable this may slightly improve performance as the state hash process is skipped
    • disable this if you encounter hash collision
  • Set Map

    • Set Map

    • Set Map By Object

    • Clear Map

  • Path

    • Iterate Path
  • Area

    • Create Object Zoc

      • iterate zoc position for object, auto create zoc area, coord param is ignored
    • Create Object Zoc By Name

      • same as above
    • Create Object Zoc By Event

      • iterate zoc position for object, trigger On Create Object Zoc for you to create real zoc area
    • Set Zoc By Object

    • Clear Zoc

    • Set Unit By Object

    • Clear Unit

    • Iterate Area

    • Create Area Once

    • Create Area By Name Once

    • Create AOE

      • Create different AOE area, check appendix for type declaration

Condition

  • Map

    • Map Available

      • extension maintains a internal class to handle everything. This class will be destructed then re-construct with new params in Set Map conditions. If params are invalid, those conditions will return false and all A/C/Es rely on this class will do nothing/return default value, use this to debug
    • Check Map Cost At Coord

    • On Map Update

      • once you update terrain or dynamic, extension won't update the map immediately as you may set multiple points
      • usually map is updated before find/calc area if needed, then this condition will be triggered
  • Set Map

    • Set Map By Size

    • Set Map By Base64

    • Set Map By Picture

    • Set Map By Collision

      • you can let extension retrieve collision of layers, or call On Set Map By Collision for each gird for you to check & set collisions directly
    • On Set Map By Collision

  • Path

    • Path Found

    • Path Available

    • On Iterate Path

  • Area

    • Zoc Valid

      • not at obstacle or unit
      • need to update unit before using
    • Zoc At Area

      • check if zoc at calculated area
    • On Create Object Zoc

    • Calc Area

      • Line mode
        • no obstacle from start to the range (e.g., laser beam)
        • allRange & allRangeAttackRange are ignored in this mode
        • if attack is true, ignore flag will be taken into account
        • if attack is false, both map collision & all unit are taken into account, for skills that push/pull unit
      • Ring mode
        • if allRange is true, range will be used as move range, and allRangeAttackRange is used as maximum attack range, both move & attack area will be calculated in one short, e.g., danger zone of enemy.
    • On Iterate Area

    • On Iterate Attack Area

      • if you Calc Area in all range mode, this condition will be true when iterate attack area in On Iterate Area
    • Able to Iterate Area

      • if you want create areas procedurally by Iterate Area with param once, this condition is here for you to check if it is able to iterate.
  • Object

    • Select

      • Select All

        • save fastloops when click on an area, move character to that point, then destroy all areas
      • Object At Gird

      • Object At Coord

      • Object At Obstacle

      • Object At Object

        • check if former object and the latter object has the same gird coord
      • Pick One Object At Object

        • only display one instance when overlapping itself
    • Non-Select

      • No Object At Gird
      • No Object At Coord

Expression

  • Iterate

    • this values are shared by all On ... events, please do not nest them

    • Get Iterate X

    • Get Iterate Y

    • Get Iterate Index

  • Gird

    • Get Gird Coord
    • Get Real Coord
  • Map

    • Get Map Cost

    • Get Map Base64

    • Get Map String

    • Get MapType Map

    • Get MapType Terrain

    • Get MapType Dynamic

    • Get Map Cost Path

    • Get Map Cost Obstacle

    • Get Map Cost Valid

  • Path

    • Get Step
      • the same as Path Found but return steps directly, save events when calculation AI
    • Get Step of Path
    • Get Step Coord of Path
  • Area

    • Get Ignore Flag

      • ignore means this point doesn't treat as obstacle
      • A/C/E that requires this param need to update zoc/ally/enemy first to make ignore works properly
    • Get Available Line Range

RandomTable FE Ext B220329

29 Mar 12:48

Choose a tag to compare

  • Refactor random table to custom base64 lib instead of windows API
  • Implement A/C/Es
    • Get N Random Number Average
    • Get Current Random Table with NewLine Support
    • Get Random Percent

Func Ext B211106

06 Nov 11:30

Choose a tag to compare

  • Summary

    • Func is 40X faster than last release!

    • Now it's just 5X slower than fastloop: which means you could use it anywhere you like and don't need to worry about profermance impact in most cases.

    • Event

    • Profiler

    • Test case runs 100000 loops, measured by fusion's built in profiler, fastloop takes 86.249ms, func(same data type) takes 403.549ms, func(do str->number conversion) takes 662.872ms

  • Optimise

    • Use substr instead of regex to parse params
    • Use per-char loop to convert string to number instead of std::stof
    • Use per-char loop instead of regex to check if a string can be converted to number
    • Reserve space for vector/map
    • Only do data type conversion once when needed and save the result for future use
    • Only check String is number once and save the result for future use
  • DataType

    • Now func will save params as both float/string instead of string only

    • Use correct data type to get rid of conversions to squeeze more profermance (1.5X faster in test case below)

      • Conversion or not

      • Profiler

    • Func params are always saved as string due to the limitation of Fusion expression (don't support variable argument)

  • New Condition

    • is Number
      • check if a param can be converted to a number, using the same convert algorithm

      • note : please check validity before using this condition

      • Return

        • Previous Func's Return At...is Number
      • Param

        • Curernt Func's Param At...is Number
      • Temp Param

        • Func's Temp Param is Number
        • Curernt Func's Temp Param is Number

Func Ext B211031

31 Oct 14:46

Choose a tag to compare

  • Known issue

    • If you set an func's return value or temp param to another expression func's return value directly, you will got a blank string instead of it's return value.
    • Please use another alterable value or global value to store the previous return value and then use it somewhere.
    • For cases that you only need to use an expression's return as parent's return, use Pass Prevous Func's Return instead of Set Current Func's Return as a temporary solution.
  • New Property Compatible Mode

    • If your fusion version is below R293.9, please enable compatible mode to avoid crash in some cases when calling event by expression.
  • New Action Pass Prevous Func's Return

    • pass an expression's return value as parent's return value, to bypass a known issue to pass return values by Set Current Func's Return
  • Bug fix

    • Fixed an issue that causes first function (with params) call will cost much more time than the second and following ones

Full Changelog: Func_B211030...Func_B211031

Func Ext B211030

30 Oct 05:06

Choose a tag to compare

Func

Description

Call Functions via Expression or Action

Properties

This object has no properties

Known issue

First function call will cost much more time than the second and following ones

Note

To use this object, you need to update to R293.9, which contains a fix to avoid crash when calling event via expression Changelog

Or you need to use the code below to replace CallEvent(ONFUNC) in function CallFuncCore at Func.h, then build your own .mfx(don't forget to change the Inc/Lib/Output path in properties)

// Note: if your MMF version is below R293.9, you need to use code below instead of just a single line CallEvent(ONFUNC) to avoid crash

LPRH pRh = rdPtr->rHo.hoAdRunHeader;
expression* saveExpToken = pRh->rh4.rh4ExpToken;
CallEvent(ONFUNC);
pRh->rh4.rh4ExpToken = saveExpToken;

//Call Func;
//CallEvent(ONFUNC);

Action

  • Call Func

    • multiple or void return value
  • Call Func (Ternary)

    • Call function A or B by the bool value
  • Loop

    • Please use this inside a func event to avoid unexpected behaviour

    • Loop control for action funcs, works alomst the same as fastloop, but make it easier to pass temp values

    • Set Func's LoopIndex

    • Stop Func Loop

  • Temp Param

    • Please use this inside a func event to avoid unexpected behaviour

    • You can set several temp params, and retrieve then for calculation, etc

    • Temp params are saved in a map, so recursive funcs share the same temp param. That is to say, temp params of a func is not separated as C/C++ if you call it recurisively, use normal param to pass temp values in this case

    • all temp params of current func will be erased after func return (On Func event finish) if it's recursive index is 1

    • Set Func's Temp Param

      • use this to change or set parent func's temp param in it's child
      • Althougth you can set a never called func's temp param, but actually I do not recommend this
    • Set Current Func's Temp Param

      • like the action above but only effect the current func(recommended)
  • Return Value

    • Please use this inside a func event to avoid unexpected behaviour

    • Note : ret values will be erased on next function call

    • Set Current Func's Return

      • Clear return vector and set return use the same syntax of Call Func param
    • Set Current Func's Return Value

      • Clear return vector and set a return value
    • Push Current Func's Return Value

      • Add a return value to current function
      • if function is called by expression, expression will only return the first return value you pushed by this action
      • use action Call Func above to return multiple values

Condition

  • On Func

    • On function call
  • Validity

    • Please use this inside a func event to avoid unexpected behaviour

    • Return

      • Previous Func Has Return At
        • check if last func has return value at target pos
    • Param

      • Curernt Func Has Param At
        • check if curernt func has param at target pos
    • Temp Param

      • Func Has Temp Param
        • check if target func has temp param of target name
      • Curernt Func Has Temp Param
        • check if current func has temp param of target name

Expression

  • Call Func

    • Use function name and params to call and loop a function

    • if you encountered crash issues, and your fusion is older than R293.9, please check the Note section and follow steps to build a compatible version

    • Call Func (return value)

    • Call Func (return string)

  • Ternary

    • return bool?A:B

    • Ternary (return value)

    • Ternary (return string)

  • Get Param

    • Please use this inside a func event to avoid unexpected behaviour

    • Get param of current function by position

    • Position starts by 0

    • Get Current Func's Param (return value)

    • Get Current Func's Param (return string)

    • Get Current Func's Number of Params

  • Get Temp Param

    • Please use this inside a func event to avoid unexpected behaviour

    • Get temp param by funcname & paramname

    • return 0(value) or empty string "" (string) if no match

    • Get Func's Temp Param (return value)

      • return 0 if target pos is not a value
    • Get Func's Temp Param (return string)

    • Get current func's temp param by paramname

    • return 0(value) or empty string "" (string) if no match

    • Get Current Func's Temp Param (return value)

      • return 0 if target pos is not a value
    • Get Current Func's Temp Param (return string)

  • Get Return

    • Please use this inside a func event to avoid unexpected behaviour

    • Note : ret values will be erased on next function call

    • Get return value of current function by position

    • Position starts by 0

    • Expressions must return a value, so if you forget to set it, app will crash

    • return 0(value) or empty string "" (string) if there is no value at the pos you want to retrieve

    • Get Previous Func's Return Value (return value)

      • return 0 if target pos is not a value
    • Get Previous Func's Return Value (return string)

    • Get Previous Func's Number of Return Values

  • Get Index

    • Get Func's LoopIndex

      • Please use this inside a func event to avoid unexpected behaviour
      • return -1 if no func match
    • Get Func's Recursive Index

      • Please use this inside a func event to avoid unexpected behaviour
      • Get current call num of current function in function stack
      • check Recursive section in example mfa to get more information about usage
      • return -1 if no func match
  • Get Current FuncName

    • Please use this inside a func event to avoid unexpected behaviour
    • e.g. when retriving temp values of current func, GetTempParam$( "Func", CurFuncName$( "Func" ), "ParamName" )

Encrypter Ext B210919

19 Sep 15:43

Choose a tag to compare

En/decrtypt file with WinAPI CNG.
You can Encrypt file here and then read them by other extensions I made, e.g. Fini/StringSpliter

Fini Ext B210914

14 Sep 11:15

Choose a tag to compare

Fini

Description

Fini, based on brofield's brilliant work Simple ini, is a faster ini ext for fusion.

BenchMark

about 200X faster when writing and 10X faster when reading, but you need to load/save file manually.

Properties

This object has no properties

Action

  • New
    • you need this action to initialize.
  • Release
    • release the data in memory.
  • Load From File
    • if you load from file, extension will auto initialize itself.
    • if the file is not encrypted, keep the key section empty.
  • Save to File
    • if you don't want to encrypt the file, keep the key section empty.
  • Load From String
    • load from string, e.g.[Sec]/r/nItem=Value
  • Set Value (Section - Item)
    • Note: you can only set values in a section, doesn't support item-only file like MMF.
  • Set String (Section - Item)
    • Note: you can only set values in a section, doesn't support item-only file like MMF.
  • Delete (Section - Item)
    • Keep Item empty to delete the entire section.
    • Note: if a scetion is empty after you delete a item, this section will be deleted automatically
  • Iterate
    • Iterate Sections
    • Iterate Items
      • need section name to start iterate.
      • if you start loop, "Currenct Section" will be set to the section name you inputted

Condition

  • Iterate
    • On Iterate Sections
    • On Iterate Items

Expression

  • Get Value (Section - Item)
    • support float, e.g. -15.2, +13.7, 114.514, if the value is not a number, return 0
    • return 0 if there is no item match.
    • Note: you can only read values in a section, doesn't support item-only file like MMF.
  • Get String (Section - Item)
    • return "" if there is no item match.
    • Note: you can only read values in a section, doesn't support item-only file like MMF.
  • Get Current Section
    • get the section name while iterating.
  • Get Current Item
    • get the item name while iterating.
  • Save to String
    • save the entire file to string.