babalae/better-genshin-impact · error · InvalidOperationException
当前不在地图界面
Error message
当前不在地图界面
What it means
Thrown by GetBigMapCenterPoint when the MapScaleButton recognition object is not found in the captured screen region. This is the precondition check confirming the game is displaying the big map UI. If the button template isn't matched, the code assumes the map screen is not open.
Source
Thrown at BetterGenshinImpact/GameTask/AutoTrackPath/TpTask.cs:2150
private Point2f GetBigMapCenterPoint(string mapName, Point2f? expectedCenterPoint)
{
// 判断是否在地图界面
using var ra = CaptureToRectArea();
using var mapScaleButtonRa = ra.Find(GetQuickTeleportRecognitionObject("MapScaleButton", ra));
if (mapScaleButtonRa.IsExist())
{
var p = RecognizeBigMapCenterPoint(mapName, ra.CacheGreyMat, expectedCenterPoint);
if (p.IsEmpty())
{
throw new MapPositionNotRecognizedException("大地图特征点匹配识别位置失败");
}
return p;
}
else
{
throw new InvalidOperationException("当前不在地图界面");
}
}
private Point2f RecognizeBigMapCenterPoint(string mapName, Mat greyMat, Point2f? expectedCenterPoint = null)
{
Point2f p;
try
{
var map = MapManager.GetMap(mapName, _mapMatchingMethod);
p = expectedCenterPoint is Point2f expectedCenter
? map.GetBigMapPosition(greyMat, map.ConvertGenshinMapCoordinatesToImageCoordinates(expectedCenter))
: map.GetBigMapPosition(greyMat);
}
catch (Exception ex)
{
throw new MapPositionNotRecognizedException("大地图特征点匹配引发异常:" + ex.Message, ex);
}
View on GitHub (pinned to a7cb36712d)
Solutions
- Open the big map in-game (press M or the configured map key) before calling this method.
- Wait for the map UI to fully render before invoking.
- Verify the capture resolution and display scaling match the MapScaleButton template expectations.
- Update the MapScaleButton recognition asset if the map UI changed in a game update.
Defensive patterns
Strategy: validation
Validate before calling
// Verify the map is open before calling GetBigMapCenterPoint
using var ra = task.CaptureToRectArea();
using var btn = ra.Find(task.GetQuickTeleportRecognitionObject("MapScaleButton", ra));
if (!btn.IsExist())
{
throw new InvalidOperationException("Big map is not open. Press M first.");
} Try / catch
try
{
var center = task.GetBigMapCenterPoint(mapName);
}
catch (InvalidOperationException ex) when (ex.Message == "当前不在地图界面")
{
// Open the map and retry
} Prevention
- Always open the big map (press M) and wait for full render before calling.
- Verify the MapScaleButton template matches the current game UI.
- Check capture resolution and display scaling settings.
When it happens
Trigger: Called from GetBigMapCenterPoint(mapName, expectedCenterPoint). ra.Find(GetQuickTeleportRecognitionObject("MapScaleButton", ra)).IsExist() returns false.
Common situations: Game is on the main game screen or a different UI panel, not the big map; the map was closed or a dialog is overlaying it; map UI rendering not complete; the MapScaleButton template doesn't match due to resolution/scaling differences.
Related errors
- 多次重试后,识别大地图位置失败
- 请先装备小道具「王树瑞佑」!如果已经装备仍旧出现此提示,请重新仔细阅读文档中的《快速上手》!
- 当前未处于大地图界面,不能使用GetBigMapScale方法
- 不在主界面,无法识别小地图坐标
- URL不能为空
AI-assisted analysis of babalae/better-genshin-impact@a7cb36712d (2026-08-13).
Data as JSON: /api/errors/255815ef2be88bbb.
Report an issue: GitHub.