Author Topic: Trouble targeting a ground item  (Read 2394 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
Trouble targeting a ground item
« on: August 24, 2012, 11:13:29 AM »
0
Hey guys, I wrote this script to make it a bit easier to get keys for Medusa. Everything works perfectly except when it goes to target the snake nest on the ground. I either get a message that target cannot be seen, or it targets a random tile. I cannot get the script to actually target the nest. I've tried to set the #ltargetkind to 1, 2, and 3 to no avail. Anyone have any suggestions?
Code: [Select]
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
; Script Name: Raz's Auto-Snake Charmer
; Author: Razeial
; Version: 1.0
; Purpose: Makes getting keys for Medusa easy!
;
;Instructions: Press Play
;
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
;======================================================
; Setup
;======================================================
if %setup <> #true
{
set %snake QE_JD
set %hole PBN
set %flute RGP_PGP
set %maxDist 8
set %setup #true
}
;======================================================
; Mainloop
;======================================================
mainloop:
finditem %snake G_8
if #findcnt < 1
   goto mainloop
set %targsnake #findid
wait 10
for %i 0 %maxDist
{
 finditem %hole G_ , %i
 if #findkind <> -1
 {
    event Property #findid
 }
 if nest in #property
 {
    set %targholeid #findid
    break
 }
}
wait 10
gosub FindFlute
gosub TargSnake
gosub TargHole
if #result = #false
   goto mainloop
wait 10s
goto mainloop
return
;======================================================
; Sub TargHole
;======================================================
Sub TargHole
if #targcurs = 1
{
 set %ltargetkind 2
 set #ltargetid %targholeid
 wait 10
 event macro 22 0
)
else
    return #false
return
;======================================================
; Sub TargSnake
;======================================================
Sub TargSnake
set #lobjectid %useflute
set %js #jindex
event macro 17 0
target
set #ltargetid %targsnake
set #ltargetkind 1
event macro 22 0
set %je #jindex
wait 10
for %cantPersuade %js %je
{
 scanjournal %cantPersuade
 if you_dont't_seem in #journal
    gosub TargSnake
 if
}
target
return
;======================================================
; Sub FindFlute
;======================================================
SUB FindFlute
finditem %flute C_ , #backpackid
event Property #findid
if charmer in #property
   set %useflute #findid
else
   {
    ignoreitem #findid
    gosub FindFlute
   }
if #findcnt < 1
   {
    display You have no flutes! Halting!
    halt
   }
return

Offline MeWonUo

  • Hero Member
  • *
  • Posts: 913
  • Activity:
    0%
  • Reputation Power: 11
  • MeWonUo barely matters.MeWonUo barely matters.
  • Gender: Male
  • Respect: +85
  • Referrals: 1
    • View Profile
Re: Trouble targeting a ground item
« Reply #1 on: August 24, 2012, 12:06:32 PM »
0
The snake holes for some reason don't appear to be an item that you can target.  I could be wrong, but when I did my testing I couldn't find any way to use #ltarget and event macro off of it. 

The only way I've been able to effectively hit the hole after charming a snake is to use a specific click location once you have found the location. 

Offline Alpha

  • Hero Member
  • *
  • Posts: 583
  • Activity:
    0%
  • Reputation Power: 10
  • Alpha barely matters.Alpha barely matters.
  • Respect: +44
  • Referrals: 0
    • View Profile
Re: Trouble targeting a ground item
« Reply #2 on: August 24, 2012, 12:51:40 PM »
0
Well... The way I had my script doing it was to pathfind to directly over the hole and then set a  Y_offset
of how far under your characters feet you want it to click.... Then I simply set a target cursor so you could target and called a sub like this...


set %Y_offset 11

Code: [Select]
Sub Click_Hole
set %Click_X ( #clileft + #CliXRes ) / 2
set %Click_Y ( ( #clitop + #cliYRes ) / 2 ) + %Y_offset 
While #targcurs = 1
  {
    click %Click_X %Click_Y
    wait 10
  }
Return

Tags: