I'm trying to write a new version of the transcript app that can keep track of multiple dialogue trees and that formats everything according to the RS wiki's formatting. I ran into this exception when trying to call DialogReader.read(). I'm not sure if I'm using the API wrong, or if this is an issue in the API.
Uncaught Error: System.InvalidOperationException: Could not execute method: bindGetRegion(1, -537, -693, 500, 1) ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentOutOfRangeException: Non-negative number required.
Parameter name: srcOffset
at System.Buffer.BlockCopy(Array src, Int32 srcOffset, Array dst, Int32 dstOffset, Int32 count)
at Runeapps.Alt1.ImageBuffer.Clone(Rectangle rect)
at Runeapps.Alt1.BoundObject.Alt1BoundObject.bindGetRegion(Int32 id, Int32 x, Int32 y, Int32 w, Int32 h)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at CefSharp.Internals.JavascriptObjectRepository.TryCallMethod(Int64 objectId, String name, Object[] parameters, Object& result, String& exception)
--- End of inner exception stack trace ---
at CefSharp.Internals.JavascriptObjectRepository.TryCallMethod(Int64 objectId, String name, Object[] parameters, Object& result, String& exception)
at transferImageData (webpack-internal:///../node_modules/@alt1/base/wrapper.ts:189:22)
at ImgRefBind.read (webpack-internal:///../node_modules/@alt1/base/imgref.ts:67:80)
at ImgRefBind.toData (webpack-internal:///../node_modules/@alt1/base/imgref.ts:29:21)
at DialogReader.readOptions (webpack-internal:///../node_modules/@alt1/dialog/index.ts:196:36)
at DialogReader.read (webpack-internal:///../node_modules/@alt1/dialog/index.ts:87:31)
at readDialog (webpack-internal:///./Dialog.ts:10:25)
at update (webpack-internal:///./index.ts:53:75)
The line that causes the exception appears to be the following:
var checkline = imgref.toData(dx, dy, Math.min(500, imgref.width - a), 1);
Here are the local variables at that line:

Here are the relevant parts of my code:
function update() {
// .....
let pos;
try {
pos = reader.find();
}
catch (e) {
debugHtml.innerText += "reader.find failed: " + JSON.stringify(e) + '\n';
return;
}
if (!pos) {
debugHtml.innerText += "reader.find failed\n";
return;
}
const dlg = readDialog(reader);
// ....
}
// .....
function readDialog(reader: DialogReader): TextDialog|OptionsDialog|null {
const read = reader.read();
if (read === null || read === false)
return null;
if (read.text)
return {
title: toTitleCase(read.title),
text: read.text.join(" ")
};
else
return {
title: toTitleCase(read.title),
options: read.opts.map((opt, i) => ({
text: opt.text,
index: i
}))
}
}
I have also tried calling find by passing in an ImageRef, with the same result:
const img = a1.captureHoldFullRs();
pos = reader.find(img);
I'm trying to write a new version of the transcript app that can keep track of multiple dialogue trees and that formats everything according to the RS wiki's formatting. I ran into this exception when trying to call DialogReader.read(). I'm not sure if I'm using the API wrong, or if this is an issue in the API.
The line that causes the exception appears to be the following:
Here are the local variables at that line:

Here are the relevant parts of my code:
I have also tried calling find by passing in an ImageRef, with the same result: