Author Topic: New issue. Need help  (Read 3319 times)

0 Members and 1 Guest are viewing this topic.

Offline razeialTopic starter

  • Jr. Member
  • **
  • Posts: 31
  • Activity:
    0%
  • Reputation Power: 1
  • razeial has no influence.
  • Respect: +2
  • Referrals: 0
    • View Profile
New issue. Need help
« on: September 12, 2014, 08:14:08 AM »
0
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.

Code: [Select]
  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
Code: [Select]
  sub Disarm
  finditem %weapon C_ , #charid
  set %CurWep #findid
  exevent drag %CurWep
  wait 10
  exevent dropc #backpackid
  wait 10
  return

Offline Tidus

  • Lazy
  • Administrator
  • *
  • *
  • Posts: 1291
  • Activity:
    0%
  • Reputation Power: 15
  • Tidus is working their way up.Tidus is working their way up.Tidus is working their way up.
  • Gender: Male
  • Mind Blown
  • Respect: +151
  • Referrals: 2
    • View Profile
    • Ultimate Apparel
Re: New issue. Need help
« Reply #1 on: September 12, 2014, 11:04:50 AM »
0
If it is doing it when stepped through but not normally, usually means you are having to wait time issues.
For those who have fought for it, freedom has a taste the protected will never know ~ Anonymous, Vietnam, 1968

Offline razeialTopic starter

  • Jr. Member
  • **
  • Posts: 31
  • Activity:
    0%
  • Reputation Power: 1
  • razeial has no influence.
  • Respect: +2
  • Referrals: 0
    • View Profile
Re: New issue. Need help
« Reply #2 on: September 12, 2014, 03:49:08 PM »
0
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  :-[

Offline TaskForce

  • Jr. Member
  • **
  • Posts: 16
  • Activity:
    0%
  • Reputation Power: 1
  • TaskForce has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: New issue. Need help
« Reply #3 on: September 17, 2014, 12:34:44 AM »
0
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.

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13301
  • Activity:
    0%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: New issue. Need help
« Reply #4 on: September 17, 2014, 08:09:54 AM »
0
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:

Code: [Select]
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)

Code: [Select]
 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.
Please read the ScriptUO site RULES
Come play RIFT with me!

Tags: