ScriptUO
Official ScriptUO EasyUO Scripts => Script Debug => Topic started by: razeial on September 12, 2014, 08:14:08 AM
-
So im writing a pot chugging script. The issue im having is when my character is holding a two handed weapon, the script will not disarm. However, when i step through the script line-by-line, the disarm works. I dont know where the error is.
sub ConsumeItem
while h in #charstatus || #LLIFTEDKIND = 1
{
wait 0
}
Finditem %1 C_ , #backpackid
retry:
if %1 = ZLF
{
event macro 58 0
goto skip
}
gosub TM_AdvJournalSync Apple
set #lobjectid #findid
event macro 17 0
if %1 = CBS
{
gosub TM_AdvJournalScan Apple VALID not_strong_enough
wait 10
if #result = #TRUE
{
goto retry
}
}
if %1 = NUF
{
gosub TM_AdvJournalScan Apple VALID free_hand
wait 10
if #result = #TRUE && %Disarm = #true
{
gosub Disarm
goto retry
}
if %disarm = #false
{
event ExMsg #charid 0 2498 Can't use cure pot with two handed weapon!
}
if %Disarmed = #true
{
set %Disarmed #false
event macro 37 0
wait 10
}
skip:
wait 10
return
sub Disarm
finditem %weapon C_ , #charid
set %CurWep #findid
exevent drag %CurWep
wait 10
exevent dropc #backpackid
wait 10
return
-
If it is doing it when stepped through but not normally, usually means you are having to wait time issues.
-
That was the first thing I though, but even if i set a 5 second wait time before executing the disarm, it still doesn't do it :-[
-
gosub TM_AdvJournalScan Apple VALID free_hand could be the culprit, since trying to find something in the journal is sometimes flaky, as I experienced while putting the assumed #journal entry into a msg. It may already behind and cluttered by subsequent entries.
-
You can keep the journal scan up to date by adding a sync after you do the scan. You can sync up right after a journal check by adding this to your calls:
gosub TM_AdvJournalScan Apple VALID_ADVANCE not_strong_enough ; note the ADVANCE added
But this is problematic if you are relying on the journal information for another call. It's always best to synchronize only if you find an entry (so everywhere you find your journal item successfully)
sub ConsumeItem
while h in #charstatus || #LLIFTEDKIND = 1
{
wait 0
}
Finditem %1 C_ , #backpackid
retry:
if %1 = ZLF
{
event macro 58 0
goto skip
}
gosub TM_AdvJournalSync Apple
set #lobjectid #findid
event macro 17 0
if %1 = CBS
{
gosub TM_AdvJournalScan Apple VALID not_strong_enough
wait 10
if #result = #TRUE
{
gosub TM_AdvJournalSync Apple
goto retry
}
}
if %1 = NUF
{
gosub TM_AdvJournalScan Apple VALID free_hand
wait 10
if #result = #TRUE && %Disarm = #true
{
gosub TM_AdvJournalSync Apple
gosub Disarm
goto retry
}
if %disarm = #false
{
event ExMsg #charid 0 2498 Can't use cure pot with two handed weapon!
}
if %Disarmed = #true
{
set %Disarmed #false
event macro 37 0
wait 10
}
skip:
wait 10
return
so there's a couple things to try. Make sure you have TM_AdvJournalSync somewhere in your code.