Questions about script and logic

Markdown Detected Guest 3 Views Size: 2.37 KB Posted on: Nov 1, 26 @ 8:31 AM

Hi, I'm building a multi-nick AI bot with HexDroid scripts and ran into some behaviors during debugging. Would appreciate clarification on these:

  1. MAP KEY DELETION setat %map key $null does NOT remove the key — $keys() still lists it, $has($keys(...), key) returns true, only $get() returns empty. Is this expected? Is there ANY way to actually delete a key from a map, short of rebuilding the entire map with $map()?

  2. MAP PERFORMANCE

    • Are $get / setat O(1) or O(n) on map size?
    • At what map size (100? 1000? 10000?) does performance degrade?
    • Is foreach %map over 1000+ entries safe within time budget?
  3. STRING PARSING HAZARDS We discovered:

    • ; inside a string truncates the rest (becomes comment)
    • \" becomes literal \ + " (2 chars), not escaped quote
    • Em-dash — and en-dash – work fine
    • Parens ( ) work if balanced What other characters are problematic inside string literals? Is there a documented list of "safe" vs "unsafe" chars?
  4. %q VARIABLE You mentioned %q = ", but in our test $len(%q) returns 0. In what context is %q valid? Is it only usable inside function arguments (like $split(str, %q)), not as field access?

  5. TIME BUDGET EXCEEDED You confirmed it's CPU suspend causing wall-clock jump. Follow-up:

    • Is there an event fired when device wakes (like on RESUME)?
    • Does it affect timer callbacks too, or only event handlers?
    • Any way for script to detect suspend/wake and adjust?
  6. MULTI-SESSION EVENT BEHAVIOR When user logs in with 2+ nicknames on same app:

    • Does on TEXT fire in EVERY session, or only the receiving one?
    • We observed it fires in every session. Is this intentional?
    • Is there a way to scope a handler to specific session/nick?
  7. NEWLINE $chr(10) returns empty, \n literal = 2 chars. Any way to include actual newline in a string sent to AI? We currently use " [next] " as separator workaround.

  8. TIMER BEST PRACTICE AT SCALE For a delay system (reply after 30-90s), which is lighter on battery:

    • Event-driven only (rely on incoming TEXT/JOIN/etc to trigger check)
    • Hybrid timer (activate only when there's pending work, auto-stop)
    • Periodic timer always running Assume device may sleep, network may drop.

Thanks, this will help me decide optimal design.

Raw Paste

Comments 0
Login to post a comment.
  • No comments yet. Be the first.
Login to post a comment. Login or Register
We use cookies. To comply with GDPR in the EU and the UK we have to show you these.

We use cookies and similar technologies to keep this website functional (including spam protection via Google reCAPTCHA or Cloudflare Turnstile), and — with your consent — to measure usage and show ads. See Privacy.