[Bug] #goto sends a map exit's $variable to the game literally; script put/send does not expand $variables (Genie4 does)
Maintainers usually reply within 5 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 42/100
Research direction
Start with the script put/send case in src/Genie.Core/Scripting/ScriptEngine.cs (around L1949-2076), where each segment goes to _sendCommand, and compare it with CommandEngine.ProcessInput in src/Genie.Core/Commanding/CommandEngine.cs (L196), which calls _host.ExpandVariables. Reproduce with #var shard.pw anything and a script that sends '$shard.pw. Done means the script's sent text expands $variables before reaching the game, and the mapper hand-off works, which needs a maintainer decision on scope.
Written by the indexing model from the issue text.
Description
What happened
With automapper.cmd installed (automapperscript on, the default), #goto through a map exit whose move contains a Genie variable sends the variable's name to the game instead of its value.
The community Shard map has this exit into the Thieves' Guild:
<arc exit="go" move="room knock door;'$shard.pw;go door" ... />
I had shard.pw defined. My character said $shard.pw out loud and walked into the closed door. When I typed the same three commands by hand with the real password, the door opened, and automapper.cmd, which was still running, finished the walk.
What you expected
I expected $shard.pw to be replaced by its value before the line is sent. Genie 4 does that: the same map and the same automapper.cmd get through this door there.
Steps to reproduce
- Define the variable:
#var shard.pw anything. - Have
automapper.cmdin the Scripts folder and#config automapperscripton. #gotoa room on the far side of an exit whose move contains$name. The current maps have seven:Map67_Shard.xml(one,$shard.pw) andMap30_Riverhaven.xml(six,$haven.pw, e.g.room sear;-3knock concealed door;-whisp door $haven.pw).- At that exit the script sends
'$shard.pwunexpanded.
Environment
- OS + version: Ubuntu 26.04.1 LTS
- Genie 5 version: 5.0.0 (
04-Linux-Genie5.AppImage) - Install type: AppImage
- Connection mode: Direct SGE
- automapper.cmd:
autoversion 8.2026-07-09
Logs / session capture
Next move: room knock door;'$shard.pw;go door
[Shard, Dark Hallway]
Obvious exits: north.
knock door
'$shard.pw
You knock on the door.
A moment later, a slit opens in the door at eye level. The eyes seem to study you for a moment, then a voice whispers to you through the slit, "You look familiar, but I need to be sure. What is the password?"
go door
You say, "$shard.pw."
BONK! You smash your nose on the door.
From behind the doorway you hear a faint chuckle.
Anything else
I don't know whether this is a regression. The first time I used this exit in Genie 5 was on 5.0.0. I searched the open and closed issues for shard.pw, haven.pw and automapper variable problems and found nothing.
I read the source at v5.0.0 (ee4480c) to see why. This is what I think happens:
MapperViewModel.TryHandOffToAutomapperScript(src/Genie.App/ViewModels/MapperViewModel.csL2582-2600) passes theFindPathmoves toScripts.TryStart("automapper", moves)as they are, so the script receives$shard.pwas text. Genie 4 does not expand at launch either.automapper.cmdsends the move withput %movement.ReplaceSigils(src/Genie.Core/Scripting/ScriptEngine.csL3546-3560) leaves a$inside a substituted value alone, and its comment says Genie 4 does the same ("a resolved value that itself contains % or $ stays literal (also Genie 4)").- The script
put/sendcase (ScriptEngine.csL1949-2076) then hands each segment that goes to the game to_sendCommand(outbound). The text never goes throughCommandEngine.ProcessInput, where_host.ExpandVariables(input)(src/Genie.Core/Commanding/CommandEngine.csL196) expands$variablesfor typed input, trigger actions and#commands.GenieCore.csL754-763 says scripts do not pass throughSendToGame. - Genie 4 (
main, 2753d25) does expand at that point.Script.SendTextraisesEventSendText,FormMain.Script_EventSendText(Forms/FormMain.csL6503) callsCommand.ParseCommand(Text, bSendText, false, Script), and the plain-text branch there runsoGlobals.ParseGlobalVars(sRow)beforeSendTextToGame(Core/Command.csL2566-2567). The queuedsendbranch ofScript_EventSendTextcallsParseGlobalVars(Text)as well.
So Genie 4 expands $variables in every line a script sends to the game, after the script's own substitution, and Genie 5 does not. I think that is why '$shard.pw is sent unchanged.
A possible fix is to run ExpandGlobalVars over each segment in the script put / send path that goes to the game (queued sends and action sends included), after the ; split, as Genie 4 does. Expanding the moves in the mapper hand-off would fix the map exits but not other scripts.
Workaround: type the exit's commands in the command bar yourself. For this door:
knock door;'$shard.pw;go door
Typed input does get its $variables expanded, so the variable works there. automapper.cmd carries on with the rest of the walk once you are through.
- Dominant language
- C#
- Stars
- 2
- Forks
- 5
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 22
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from GenieClient/Genie5
-
bug
Difficulty 1/5 1-3 hours Newbie friendliness 90/100
GenieClient/Genie5#496 ·
Maintainers usually reply within 5 days
-
enhancement g4-regression
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
GenieClient/Genie5#494 ·
Maintainers usually reply within 5 days
-
area:ui-dock enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
GenieClient/Genie5#462 ·
Maintainers usually reply within 5 days
-
area:mapper bug est:<1d P2
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
GenieClient/Genie5#449 · 1 comment ·
Maintainers usually reply within 5 days
-
[Bug] Maps ▸ Update from Official Repo / Repair Maps give no notification of success or failurePossibly taken A pull request linked to this issue is open or already merged. Openarea:mapper area:updater bug est:<1d P3
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
GenieClient/Genie5#423 · 1 assignee ·
Maintainers usually reply within 5 days
All issues in GenieClient/Genie5
Similar issues
-
documentation good first issue kind:task level:starter size:s
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Arggon/ArggonStores#66 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
[Tool] MockAPIOpenhas-image has-license has-readme new-tool ready-to-approve repo-verified
Difficulty 1/5 Under an hour Newbie friendliness 72/100
shanselman/TinyToolTown#956 ·
Maintainers usually reply within 2 days
-
bug frontend
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
[Bug]: Native build script prints a traceback when Git is missing from PATHPossibly taken @Jaisuryan-web claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
KnifeLemon/Filee#1953 ·
Maintainers usually reply within 1 day