ScriptUO

Official ScriptUO EasyUO Scripts => Script Debug => Topic started by: coachcraig on November 29, 2011, 05:23:09 PM

Title: simple for you, but hard for this newbe
Post by: coachcraig on November 29, 2011, 05:23:09 PM
So this is my very first atempt at writing a script. I read the tutorials and tried to write a simple "First" script. LOL...well... the script is supposed to check to see if there are shoes in the backpack. If so, it's supposed to drag them and drop them on your pet goat. I've got the script to do everything but drop them on the goat. Just wanted to know if anyone could look at this and let me know what i'm doing wrong.

;=================================================================
; Script Name: The Shoe Eating Goat
; Author: Coachcraig
; Version: 1.0
; Shard Origin
; Revision Date: 11/29/2011
; Purpose: to get rid of those annoying shoes, boots, sandels and thigh boots
; Globals: None
;=================================================================
set %goat ZF
set %shoe PVI_AWI_ZVI_CWI_NVI_QVI_TVI_OVI



;==================Mainloop=============================
SUO:
repeat
gosub get_shoe_and_feed_goat
until #CharGhost = YES
while #CharGhost = YES
  wait 0
GoTo SUO



;==================Subloop=============================
sub get_shoe_and_feed_goat
findItem PVI_AWI_ZVI_CWI_NVI_QVI_TVI_OVI C_ , #backpackID
    if #findKind = -1
      return
event Drag #findID
wait 3
set #ltargetid %goat
exevent dropc %goat
Msg There ya go boy. Eat up.$
wait 5
return
Title: Re: simple for you, but hard for this newbe
Post by: TrailMyx on November 29, 2011, 05:27:41 PM
First thing is you can't really mix event drag and exevent drop.  You should use exevent drag
Title: Re: simple for you, but hard for this newbe
Post by: coachcraig on November 29, 2011, 05:32:03 PM
Ah I see. changed that but it still trys and drags the item over but it doesn't recognize the goat. Any idea as to why it's not seeing the goat?

and thank you for the response.
Title: Re: simple for you, but hard for this newbe
Post by: TrailMyx on November 29, 2011, 05:36:03 PM
Ok, next is you can't just used the #FINDTYPE of the goat.  You need the actual #FINDID of the goat.  You can either hardwire it in your code, or "target" your goat, then retrieve the #LTARGETID as that will be the #FINDID of your goat. 

Best of all is do a quick search around you to find any critter with the #FINDTYPE of ZF.  That should be your goat, and you can use that #FINDID.
Title: Re: simple for you, but hard for this newbe
Post by: coachcraig on November 29, 2011, 05:47:19 PM
that worked. You have no idea how much that means.  ;D
my first script with your help!!!

thank you TrailMyx very much
Title: Re: simple for you, but hard for this newbe
Post by: TrailMyx on November 29, 2011, 06:02:45 PM
that worked. You have no idea how much that means.  ;D
my first script with your help!!!

thank you TrailMyx very much

I'm glad you figured it out!  Congrats on your first script.  I guarantee the next one will be easier now that you have the first one under your belt.  ;)
Title: Re: simple for you, but hard for this newbe
Post by: Crome969 on November 29, 2011, 10:25:51 PM
Another  suggestion:
Code: [Select]
findItem PVI_AWI_ZVI_CWI_NVI_QVI_TVI_OVI C_ , #backpackID+
Why define variable when u dont use?Replace
Code: [Select]
PVI_AWI_ZVI_CWI_NVI_QVI_TVI_OVI it with %Shoe
Title: Re: simple for you, but hard for this newbe
Post by: coachcraig on November 30, 2011, 04:23:43 AM
i did last night. i got to looking at it a little more closely and this is the new script and even took out an extra line of code. and thank you for your input.  ;)
i'm so excited to get my first done. now i'm on to tackling other tasks and once i learn basics and get used to scripting i hope to contribute to the community.
;=================================================================
; Script Name: The Shoe Eating Goat
; Author: Coachcraig
; Version: 1.0
; Shard OSI / FS: OSI / FS OK
; Revision Date: 11/29/2011
; Purpose: to get rid of those annoying shoes, boots, sandels and thigh boots
; Globals: None
;=================================================================
;add you goat's #findID here
set %goat DBVFUB

;shoe types are set here
set %shoe PVI_AWI_ZVI_CWI_NVI_QVI_TVI_OVI



;==================Mainloop=============================
SUO:
Msg All Follow Me$
repeat
gosub get_shoe_and_feed_goat
until #CharGhost = YES
while #CharGhost = YES
  wait 0
GoTo SUO



;==================Subloop=============================
sub get_shoe_and_feed_goat
findItem %shoe C_ , #backpackID
    if #findKind = -1
      return
exevent Drag #findID
wait 10
exevent dropc %goat
Msg There ya go boy. Eat up.$
wait 15
return
Title: Re: simple for you, but hard for this newbe
Post by: camotbik on November 30, 2011, 04:53:31 AM
congrads, but next time please put your code in to the code tags
Title: Re: simple for you, but hard for this newbe
Post by: Crome969 on November 30, 2011, 06:56:06 AM
congrads, but next time please put your code in to the code tags
Alternate : Attach the scriptfile:) that saves Space to talk;)