[Bug] Scripts get no line when the connection closes, so waiting for `Connection closed.` never matches (different than Genie 4)
Maintainers usually reply within 5 days
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
Research direction
Read the issue’s description of MainWindowViewModel, GameText.AddSystemLine, ScriptEngine.OnGameLine, and GenieCore’s $connected update to trace how disconnects reach scripts and triggers. The report says the author already has a fix with tests, so check for existing work before starting; done means scripts and triggers receive the described Genie 4 disconnect line on closure while the window output stays unchanged.
Written by the indexing model from the issue text.
Description
What happened
When the connection closes, a script gets no line it can match. The window prints [16:52:49] disconnected, but that line is not passed to scripts, so matchre, waitfor and action never see it. A script that sends quit and waits for the connection to close gets nothing and takes its timeout.
Scripts written for Genie 4 wait for its Connection closed. line after a quit, so on 5.0.0 they take the timeout branch every time.
What you expected
A line that scripts can match when the connection closes, as in Genie 4. Genie 4 prints [13:20] Connection closed., or [13:20] Connection lost. (reason) when the link breaks, and scripts and triggers see both.
Steps to reproduce
-
Save this as
closed-a.cmd:matchre GOT Connection closed\. put quit matchwait 5 put #echo NO LINE CAME exit GOT: put #echo LINE CAME -
Connect a character and run
.closed-a. -
The connection closes. When the five seconds are up the script prints
NO LINE CAME.
It is the same with matchre GOT disconnected, the word Genie 5 prints itself.
Waiting on the variable works: with waiteval ($connected = 0) in place of the matchre and matchwait lines, the script goes on as soon as the connection closes.
Environment
- OS + version: Ubuntu 26.04
- Genie 5 version: 5.0.0
- Install type: AppImage
- Connection mode: Direct SGE
Logs / session capture
[script] closed-a started (~/.local/share/Genie5/Scripts/closed-a.cmd)
quit
[16:52:49] disconnected
NO LINE CAME
LINE CAME is never printed.
Anything else
Cause, as far as I can read it:
MainWindowViewModelprints[HH:MM:SS] disconnected(and⚠ Connection lost: ...for a broken link) withGameText.AddSystemLine. That writes to the game window only. Nothing goes toScriptEngine.OnGameLineor to the triggers.GenieCoresets$connectedto 0 at the same moment, and that is all a script is told.- Genie 4 prints its line from
Connection.DisconnectCallback(PrintSocketErrorfor a broken link) throughGame.PrintTextToWindow, the same path as game text. That path hands every main-window line to the triggers and to each running script.
The same is true of main as of 394cd28.
Workaround: in the script, wait for $connected to become 0 instead of waiting for the line.
I have a fix with tests (when $connected goes from 1 to 0, scripts and triggers are given Genie 4's line, [HH:mm] Connection closed. or [HH:mm] Connection lost. (reason); what the window shows is unchanged) and can open a pull request if that is welcome.
- 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