31
Script Debug / Sub ignore stuff for 3 minutes needs HELP!
« on: April 10, 2010, 02:54:09 PM »
So I thought this would be a good thing to bring the exceptional brains of this site together to work on a simple straight forward problem.
Ignoring something for 3 minutes, and then un-ignoring it.
Here's the background. UO Instanced Corpses take 3 minutes to reset to "public: where everything becomes accessible to anyone. In my looting script I can detect an instanced corpse. I'd like to loot your personal instance if possible, then ignore that corpse for 3 minutes until it goes public, and then loot it again.
Here's the sub I currently use, it's about as reliable as <insert something really unreliable here>
However it doesn't always work. it ignores stuf just fine, but then it get's stuck in ignored limbo and never get's re-looted. Any ideas? Better way of doing this? Improved version of this?
TM's Claw doesn't do this at all, so if we come up with a good solution it could benefit both scripts. Assuming TM wants to add it. I think it's worth it since there's a lot of group hunting in UO now, Doom, Peerless and SA bosses. And a lot of people don't loot everything. I always find plenty of left over ingredients on bosses for example, when hunting with people who are only there for arties or loot.
Ignoring something for 3 minutes, and then un-ignoring it.
Here's the background. UO Instanced Corpses take 3 minutes to reset to "public: where everything becomes accessible to anyone. In my looting script I can detect an instanced corpse. I'd like to loot your personal instance if possible, then ignore that corpse for 3 minutes until it goes public, and then loot it again.
Here's the sub I currently use, it's about as reliable as <insert something really unreliable here>
Code: [Select]
; IgnoreList====================
; %1 Item to ignore for 3 minutes
;===============================
SUB IgnoreList
{
SET %oldlpc #LPC
SET #LPC 10000
NAMESPACE PUSH
NAMESPACE LOCAL IgnoreList
IF !ignore_cnt = N/A
SET !ignore_cnt 0
SET !item #FALSE
IF %0 > 0
SET !item %1
FOR !i 1 !ignore_cnt
{
IF #SCNT > !time . !i && !ignore_cnt > 0
{
IGNOREITEM RESET !i
IGNOREITEM RESET !ignore_cnt
SET !time . !i !time . !ignore_cnt
SET !item . !i !item . !ignore_cnt
IGNOREITEM !item . !i !i
SET !ignore_cnt !ignore_cnt - 1
}
}
IF !item <> #FALSE
{
SET !ignore_cnt !ignore_cnt + 1
SET !item . !ignore_cnt !item
SET !time . !ignore_cnt #SCNT + 181
IGNOREITEM !item !ignore_cnt
}
NAMESPACE POP
SET #LPC %oldlpc
RETURN
}
The idea is to use two lists, or 1D arrays with corpse ID and the time it should be un-ignored. And then go through the list every time and check if the timer has expired, un ignoring it and rearranging the lists. It works like linked lists if you're C fluent...However it doesn't always work. it ignores stuf just fine, but then it get's stuck in ignored limbo and never get's re-looted. Any ideas? Better way of doing this? Improved version of this?
TM's Claw doesn't do this at all, so if we come up with a good solution it could benefit both scripts. Assuming TM wants to add it. I think it's worth it since there's a lot of group hunting in UO now, Doom, Peerless and SA bosses. And a lot of people don't loot everything. I always find plenty of left over ingredients on bosses for example, when hunting with people who are only there for arties or loot.