Author Topic: find count problem.  (Read 2497 times)

0 Members and 1 Guest are viewing this topic.

Offline camotbikTopic starter

  • Sr. Member
  • *
  • Posts: 349
  • Activity:
    0%
  • Reputation Power: 3
  • camotbik has no influence.
  • Gender: Male
  • Hello! I'm a UO addict.
  • Respect: +38
  • Referrals: 0
    • View Profile
find count problem.
« on: May 05, 2010, 10:00:00 AM »
0
It just keeps looping on grabing logs. Can't find the problem here

Code: [Select]
set %material ZLK
set %ready_material TLK
set %material_quanty 30
set %storage GBXVDND

repeat
finditem %material C_ , #BACKPACKID
if #FINDCNT <= 10
 {
finditem %ready_material C_ , #BACKPACKID
if #FINDCNT > 0
{
              gosub move_all %ready_material all #BACKPACKID %storage
            }
  gosub move %material %material_quanty %storage #BACKPACKID
 }
  while #charghost = yes
     wait 0
until #charghost = yes

sub move_all
finditem %1 C_ , %3
while #findcnt > 0
{
if %2 = all
exevent drag #FINDID #FINDSTACK
 else
  exevent drag #FINDID %2
   wait 10
    Exevent Dropc %4
     wait 1s
     finditem %1 C_ , %3
}
return

sub move
finditem %1 C_ , %3
if %2 = all
exevent drag #FINDID #FINDSTACK
 else
  exevent drag #FINDID %2
   wait 10
    Exevent Dropc %4
     wait 1s
return
What you witness -- is whatver..
uogamers hybrid.

Offline 12TimesOver

  • Another Day, Another Vendetta
  • Global Moderator
  • *
  • *
  • Posts: 3694
  • Activity:
    0%
  • Reputation Power: 41
  • 12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.
  • Gender: Male
  • Respect: +321
  • Referrals: 2
    • View Profile
Re: find count problem.
« Reply #1 on: May 05, 2010, 10:26:38 AM »
0
Quick first glance, are you missing some brackets in your Else statements in your subs?

Also,

Code: [Select]
repeat
...
  while #charghost = yes
     wait 0
until #charghost = yes

This will run infinitely. On one hand you are saying If you're a ghost sit and wait until you're not a ghost but, in the meantime, you're running the whole loop until your a ghost. The "Until" will never likely be true unless the ghost status changes in the tiny millisecond between the "WHILE" check and the "REPEAT" check thus the loop will always run. That might be ok if you want it to loop like that but you would be better off doing something like:

Code: [Select]
repeat
...
until #FALSE

as your loop.

When they come for me I'll be sitting at my desk
     with a gun in my hand wearing a bulletproof vest
My, my, my how the time does fly
     when you know you're gonna die by the end of the night

Offline camotbikTopic starter

  • Sr. Member
  • *
  • Posts: 349
  • Activity:
    0%
  • Reputation Power: 3
  • camotbik has no influence.
  • Gender: Male
  • Hello! I'm a UO addict.
  • Respect: +38
  • Referrals: 0
    • View Profile
Re: find count problem.
« Reply #2 on: May 05, 2010, 11:41:35 AM »
0
thank you for your reply. I have found a solution.

Code: [Select]
set %material ZLK
set %ready_material TLK
set %material_quanty 5
set %storage GBXVDND

repeat
finditem %material C_ , #BACKPACKID
if #FINDCNT < 0 || #FINDSTACK < 10
   {
 finditem %ready_material C_ , #BACKPACKID
 if #FINDCNT > 0
                {
                 gosub move_all %ready_material all #BACKPACKID %storage
                }
     gosub move %material %material_quanty %storage #BACKPACKID
    }
  while #charghost = yes
     wait 0
until #FALSE

sub move_all
finditem %1 C_ , %3
while #findcnt > 0
 {
  if %2 = all
     {
      exevent drag #FINDID #FINDSTACK
     }
  else
     {
      exevent drag #FINDID %2
      wait 10
      Exevent Dropc %4
      wait 1s
      finditem %1 C_ , %3
     }
}
return

sub move
finditem %1 C_ , %3
if %2 = all
   {
    exevent drag #FINDID #FINDSTACK
   }
else
   {
    exevent drag #FINDID %2
    wait 10
    Exevent Dropc %4
    wait 1s
   }
return
« Last Edit: May 05, 2010, 06:52:47 PM by camotbik »
What you witness -- is whatver..
uogamers hybrid.

Offline camotbikTopic starter

  • Sr. Member
  • *
  • Posts: 349
  • Activity:
    0%
  • Reputation Power: 3
  • camotbik has no influence.
  • Gender: Male
  • Hello! I'm a UO addict.
  • Respect: +38
  • Referrals: 0
    • View Profile
Re: find count problem.
« Reply #3 on: May 05, 2010, 07:07:14 PM »
0
I'm looking for some testers on this carpentry script wich makes barrel staves and drops them in to the bin. any critic would be nice.


Code: [Select]

set %material ZLK
set %ready_material BTL
set %material_quanty 100           
set %tools EGG_IGG
set %storage GBXVDND
set %tool_box GBXVDND
set %trash KHELNND
 
 
 
set #LOBJECTID %storage           
event macro 17                     
wait 1s                           
set #LOBJECTID %tool_box         
event macro 17                     
wait 1s                           
 
 
 
finditem %tools C_ , #BACKPACKID                             
if #FINDCNT > 0                                               
   {                                                           
      set #lobjectid #FINDID                                 
      event macro 17                                           
      gosub waitforgump 530_437
      gosub clickmod 27 93                                     
      gosub waitforgump 530_437
      gosub clickmod 235 93                                   
   }                                                           
else                                                         
   {                                                           
   finditem %tools C_ , %tool_box                             
   if #FINDCNT > 0                                           
      {                                                       
       gosub move %tools 1 %tool_box #BACKPACKID             
      }                                                       
   else                                                       
      {                                                       
       display ok You'r out of tools.                         
       halt                                                   
      }                                                       
   }                                                         
 
 
 
repeat
finditem %material C_ , #BACKPACKID                           
if #FINDCNT < 0 || #FINDSTACK < 10                           
   {                                                         
    finditem %ready_material C_ , #BACKPACKID                 
    if #FINDCNT > 0                                           
       {                                                     
        gosub move_all %ready_material all #BACKPACKID %trash 
       }                                                       
       finditem %material C_ , #BACKPACKID                     
       if #FINDCNT <= 0 || #FINDSTACK <= 10                   
          {                                                   
           finditem %material C_ , %storage                   
            if #FINDCNT <= 0 || #FINDSTACK <= 10             
               {                                             
                gosub move_all %ready_material all #BACKPACKID %trash   
                gosub move_all %material all #BACKPACKID %storage       
                display ok You'r out of resources.                       
                halt                                                     
               }                                                         
           gosub move %material %material_quanty %storage #BACKPACKID   
          }                                                             
    }                                                                   
    gosub make
  while #charghost = yes
     wait 0                                                             
until #FALSE                                                 
 
 
sub move_all
finditem %1 C_ , %3                   
while #findcnt > 0                     
   {                                   
    if %2 = all
       {                               
        exevent drag #FINDID #FINDSTACK 
       }                               
    else                               
       {                               
         exevent drag #FINDID %2       
        }                               
    wait 10                             
    Exevent Dropc %4                   
    wait 1s                           
    finditem %1 C_ , %3               
   }                                   
return                                 
 
sub move                               
finditem %1 C_ , %3                     
if %2 = all
   {                                   
    exevent drag #FINDID #FINDSTACK     
   }                                   
else                                   
   {                                   
    exevent drag #FINDID %2             
   }                                   
    wait 10                           
    Exevent Dropc %4                   
    wait 1s                             
return                                 
 
sub clickmod
   set %x #contposx + %1       
   set %y #contposy + %2       
   click %x %y %3             
return                         
 
sub waitforgump
set %timeout #scnt + 10     
while #contsize <> %1       
      {                     
      wait 1                 
      if #scnt > %timeout   
         {                 
          return #false     
         }                 
      }                     
wait 0                       
return #true                 
 
sub make
finditem %tools C_ , #BACKPACKID                                 
if #FINDCNT > 0                                                 
   {                                                             
    while #findcnt > 0                                           
      {                                                           
       set %current_tool #FINDID                                 
       set #lobjectid %current_tool                             
       event macro 17                                             
       finditem %current_tool C_ , #BACKPACKID                   
       while #findcnt > 0                                       
          {                                                       
           finditem %material C_ , #BACKPACKID                   
           if #FINDCNT < 0 || #FINDSTACK < 10                   
              {                                                   
               return                                             
              }                                                   
           gosub waitforgump 530_437
           finditem %current_tool C_ , #BACKPACKID               
           if #findcnt < 0                                       
              {                                                 
               return                                           
              }                                                 
           gosub clickmod 288 413                               
          }                                                     
       }                                                         
   }                                                             
else                                                             
   {                                                             
    finditem %tools C_ , %tool_box                               
     if #FINDCNT > 0                                             
        {                                                       
         gosub move %tools 1 %tool_box #BACKPACKID               
        }                                                       
     else                                                         
        {                                                       
        if #CONTSIZE 530_437
           {                                                     
            contpos 0 0                                         
            wait 10                                             
            click 0 0 r
           }                                                     
         gosub move_all %ready_material all #BACKPACKID %trash   
         gosub move_all %material all #BACKPACKID %storage       
         display ok You'r out of tools.                         
         halt                                                   
        }                                                         
    }                                                           
return               

« Last Edit: May 05, 2010, 07:38:33 PM by camotbik »
What you witness -- is whatver..
uogamers hybrid.

Scrripty

  • Guest
Re: find count problem.
« Reply #4 on: May 06, 2010, 03:09:49 PM »
0
My only critique at first glance is use Script UO because auto indent is your friend. :)  And so is check syntax.

Tags: