Author Topic: Ore looter issues  (Read 3089 times)

0 Members and 1 Guest are viewing this topic.

Offline decloTopic starter

  • Jr. Member
  • **
  • Posts: 90
  • Activity:
    0%
  • Reputation Power: 2
  • declo has no influence.
  • Respect: +16
  • Referrals: 1
    • View Profile
Ore looter issues
« on: March 21, 2016, 03:29:49 PM »
0
I have a written a small script that uses Snicker7's s7smeltonbeetle to loot ore off elementals.  The problem is sometimes it opens the corpse and does nothing but hide it.  It doesn't smelt the ore or loot the gems.  And when there is no corpse, it moves my backpack.  Any help would be really appreciated!!

Code: [Select]

set %loot HVF_UVF_FVF_EVF_OVF_VUF_GVF_RVF_BVF_VVF_NVF_ZVF_

event macro 3 0 All follow me

Start:
finditem YFM G_2
if finditem <> -1
{
set #lobjectid #findid
set %oreContainer #findid
event macro 17 0
wait 1s
contpos 100 0
wait 1s
gosub s7SmeltOnBeetle %oreContainer
  wait 1s
gosub gems
  wait 1s
hideitem %oreContainer
}
goto start:


;==============Loot Jewels============
sub gems
Gms:
finditem %loot C_ , %oreContainer
if #findkind = -1
{
return
}
exevent drag #findid #findstack
wait 20
exevent DropC #backpackid
wait 27
goto gms


;==============Smelt Ore============
;----
;* @name s7SmeltOnBeetle
;* @author snicker7
;* @ver 1.1 13Feb05
;* @purpose smelt all ore in specified container
;*      (default: backpack) on a firebeetle within
;*      2 tiles.
;* @params      %1      (optional) the container from
;*                      which to smelt ore. if none is
;*                      specified it defaults to backpack.
;* @returns     #true   if all ore was successfully smelted
;*              #false  fire beetle was not found within 2 tiles.
;* @notes props to Quintok for the specify container idea.
;* @example: gosub s7SmeltOnBeetle %oreContainer
;* @status done
;----
sub s7SmeltOnBeetle
        set #result #backpackid
        if %0 > 0 && %1 <> N/A
                set #result %1
        ignoreitem reset s7IOre
        finditem JJ G_2    ;jj
        if #findkind = -1
                return #false
        set #ltargetid #findid
        set #ltargetkind 1
        s7SmOB:
        finditem DWJ_EWJ_GWJ_TVJ C_ , #result
        if #findkind <> -1
        {
                if ( ( #findtype = TVJ && #findstack >= 2 ) || #findtype <> TVJ )
                {
                        set #lobjectid #findid
                        event macro 17 0
                        target
                        event macro 22 0
                        wait 10
                }
                if #findtype = TVJ && #findstack < 2
                        ignoreitem #findid s7IOre
                goto s7SmOB
        }
return #true



Offline lydaan

  • Jr. Member
  • **
  • Posts: 70
  • Activity:
    0%
  • Reputation Power: 3
  • lydaan has no influence.
  • Respect: +6
  • Referrals: 0
    • View Profile
Re: Ore looter issues
« Reply #1 on: March 22, 2016, 01:35:24 AM »
0
well here's one mistake:

Code: [Select]
set %loot HVF_UVF_FVF_EVF_OVF_VUF_GVF_RVF_BVF_VVF_NVF_ZVF_

event macro 3 0 All follow me

Start:
finditem YFM G_2
if finditem <> -1   <----- mistake...

should be:

Code: [Select]
if #findkind <> -1
maybe that will fix?

*edit*

ok, was looking at this more, and I recommend writing your gem sub without the #findkind return thing, though that IS a very interesting and inventive way to write that. This is not technically any better, but will reduce the *cringe* factor for inspectors of your script.

Code: [Select]
sub gems
finditem %loot C_ , %oreContainer
for #findindex 1 #findcnt
{
       exevent drag #findid #findstack
       wait 20
       exevent DropC #backpackid
       wait 27
}
return

all in all, not a bad job. That first fix will probably work fine without this, but this is much better scripting practice. :)
« Last Edit: March 22, 2016, 02:01:05 AM by lydaan »

Offline decloTopic starter

  • Jr. Member
  • **
  • Posts: 90
  • Activity:
    0%
  • Reputation Power: 2
  • declo has no influence.
  • Respect: +16
  • Referrals: 1
    • View Profile
Re: Ore looter issues
« Reply #2 on: March 22, 2016, 05:19:15 AM »
0
Awesome!! Thank you so much!!

Offline decloTopic starter

  • Jr. Member
  • **
  • Posts: 90
  • Activity:
    0%
  • Reputation Power: 2
  • declo has no influence.
  • Respect: +16
  • Referrals: 1
    • View Profile
Re: Ore looter issues
« Reply #3 on: March 22, 2016, 12:53:03 PM »
0
ok, was looking at this more, and I recommend writing your gem sub without the #findkind return thing, though that IS a very interesting and inventive way to write that. This is not technically any better, but will reduce the *cringe* factor for inspectors of your script.

Code: [Select]
sub gems
finditem %loot C_ , %oreContainer
for #findindex 1 #findcnt
{
       exevent drag #findid #findstack
       wait 20
       exevent DropC #backpackid
       wait 27
}
return

all in all, not a bad job. That first fix will probably work fine without this, but this is much better scripting practice. :)
[/quote]

Quick question to understand, the "for #findindex 1 #findcnt" repeats 1 thru #findcnt correct?  So if #findcnt was 3, it would loop 3 times, then return?

Offline lydaan

  • Jr. Member
  • **
  • Posts: 70
  • Activity:
    0%
  • Reputation Power: 3
  • lydaan has no influence.
  • Respect: +6
  • Referrals: 0
    • View Profile
Re: Ore looter issues
« Reply #4 on: March 22, 2016, 06:15:12 PM »
0
yes, and using #findindex as the counter iterates through each indexed id.

Tags: