Author Topic: Problem found with #findCnt  (Read 5235 times)

0 Members and 1 Guest are viewing this topic.

Offline CervezaTopic starter

  • Hacksimus Maximus
  • Scripthack
  • *
  • Posts: 5857
  • Activity:
    0%
  • Reputation Power: 80
  • Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!
  • Gender: Male
  • So... Hows that Hopey-Changey thing working out?
  • Respect: +861
  • Referrals: 11
    • View Profile
Problem found with #findCnt
« on: July 19, 2010, 10:00:29 AM »
0
Lemme describe this problem then I'll show how I fixed it in my application:

If you use #findCnt to get the number of found items then go through the items one at a time, when the count reaches 0 it actually sets the number to 0 so no action can be taken on that item, because there isn't an item.

So in my detect hidden case, I looked for crates/boxes/chests etc... Lets say I found 6 of them. Now I detect hidden on one of them (6) then ignore it. Now I do the same to (5), (4), (3), (2), and finally (1). After that the count goes to 0.... which isn't a count or an id or anything really... so I fail my detect (no target) and wait 11 seconds.

If you use #findCnt in a script that is fast, like checking resources, getting bandages or something like that, then you have never noticed this because it just flies past it.... but when the count takes time, you can save 11 seconds each cycle.

Here's my fix.... sub reset is just the ignore item reset

set %count #findCnt
.....
if %count = 1
  gosub reset

That keeps the #findCnt from going to X which is what it shows after it counts down.

I also put in a safety in my detect loop

if %count = X
  return

But it should never be a true statement cause count will get to 1 then reset.
XXXXXXXXXX________________________________________] 20%
I've forgotten more about this game then most people will ever know.
Thank you for controlling your children. Their manners reflect your love for them.
Give a man a fish and you feed him for a day. Don't teach a man to fish, and you feed yourself. He's a grown man. Fishing's not that hard.

Offline baldielocks

  • Sr. Member
  • *
  • Posts: 301
  • Activity:
    0%
  • Reputation Power: 4
  • baldielocks has no influence.
  • Gender: Male
  • Respect: +94
  • Referrals: 5
    • View Profile
Re: Problem found with #findCnt
« Reply #1 on: July 19, 2010, 01:06:54 PM »
0
Could I use #findcnt to detect the number of containers in a container? Like my Sliem quester problem. No easy way to detect the number of boxes dropped in a box on the ground.

Offline CervezaTopic starter

  • Hacksimus Maximus
  • Scripthack
  • *
  • Posts: 5857
  • Activity:
    0%
  • Reputation Power: 80
  • Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!
  • Gender: Male
  • So... Hows that Hopey-Changey thing working out?
  • Respect: +861
  • Referrals: 11
    • View Profile
Re: Problem found with #findCnt
« Reply #2 on: July 19, 2010, 01:10:19 PM »
0
It's more of a "find how many of a type are around". It works directly with findItem returning how many of that item ID were found.

If your counting boxes on the ground, it would work. If you open a container and did a "finditem *" it would return the number of items found on that level of the container.
XXXXXXXXXX________________________________________] 20%
I've forgotten more about this game then most people will ever know.
Thank you for controlling your children. Their manners reflect your love for them.
Give a man a fish and you feed him for a day. Don't teach a man to fish, and you feed yourself. He's a grown man. Fishing's not that hard.

Offline CervezaTopic starter

  • Hacksimus Maximus
  • Scripthack
  • *
  • Posts: 5857
  • Activity:
    0%
  • Reputation Power: 80
  • Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!
  • Gender: Male
  • So... Hows that Hopey-Changey thing working out?
  • Respect: +861
  • Referrals: 11
    • View Profile
Re: Problem found with #findCnt
« Reply #3 on: July 19, 2010, 01:12:40 PM »
0
OH, on a side note... You know you can setup whatever you want on the right side of EUO right?

So you can put something like I did to figure out this problem...

finditem %boxes G ; find boxes on the ground
set %count #findCnt ; set my variable to use later

then on the right side I can add in %count and watch it go from 20 down to 1. That's how I saw it going 3, 2, 1, X

XXXXXXXXXX________________________________________] 20%
I've forgotten more about this game then most people will ever know.
Thank you for controlling your children. Their manners reflect your love for them.
Give a man a fish and you feed him for a day. Don't teach a man to fish, and you feed yourself. He's a grown man. Fishing's not that hard.

Scrripty

  • Guest
Re: Problem found with #findCnt
« Reply #4 on: July 19, 2010, 02:25:44 PM »
0
Why can't you finditem the number of boxes or bags in a container?

FINDITEM %containers C_ , %container2Search

Why wouldn't that work?  That would give you the number found as long as you had all their ids in the %containers variable...

Offline CervezaTopic starter

  • Hacksimus Maximus
  • Scripthack
  • *
  • Posts: 5857
  • Activity:
    0%
  • Reputation Power: 80
  • Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!
  • Gender: Male
  • So... Hows that Hopey-Changey thing working out?
  • Respect: +861
  • Referrals: 11
    • View Profile
Re: Problem found with #findCnt
« Reply #5 on: July 19, 2010, 03:04:42 PM »
0
But only for that level. If there's items inside of bags you won't get an accurate count of the entire container.

He's dumping stuff and wants to use dump bags.
XXXXXXXXXX________________________________________] 20%
I've forgotten more about this game then most people will ever know.
Thank you for controlling your children. Their manners reflect your love for them.
Give a man a fish and you feed him for a day. Don't teach a man to fish, and you feed yourself. He's a grown man. Fishing's not that hard.

Offline _C2_

  • AFK FtW
  • Global Moderator
  • *
  • *
  • Posts: 4077
  • Activity:
    0%
  • Reputation Power: 48
  • _C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!
  • RIP Pen Trick
  • Respect: +396
  • Referrals: 4
    • View Profile
Re: Problem found with #findCnt
« Reply #6 on: July 19, 2010, 03:06:16 PM »
0
here is the thing though about how i do detect.  i look for chests.... detect one wait 10s never ignore just redetect over and over.  i dont detect ever single chest just one at a time over and over.  the anti macro code is long gone so the scrit finding the same one over and over is not an issue.  i never ignore...

i see what you are saying but i dont think it runs like you are saying because i never ignore a chest.  now it could disapear before i get the detect off on rare occasion but that would be rare.  let me run t and observe it in action some more.  i totally get what you are saying but just don't se eit happening in my code as you described because i don't ignore one at a time.  i just keep scan detect one found... scan detect... over and over

Offline baldielocks

  • Sr. Member
  • *
  • Posts: 301
  • Activity:
    0%
  • Reputation Power: 4
  • baldielocks has no influence.
  • Gender: Male
  • Respect: +94
  • Referrals: 5
    • View Profile
Re: Problem found with #findCnt
« Reply #7 on: July 19, 2010, 03:11:30 PM »
0
My thoughts as well Twinkle McNugget. This is what i am working on for tonights update of the sliem quester. Think it will work? Also did a #findcnt = 0 check for item on ground. Thanks for bringing the topic up Cervesa, I had no t gotten to this variable yet!

Code: [Select]
sub check_ground
;%1 is type of item to move to a container on ground.
;%2 is type of item on ground to find.
;%3 is the max item limit in %2.
 
namespace push
namespace local check_ground
 finditem %1 C_ , #bacpackid
 set %item_in_pack #findid
 set %number_in_pack #findstack
finditem %2 G_2
 if #findkind = -1 || #findcnt = 0
return

 if findkind = 1 ;item on ground.
 {
  set %item_on_ground #findid
set #lobjectid #findid
event macro 17 0
finditem %1 C_ , #findid
if #findcnt < %3
{
 exevent drag %item_in_pack %number_in_pack
 wait %lagwait
 exevent dropc %item_on_ground
 wait %actionwait
 }
}
 namespace pop
 return

;--------------------------------

Offline _C2_

  • AFK FtW
  • Global Moderator
  • *
  • *
  • Posts: 4077
  • Activity:
    0%
  • Reputation Power: 48
  • _C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!
  • RIP Pen Trick
  • Respect: +396
  • Referrals: 4
    • View Profile
Re: Problem found with #findCnt
« Reply #8 on: July 19, 2010, 03:14:31 PM »
0
yeah just ran my detect in vesper inside a room with three chests.  counted to 10/11 each time in between and it is not missing a beat.  it rescans each time and finds a chest, sometimes the same one and detects.  there is no loss of 11 seconds.

I would hesitate to use #fincnt in vesper because by the time you get to the 2nd or 3rd chest, they may have disappeared and then it is a wasted attempt trying to find an objject that decayed and respawned as diff id while waiting inbetween moving through a findcnt list.

love #findcnt in other situations but it is just not justified in the way i wrote the detect sections in my odd ball skill trainer.  not that this fits perfectly into this conversation.

Love the findcnt = 0 look on ground!
« Last Edit: July 19, 2010, 03:16:05 PM by _C2_ »

Scrripty

  • Guest
Re: Problem found with #findCnt
« Reply #9 on: July 19, 2010, 03:18:00 PM »
0
And if you need anything ignored for a period of time, you should be using my ignore item sub.  It's the shizzle. :)  Well I think it is.  I can ignore any number of items for any amount of time you wish, and unignore them on time for you.  In the order of time ordered by time. :)  Say that 10 times fast.

Offline baldielocks

  • Sr. Member
  • *
  • Posts: 301
  • Activity:
    0%
  • Reputation Power: 4
  • baldielocks has no influence.
  • Gender: Male
  • Respect: +94
  • Referrals: 5
    • View Profile
Re: Problem found with #findCnt
« Reply #10 on: July 19, 2010, 03:35:50 PM »
0
@ _C2_ thanks! Looking at the sub after your post, I realized I could rearrange order a little. Fut finditem %1 after the ground check, to save time. Add in #findcnt > 0 to the find on ground pass check.

@Twinkle McNugget. In this case, I would want to ignore the full chest on ground until script runs out ( %loyalty >= 10000 ). Can i specify that in the sub? I have to take a look at it yet.

Scrripty

  • Guest
Re: Problem found with #findCnt
« Reply #11 on: July 19, 2010, 03:53:59 PM »
0
@ _C2_ thanks! Looking at the sub after your post, I realized I could rearrange order a little. Fut finditem %1 after the ground check, to save time. Add in #findcnt > 0 to the find on ground pass check.

@Twinkle McNugget. In this case, I would want to ignore the full chest on ground until script runs out ( %loyalty >= 10000 ). Can i specify that in the sub? I have to take a look at it yet.

You can ignore anything with it, for any amount of time, and unignore it when the timer you set is up.  In order of timer ignored by. :)  So if you ignored 1000 things for 2 minutes... they'd all unignore 2 minutes later... in order of when they were ignored...

Tags: