ScriptUO

Official ScriptUO EasyUO Scripts => Scripting Tutorials => Topic started by: mmoore5325 on October 13, 2014, 07:28:13 PM

Title: Ok, total script noob here
Post by: mmoore5325 on October 13, 2014, 07:28:13 PM
I am trying to make a basic script.  Something simple that will learn me some basics but also do something functional.  I am trying to make a script that will organize gold checks/commodity deeds in that nice little fashion where they overlap each other and line up perfectly in a row.  This is my very first script.  I would appreciate any help someone could give me.
Here is what I have, and please, don't laugh.

gosub selectbag
gosub selectbag2
gosub movedeed

sub selectbag
    display ok Click ok and select bag
    set #targcurs 1
    while #targcurs = 1
          wait 2
    set %bag #ltargetid
    set #ltargetid %bag
    event macro 17
   
Return

sub selectbag2
   
 display ok Click ok and select bag to you want to put deeds in
    set #targcurs 1
    while #targcurs = 1
          wait 2
    set %bag2 #lobjectid
    set #ltargetid %bag2
    event macro 17

Return

sub movedeed
   
    findItem EWH C_, %bag

And thats all I got.  I know event macro 17 is last object.  I do not know how to make it open the bag that is targeted.  If someone could let me know how, after they select the bag, to have the bag open, I would appreciate it.  Then if someone could refer to me an example of a click and drag to x,y after I have opened the targeted bag, I would appreciate it.  I think contpos puts the gump in a spot of my choosing, then I could click and drag the deeds to the first coordinate, then coordinate +1, or something.  Am I on the right tracK?  Anything helps.  I'm totally new at this but really want to start making my own super secret 1337 scripts that I can brag about and release versions that are just a tease of what my full version,  But for now I will be happy organizing checks.
Title: Re: Ok, total script noob here
Post by: The Ghost on October 13, 2014, 08:34:30 PM
Here a sub that double click an item is you pack.

Code: [Select]
set %item XXX : insert ID of what you want to open or use.
sub DC_Item
   finditem %item C_ , #backpackid
    if #findcnt > 0
  {
    set #lobjectid #findid
    event macro 17
 }
 return
Title: Re: Ok, total script noob here
Post by: Endless Night on October 14, 2014, 07:00:43 AM
you are welcome to use any of my code snippets in this thread http://www.scriptuo.com/index.php?topic=2454.0

Of use to you might be: ENs MoveToContainor: http://www.scriptuo.com/index.php?topic=2454.msg71092#msg71092
Title: Re: Ok, total script noob here
Post by: mmoore5325 on October 14, 2014, 11:58:24 AM
Code: [Select]
sub movedeed
   
    findItem EWH C_, %bag

Would that work to find the check deed in the %bag that I set?
Title: Re: Ok, total script noob here
Post by: The Ghost on October 14, 2014, 05:42:34 PM
You forget a space after
yes should work.

Code: [Select]
sub movedeed
    findItem EWH C_ , %bag

You can event do that.  Will look into a bag and move amount into another bag.
Code: [Select]
sub Getboard
set %packy %box
finditem TLK C_ , %packy
exevent drag #findid  150
exevent dropc %turnbag
wait 30
return
Title: Re: Ok, total script noob here
Post by: mmoore5325 on October 14, 2014, 10:20:49 PM
Ok, I couldnt get this to work, maybe someone can tell me where I am going wrong.
Code: [Select]
set %bag
set %bag2
set %deed EHW


gosub selectbag
gosub selectbag2
gosub movedeed

sub selectbag
    display ok Click ok and select bag
    set #targcurs 1
    while #targcurs = 1
          wait 2
    set %bag #ltargetid
    set #ltargetid #lobjectid
    event macro 17

Return

sub selectbag2

 display ok Click ok and select bag to you want to put deeds in
    set #targcurs 1
    while #targcurs = 1
          wait 2
    set %bag2 #lobjectid
    set #ltargetid #lobjectid
    event macro 17

Return

sub movedeed

    findItem %deed C_ , %bag
    if #findcnt > 0
    {
    exevent drag #findid 1
    exevent dropc %bag2
    wait 30
    gosub movedeed
    }
    if #findcnt = -1
    display ok no deeds stopping
    halt

    return
Any help is greatly appreciated

Post Merge: October 14, 2014, 10:38:16 PM
i kind of understand your code
Code: [Select]
sub Getboard
set %packy %box
finditem TLK C_ , %packy
exevent drag #findid  150
exevent dropc %turnbag
wait 30
return
set %packy is my %bag
so

Code: [Select]
display ok click source bag
 #targcurs = 1
 while #targcurs = 1
 wait 2
 set %bag #ltargetid
 set #ltargetid #lobjectid
 event macro 17

display ok click destination bag
 set #targcurs = 1
 while #targcurs = 1
     wait 2
 set %bag2 #ltargetid
 set #ltargetid #lobjectid
 event macro 17

Those 2 pieces right there would be your %packy and %box
Code: [Select]
gosub movedeed
set %bag %bag2
what does that do?
Code: [Select]
finditem %deed _C , %bag

or i could use

finditem EHW _C , %bag
exevent drag #findid
(I'm lost right here too, you put 150, i am trying to move checks, I assume the 150 means 150 boards?)
exevent dropc %turnbag
(I don't know where this came from.  I am only trying to use 2 bags.  I am sure you just meant it as an example but I'm kind of lost.  I understand %packy and %box but not this.)
wait 30
(Then if I wanted to go back again to move another deed, and another, til there were no more deeds, i would...)
gosub movedeed

But is there a way to
if #findcnt > 0
 {gosub movedeed}
if #findcnt = -1
 {display ok no deeds.  stopping}

I can't get it to do that.  Once again, any help is appreciated trying to help me get my feet off of the ground.
Title: Re: Ok, total script noob here
Post by: Endless Night on October 15, 2014, 03:54:09 AM
open bag:  http://www.scriptuo.com/index.php?topic=2454.msg64244#msg64244