No-Code Workspace — Block Reference

Flow ControlBlock usage recipe

Measurement Decision (SPATIAL_DECISION)

Turns measurements published by earlier blocks into a decision and direction

Documented for app version 1.0.50Updated:

Block Preview

Captured from the in-app Visual Builder block card in the English UI.

English UI
Measurement Decision (SPATIAL_DECISION) block card

What Does It Do?

Reads the position, distance, size, motion and direction values that measuring blocks published; it does not scan the screen itself. It tests one or two sources with rules, then derives a direction. The result drives the TRUE/FALSE branches and publishes seven variables under the output prefix.

When to Use?

1

Choose a direction away from or toward a target

2

Compare the relative positions of two measurement sources

3

Calibrate direction against measured motion

How to Use?

1

Run the measuring source block earlier in the flow

2

Targets: Source A and, when needed, Source B

3

Rules: source, metric, operator and value; rules combine with All Must Match, Any Must Match, All Must Fail, Any Must Fail, Always True or Always False

4

Direction: Direction from, Transform, Start point and Direction snapping (Free / 4 directions / 8 directions); Motion basis when needed

5

Output prefix (default karar): karar_ok, karar_hazir, karar_durum, karar_yon, karar_aci, karar_sapma, karar_uzaklik

6

If a measurement is missing: Run neither branch, Treat as false or Stop with an error

Parameters

Rules

Metric, operator and value, or the same metric on the other source; combined with one of six logic modes

Direction

Direction from: Source A, Source B, A towards B, B towards A, Towards A’s empty area, Fixed angle, Between two selected points. Transform: As is, Opposite, Perpendicular (clockwise / counter-clockwise), Angle offset

Measured forward direction source

Answers relative to the measured motion of A or B; Smallest movement to trust (px) filters noise

Output prefix

Default karar: _ok (decision), _hazir (source readable), _durum (reason), _yon and _aci (screen direction and angle), _sapma (deviation from forward), _uzaklik (distance). An empty prefix publishes nothing

Example Usage

1

Measure the target with IMAGE; Measurement Decision → Source A = that block

2

Direction from = Source A, Transform = Opposite, Direction snapping = 8 directions, Output prefix = escape

3

On the TRUE branch take the SWIPE direction from the decision; while calibrating, watch escape_yon and escape_aci with LOG

Combinations / Used With

1

IMAGE/MH_VISUAL_DECISION + SPATIAL_DECISION: derive a decision from measurements

2

SPATIAL_DECISION + SWIPE: move in the derived direction

3

SPATIAL_DECISION + LOG: watch the decision variables

Tip

Turns measurements published by earlier blocks into a decision and direction

Warnings / Cautions

1

The source block must run first and publish a valid measurement; a missing one is never treated as zero, the If a measurement is missing option applies

2

Source B is required whenever a rule, direction, start point or forward-direction source uses B

3

Motion basis does not guess the previous gesture; enter its type, direction and magnitude accurately

Step-by-Step Mastery: Basic → Advanced → Pro

The same block at three levels: a quick start, the real options, and professional techniques.

Basic

Measurement Decision reads a screen measurement that another block published earlier; it does not run a new scan itself. In the simplest flow, select Source A under Targets and derive a direction toward or away from the target. The output prefix (default karar, in every app language) publishes seven variables: karar_ok (decision), karar_hazir (sources readable), karar_durum (reason for the result), karar_yon and karar_aci (direction and angle on screen), karar_sapma (deviation from the measured forward direction) and karar_uzaklik (distance).

Advanced

Rules compare metrics such as position, distance, angle, side, size, coverage and empty area against a value or the same metric on Source B; several rules combine with one of All Must Match (all true), Any Must Match (at least one true), All Must Fail (all false), Any Must Fail (at least one false), Always True and Always False. Direction from can be Source A, Source B, A towards B, B towards A, Towards A’s empty area, Fixed angle or Between two selected points. Transform is As is, Opposite, Perpendicular (clockwise), Perpendicular (counter-clockwise) or Angle offset. Start point and Direction snapping (Free, 4 directions, 8 directions) separately set where motion starts and how precise the direction may be.

Pro

Measured forward direction source expresses the answer relative to the measured motion of A or B instead of screen coordinates. It is meant for measuring which world direction a calibration gesture produced and then deciding forward, backward or sideways; karar_sapma gives the deviation from that forward direction. Smallest movement to trust (px) rejects a calibration that hit a wall or was only noise. Motion basis explicitly declares the preceding gesture’s type, direction and magnitude; the engine never guesses them. Because a missing measurement is never treated as zero, choose If a measurement is missing (Run neither branch, Treat as false, Stop with an error) to match the flow’s safety needs.

Real-World Scenarios — Step-by-Step Recipes

Small, reproducible examples that combine several blocks — build them straight into your own macro.

Escape from a measured target in eight directions
  1. 1Measure and publish the target position with IMAGE or MH_VISUAL_DECISION
  2. 2Measurement Decision: Source A = target block
  3. 3Direction from = Source A, Transform = Opposite
  4. 4Direction snapping = 8 directions, Output prefix = escape
  5. 5On the TRUE branch take the SWIPE direction from the decision; while calibrating, watch escape_yon and escape_aci
  6. 6Re-measure when the measurement is missing; do not reuse a stale decision
Choose a safe gap between two measurements
  1. 1Let two source blocks publish measurements A and B
  2. 2Measurement Decision: select Source A and Source B
  3. 3Compare the relevant A/B metrics with explicit rules
  4. 4Set Direction from and Start point for the scenario’s real motion plane
  5. 5Check karar_durum with LOG before acting on the TRUE branch

Which Blocks to Pair With — Pro Combinations

This block is useful on its own — but it shines when paired with the right partners.

+ IMAGE / MH_VISUAL_DECISION

Produces the live position and region measurement that MEASUREMENT DECISION consumes.

+ SWIPE

Turns the derived direction or angle variable into real on-screen motion.

+ COMPARE

Applies a second threshold to the published angle, distance, or status after the decision.

+ LOG

Lets you inspect source status and the derived direction together during calibration.

Common Mistakes and Fixes

Running MEASUREMENT DECISION before its source block: there is no valid measurement. Fix the execution order; never treat an unavailable source as zero.

Selecting a B-based frame, origin, direction, or rule while Source B is empty: validation rejects the inconsistency. Select B or remove every B dependency.

Declaring Motion Basis differently from the actual preceding gesture: the math may be internally consistent while physical motion is wrong. Match the gesture type, direction, and magnitude exactly.

Pro Tips

During initial setup, log the output-prefix variables and keep Direction snapping on Free. Move to 4 or 8 directions once the real angle is stable.

Start frame minimum movement at zero, then raise it above measured device noise while keeping it low enough not to reject real calibration motion.

For safety-critical motion choose If a measurement is missing = Stop with an error and handle it with ERROR_HANDLER or TRY_CATCH; for optional steering, Run neither branch is safer than a stale or invented decision.

This Block's Code (Editor View)

Lua

The Lua below is what the Code Editor generates for this block with sample settings. Adding cases, branches, actions or loops, or changing settings, extends the generated code accordingly. Study it to see what the block does under the hood, to learn Lua, or to copy and adapt it. Use the Copy button (top-right) to paste it into the Code Editor, or “Try in Editor →” to run it in the live editor.

local karar_ok = nil
local karar_hazir = nil
local karar_durum = nil
local karar_yon = nil
local karar_aci = nil
local karar_sapma = nil
local karar_uzaklik = nil

local _mhM = {}
local _mhMeasureSeq = 0
local _mhFlowEpoch = 0
local function _mhSide(nx, ny, dz)
 local ax, ay = math.abs(nx - 0.5), math.abs(ny - 0.5)
 local hz = (ax <= dz) and "" or ((nx < 0.5) and "sol" or "sag")
 local vt = (ay <= dz) and "" or ((ny < 0.5) and "ust" or "alt")
 if vt ~= "" and hz ~= "" then return vt .. "_" .. hz end
 if vt ~= "" then return vt end
 if hz ~= "" then return hz end
 return "merkez"
end
local _mhD = {}
local _mhDecisionSeen = {}
local _mhLastDecision = nil
local _mhLastDecisionSwipeAngles = {}
local function _mhMeasurementCurrent(record)
 if record == nil then return true end
 if record.match == nil or record.match.canClick == nil then return true end
 local ok, current = pcall(function() return record.match:canClick() end)
 return ok and current == true
end
local function _mhDir(ang, snap)
 if snap == 4 then
  local i = math.floor(((ang + 45) % 360) / 90)
  return ({ "right", "down", "left", "up" })[i + 1], i * 90
 elseif snap == 8 then
  local i = math.floor(((ang + 22.5) % 360) / 45)
  local names = { "right", "down_right", "down", "down_left", "left", "up_left", "up", "up_right" }
  return names[i + 1], i * 45
 end
 local i = math.floor(((ang + 22.5) % 360) / 45)
 local names = { "right", "down_right", "down", "down_left", "left", "up_left", "up", "up_right" }
 return names[i + 1], ang
end

_mhFlowEpoch = _mhFlowEpoch + 1
local _sd1 = false
do
 local _a = _mhM[""]
 local _st = "ok"
 _mhD["block:00000000-0000-4000-8000-000000000001"] = nil
 local _seen = _mhDecisionSeen["block:00000000-0000-4000-8000-000000000001"]
 local _aCurrent = _mhMeasurementCurrent(_a)
 if not (_a ~= nil and _a.ok == true and _a.seq ~= nil and _a.epoch == _mhFlowEpoch and _aCurrent and _a.stale ~= true and (_seen == nil or _a.seq ~= _seen.a)) then
  _st = ((_a ~= nil and (_a.stale == true or not _aCurrent)) or (_seen ~= nil and _a ~= nil and _a.seq == _seen.a)) and "source_stale" or "source_unavailable"
 end
 local _rules = true
 if _st == "ok" then
  local _vx = (_a.dx or 0) * ((_a.rw or 0) / 2)
  local _vy = (_a.dy or 0) * ((_a.rh or 0) / 2)
  local _len = math.sqrt(_vx * _vx + _vy * _vy)
  if _len < 1e-6 then
   _st = "degenerate_direction"
  else
   local _ux, _uy = _vx / _len, _vy / _len
   _ux, _uy = -_ux, -_uy
   local _fwd = nil
   local _ang = math.deg(Math.atan2(_uy, _ux))
   if _ang < 0 then _ang = _ang + 360 end
   local _cal = nil
   local _dir, _snapAng = _mhDir(_ang, 4)
   _ang = _snapAng
   _ux, _uy = math.cos(math.rad(_ang)), math.sin(math.rad(_ang))
   local _sapma = nil
   if _fwd ~= nil then _sapma = (_ang - _fwd) % 360 end
   local _ox = (_a.rx or 0) + (_a.nx or 0) * (_a.rw or 0)
   local _oy = (_a.ry or 0) + (_a.ny or 0) * (_a.rh or 0)
   if _st == "ok" then
    _sd1 = (_rules == true)
    local _decisionStatus = _sd1 and "ok" or "rules_failed"
    _mhD["block:00000000-0000-4000-8000-000000000001"] = {
     ok = _sd1, result = _sd1, available = true, vectorOk = true, status = _decisionStatus,
     stateKey = "block:00000000-0000-4000-8000-000000000001",
     ux = _ux, uy = _uy, angle = _ang, dir = _dir,
     deviation = _sapma, forward = _fwd,
     originX = _ox, originY = _oy, calibration = _cal, distance = _len,
    }
   end
  end
 end
 if _mhD["block:00000000-0000-4000-8000-000000000001"] == nil then
  _mhD["block:00000000-0000-4000-8000-000000000001"] = { ok = false, result = false, available = false, vectorOk = false, status = _st, stateKey = "block:00000000-0000-4000-8000-000000000001" }
 end
 _mhDecisionSeen["block:00000000-0000-4000-8000-000000000001"] = { a = _a and _a.seq or nil }
 local _d = _mhD["block:00000000-0000-4000-8000-000000000001"]
 karar_ok = (_d ~= nil and _d.result == true)
 karar_hazir = (_d ~= nil and _d.available == true)
 karar_durum = (_d ~= nil and _d.status) or "unknown"
 karar_yon = (_d ~= nil and _d.vectorOk == true and _d.dir) or ""
 karar_aci = (_d ~= nil and _d.vectorOk == true and _d.angle) or 0
 karar_sapma = (_d ~= nil and _d.vectorOk == true and _d.deviation) or 0
 karar_uzaklik = (_d ~= nil and _d.vectorOk == true and _d.distance) or 0
 _mhLastDecision = _mhD["block:00000000-0000-4000-8000-000000000001"]
end

Note: generated code can evolve across versions; helper names (e.g. _reg1, m1) and internal optimizations may change. The logic and the called APIs reflect the block’s behavior.

Block ↔ Lua Mapping →

Shared Controls for This Block Family

The guidance below is not identical for every block. It summarizes the professional controls that most often repeat in the selected block family.

🔀Branch and Exit Rules

Define TRUE/FALSE, try/catch, and loop exit behavior before chaining more blocks.

📦Results and Scope

Keep it explicit where group, dialog, and loop variables are created and where they are consumed.

🛑Safety Bounds

Long flows become brittle quickly without timeouts, ASSERT blocks, BREAK logic, or explicit guards.

🧩Modularity

Moving repeated steps into GROUP and GROUP_CALL improves readability in larger projects.

Builder vs Lua Boundary

Raw touch pointer lifecycle stays code-first

TOUCH and TOUCH_BREAK cover recipe-style touch flows. Raw pointer choreography such as Touch.down, Touch.move, Touch.up, Touch.dispatch, Touch.reset, Touch.breakAll, and Touch.releaseAfter is not exposed as a first-class builder block.

Touch.downTouch.moveTouch.upTouch.dispatchTouch.resetTouch.breakAllTouch.releaseAfter
Bounded dialog design is builder-backed; freer composition stays code-first

The DIALOG block and dialog designer cover a bounded field set in the builder: Info Text, Text Input, Checkbox, Description, Radio Group, Dropdown, Multi Select, Tab Group, Date Time, Number Range, Slider, Image Picker, Color Picker, File Picker, Recorder Picker, Tag, Signature, and Spacer. The buttons are designed too: the Positive button and Negative button tabs set each button’s text, background, and border color, corner radius, and minimum height next to a preview. Freer Setting.builder composition, multi-step wizard flows, and mixed HUD/dialog choreography still do not map 1:1 into the builder.

Coming soonv1.0.51Two more fields: Agent Detect references (agent_detect_editor) lets the user pick a saved reference set or add and edit references, and Save confirms the selection; Navigation setup editor (navigation_editor) edits a saved map, marker and route from the Dialog and returns the setup and route selection without moving the character.

Setting.builderDialogHudTextViewAgentDetectEditorNavigationEditor
Advanced HTTP request chaining stays code-first

HTTP_GET, HTTP_POST, and HTTP_PUT cover common fixed-method flows; HTTP_REQUEST covers one bounded request with method, header lines, body, content type, query parameters (GET and DELETE), timeout, and a bounded retry. These blocks never throw; they write the status code (-1 on a network failure). Cookie handling, chained request objects, and lower-level client flows still need the code editor.

Request()Request.setCookieRequest.getCookiesCUSTOM_CODE
General programming surfaces stay code-first

The MAP, LIST, JSON_PARSE, REGEX_MATCH, and METRICS blocks cover the everyday cases: map actions, a static list, reading a value from a JSON path, regex match, find, replace, and split, and metrics actions. The rest of the Map, Array, JSON, Regex, and Metrics APIs (for example Array sort, filter, and map) is broader than the builder recipe model and stays on the CUSTOM_CODE and code editor side.

MapArrayJSONRegexMetrics
Low-level runtime and Lua composition stays code-first

Runtime helpers, raw Request objects, Lua built-ins such as print/pcall/xpcall, and free-form object chaining patterns are represented through CUSTOM_CODE or the code editor.

RuntimeRequestprintpcallxpcallCUSTOM_CODE

Debug Mode and Breakpoints

Each block card now exposes an independent breakpoint toggle. When enabled, the breakpoint preference is stored with the block.

Breakpoints are only emitted into runtime code when Debug Mode is enabled from Visual Builder settings. When Debug Mode is off, breakpoints stay saved but do not pause execution.

Use ASSERT for fail-fast validation, and use breakpoints for step-by-step tracing and controlled pauses in the same flow.

Variable Scope

1

Variables defined with SET_VARIABLE are accessible throughout the macro (global scope). All blocks can read/write the same variable.

2

However, a variable defined inside a GROUP will be 'nil' (undefined) until the GROUP executes. Blocks outside the GROUP using this variable may produce unexpected results.

3

FOR_EACH loop variables (item and index) only carry valid values inside the loop body. Outside the loop they are outside local scope and should not be used.

4

TRY_CATCH error variable is only valid within the catch block. If the try block succeeds, the catch branch is not entered and the error variable remains undefined.

5

TIP: Before using a variable inside a GROUP, assign a default value with SET_VARIABLE outside the GROUP. This way the variable won't be nil even if the GROUP has not run.

Inline Expressions

You can embed variable values and calculations into text fields using {{ expression }} syntax. Expressions inside double curly braces are evaluated as Lua code and the result is inserted into the text.

Syntax
{{ expression }}
Examples
Skor: {{ score + 1 }} → "Skor: " .. tostring(score + 1)
{{ name }} kazandı! → tostring(name) .. " kazandı!"
X:{{ x }} Y:{{ y }} → "X:" .. tostring(x) .. " Y:" .. tostring(y)
Supported Blocks
SET_VARIABLELOGCOMPARECLIPBOARD_WRITENOTIFY_TOASTKV_SET
Security Note

Expressions are checked by the sandbox policy. Security-sensitive calls like loadstring, require, debug are automatically blocked.

General Tips

1

Keep scan regions as small as possible — improves speed, reduces false matches.

2

Always add an exit condition when using infinite loops (BREAK, timeout, or conditional exit).

3

Use network operations and error-prone steps inside TRY_CATCH.

4

If you need global error handling, use the Error Handler (ERROR_HANDLER) block as a singleton in the project.

5

Small coordinate offsets (CLICK/SWIPE) improve tap accuracy across different DPI and screen scales.

6

Customize macros with Dialog block — different parameters each run.

7

Define repeating steps once with GROUP_CALL, call from many places.

Cross-macro local library

Local Shared Macro Area

The Local Shared Macro Area moves blocks, variables, dialog fields, gallery assets, and imported media dependencies between macros on the same device. It is device-local, not cloud sync, not Firebase sharing, and not a replacement for public macro sharing.

Professional usage model: put a reusable login flow, common scan region, shared dialog form, variable group, template image, color profile, replay recording, or imported PLAY_SOUND media file into the shared area from one macro, then import it from the relevant + menu in another macro.

VISUAL_BLOCKSVARIABLESDIALOG_FIELDSTEMPLATE_IMAGECOLOR_SWATCHREPLAY_RECORDMEDIA_FILE
1

Send to the shared area

When one item or a multi-selection is active, the shared-area button can copy the selected part from the workspace, group, true/false action branch, dialog, and variables surfaces into the device-local library.

2

Import into another macro

The shared-area entry under the + menu imports the selected item into the surface that opened it. Main workspace, group, action branch, dialog, and variables each receive the compatible item type.

3

Share gallery assets

Gallery items include template images, color swatches, replay records, and imported audio/media files. They can move between macros on the same device so repeated templates, colors, recordings, and PLAY_SOUND media assets do not need to be captured again.

4

Keep it clean

The shared area is not a permanent dumping ground. Delete stale shared items from the shared-library panel; imports create a copy in the target macro and do not rewrite the source macro flow.

Checkpoint: after importing, review block names, linked template/image/color/record/media assets, and variable names in the target macro. The shared area creates a copy; delete stale shared items from the shared-library panel to keep the library clean.

AI assistant

Build a block chain with MH AI in natural language

Tell MH AI what you want in plain language; it proposes the right block sequence and lands it in the workspace after you approve. In the current release it works with cloud providers such as Gemini, Claude, and OpenAI; on-device local models are on the roadmap.

Learn more →