Repository navigation
ES API UO WaitingForJournalText
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
Inicio · C# · IDE · UO API · A–Z · Ejemplos · Idiomas
void UO.WaitingForJournalText(object? startTime, object? maxDelay, object? text);
void UO.WaitingForJournalText(object? startTime, object? maxDelay, object? text, object? equals);
void UO.WaitingForJournalText(object? startTime, object? maxDelay, object? text, object? equals, object? ignoreCase);
void UO.WaitingForJournalText(object? startTime, object? maxDelay, object? text, object? equals, object? ignoreCase, object? skillNameOrObjectId);Espera texto con modos de comparación adicionales y lanzamiento opcional de habilidades/elementos.
-
startTime: etiqueta obligatoria Now(), int milisegundos desde el inicio del tiempo de ejecución. Se marcan las líneas con una etiqueta no menor a startTime; 0 incluye entradas con una etiqueta cero. -
maxDelay— Espera máxima obligatoria en milisegundos. 0 y los valores negativos significan un paso inmediato en lugar de una espera infinita. -
text: la subcadena buscada o varias alternativas mediante |, por ejemplo, éxito|falló. Se eliminan los espacios en los bordes de cada alternativa y se omiten las alternativas vacías. Este es texto plano, no una expresión regular. Utilice una plantilla que no esté vacía. -
equals- Opcional int: 0 (predeterminado) - subcadena; valor distinto de cero: todo el texto debe coincidir con una alternativa. -
ignoreCase- Opcional int: 0 (predeterminado) - distingue entre mayúsculas y minúsculas; distinto de cero: ignorar. -
skillNameOrObjectId: habilidad opcional por nombre, cadena serial/hexadecimal o alias de objeto resoluble. Primero se reconoce el nombre de la habilidad; en caso contrario, se utiliza el objeto. 0/línea vacía deshabilita la acción. La habilidad/objeto se activa una vez antes de la búsqueda.
void: sin valor de retorno, no asigne la llamada a una variable. Cuando se completa, GetFoundedTextIndex >= 0 significa que la entrada seleccionada todavía está disponible; -1 - no encontrado/registro eliminado. GetFoundedTextID muestra la alternativa coincidente solo si la selección es exitosa.
- Busque y Journal/GetJournal/LastJournalMessage guarde el texto y los campos de una sola entrada en el script actual. Los mensajes nuevos no reemplazan estos campos. Si se elimina un registro de un diario limitado, los campos retenidos permanecen, pero LineIndex/GetFoundedTextIndex devuelven -1. La siguiente búsqueda o lectura selecciona otra entrada; una búsqueda fallida, un índice no válido y la limpieza mediante este script restablecen la selección.
- Encuesta con pausa hasta 25 ms; detener el guión lo interrumpe. Una lista vacía de alternativas no encuentra texto. Para obtener un resultado bool, utilice WaitJournalLine con sus propios parámetros y el significado de un tiempo de espera cero.
Cada ejemplo se puede guardar como un archivo independiente .csx y ejecutar en IDE. Las funciones de objeto UO y de espera proporcionan el anfitrión de la sesión de juego actual. Reemplace los nombres, coordenadas y direcciones de la demostración serial por los suyos propios.
Ejecuta este código en un archivo .csx independiente. Los argumentos aparecen en la llamada; sustituye los nombres, seriales y direcciones de ejemplo por los tuyos.
El comando es una instrucción independiente. El mensaje anterior indica el inicio de la llamada y no confirma una acción del servidor.
UO.Print("Calling UO.WaitingForJournalText");
UO.WaitingForJournalText(Now(), 2000, "notice");Parámetros y flujo de ejecución:
- startTime — marcar antes de esperar; maxDelay=2000 ms; comparación de subcadenas que distingue entre mayúsculas y minúsculas.
- El comando no devuelve true/false: la entrada seleccionada está marcada.
var started = Now();
UO.WaitingForJournalText(started, 2000, "notice");
if (Truth(UO.GetFoundedTextIndex() >= 0))
{
UO.Print(UO.GetFoundedText());
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parámetros y flujo de ejecución:
- startTime=0; maxDelay=0 - una pasada. es igual a1 - todo el texto, ignoreCase=1 - sin mayúsculas y minúsculas.
- Se muestra el número alternativo 0 o 1; una fila larga con palabras adicionales no funcionará.
return RunScenario();
object? RunScenario()
{
UO.WaitingForJournalText(0, 0, "success|failed", 1, 1);
if (Truth(UO.GetFoundedTextIndex() >= 0))
{
UO.Print(Convert.ToString(UO.GetFoundedTextID()));
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Parámetros y flujo de ejecución:
- El sexto argumento de Ocultar ejecuta la habilidad una vez. igual a =0 - subcadena, ignoreCase=1 - sin mayúsculas y minúsculas.
- Las palabras oculto/fallido son ejemplos, reemplácelos con el texto de su servidor. En lugar de una habilidad, puedes especificar serial o lastobject para usar el elemento.
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
var started = Now();
UO.WaitingForJournalText(started, 3000, "hidden|failed", 0, 1, "Hiding");
if (Truth(UO.GetFoundedTextIndex() >= 0))
{
UO.Print(UO.GetFoundedText());
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
private int Now() => global::ClassicUO.CSharp.CSharpScriptContext.Current.Now();
}C# distingue mayúsculas y minúsculas. Use el nombre UO exacto. Compare indicadores numéricos con 0; use bool solo si la firma devuelve bool.
UO.WaitingForJournalText(startTime, maxDelay, text) — UO.WaitingForJournalText(Integer,Integer,String)
Parámetros: startTime (Integer), maxDelay (Integer), text (String)
Resultado: void / Unit.
Durante la llamada:
-
InjectionScript.Runtime.InjectionApiUO.WaitingForJournalText. -
InjectionScript.Runtime.InjectionApiUO.WaitingForJournalText:WaitingForJournalText(startTime, maxDelay, text, 0, 0, InjectionValue.Zero).
Código interno de implementación; no es un script independiente.
public void WaitingForJournalText(int startTime, int maxDelay, string text)
=> WaitingForJournalText(startTime, maxDelay, text, 0, 0, InjectionValue.Zero);
UO.WaitingForJournalText(startTime, maxDelay, text, equals) — UO.WaitingForJournalText(Integer,Integer,String,Integer)
Parámetros: startTime (Integer), maxDelay (Integer), text (String), equals (Integer)
Resultado: void / Unit.
Durante la llamada:
-
InjectionScript.Runtime.InjectionApiUO.WaitingForJournalText. -
InjectionScript.Runtime.InjectionApiUO.WaitingForJournalText:WaitingForJournalText(startTime, maxDelay, text, equals, 0, InjectionValue.Zero).
Código interno de implementación; no es un script independiente.
public void WaitingForJournalText(int startTime, int maxDelay, string text, int equals)
=> WaitingForJournalText(startTime, maxDelay, text, equals, 0, InjectionValue.Zero);
UO.WaitingForJournalText(startTime, maxDelay, text, equals, ignoreCase) — UO.WaitingForJournalText(Integer,Integer,String,Integer,Integer)
Parámetros: startTime (Integer), maxDelay (Integer), text (String), equals (Integer), ignoreCase (Integer)
Resultado: void / Unit.
Durante la llamada:
-
InjectionScript.Runtime.InjectionApiUO.WaitingForJournalText. -
InjectionScript.Runtime.InjectionApiUO.WaitingForJournalText:WaitingForJournalText(startTime, maxDelay, text, equals, ignoreCase, InjectionValue.Zero).
Código interno de implementación; no es un script independiente.
public void WaitingForJournalText(int startTime, int maxDelay, string text, int equals, int ignoreCase)
=> WaitingForJournalText(startTime, maxDelay, text, equals, ignoreCase, InjectionValue.Zero);
UO.WaitingForJournalText(startTime, maxDelay, text, equals, ignoreCase, skillNameOrObjectId) — UO.WaitingForJournalText(Integer,Integer,String,Integer,Integer,Any)
Parámetros: startTime (Integer), maxDelay (Integer), text (String), equals (Integer), ignoreCase (Integer), skillNameOrObjectId (Any)
Resultado: void / Unit.
Durante la llamada:
-
InjectionScript.Runtime.InjectionApiUO.WaitingForJournalText. -
InjectionScript.Runtime.InjectionApiUO.SelectJournalEntry:SelectJournalEntry(null). -
InjectionScript.Runtime.InjectionApiUO.TriggerWaitAction:TriggerWaitAction(skillNameOrObjectId). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.JournalEntryCount:bridge.JournalEntryCount(). -
InjectionScript.Runtime.InjectionApiUO.ReadJournalSnapshot:ReadJournalSnapshot(index). -
InjectionScript.Runtime.InjectionApiUO.JournalEntryTime:JournalEntryTime(entry.Timestamp). -
InjectionScript.Runtime.InjectionApiUO.FindJournalPatternId:FindJournalPatternId(journalText, pattern, exactMatch, caseInsensitive). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Wait:bridge.Wait(Math.Min(25, Math.Max(1, timeout))).
Código interno de implementación; no es un script independiente.
public void WaitingForJournalText(int startTime, int maxDelay, string text, int equals, int ignoreCase, InjectionValue skillNameOrObjectId)
{
int timeout = Math.Max(0, maxDelay);
bool exactMatch = equals != 0;
bool caseInsensitive = ignoreCase != 0;
string pattern = text ?? string.Empty;
DateTime deadline = timeSource.Now.AddMilliseconds(timeout);
SelectJournalEntry(null);
TriggerWaitAction(skillNameOrObjectId);
do
{
int journalCount = Math.Max(0, bridge.JournalEntryCount());
for (int index = 0; index < journalCount; index++)
{
JournalEntrySnapshot entry = ReadJournalSnapshot(index);
int lineTime = entry == null ? -1 : JournalEntryTime(entry.Timestamp);
if (lineTime < 0 || lineTime < startTime)
continue;
string journalText = entry.Text;
int matchId = FindJournalPatternId(journalText, pattern, exactMatch, caseInsensitive);
if (matchId >= 0)
{
SelectJournalEntry(entry);
foundedTextId = matchId;
return;
}
}
if (timeSource.Now >= deadline)
break;
bridge.Wait(Math.Min(25, Math.Max(1, timeout)));
}
while (true);
}ClassicUO — Bad Newbie & C# Scripts IDE