Author Topic: Looking for pointers  (Read 7083 times)

0 Members and 1 Guest are viewing this topic.

Offline SardornTopic starter

  • Jr. Member
  • **
  • Posts: 34
  • Activity:
    0%
  • Reputation Power: 2
  • Sardorn has no influence.
  • Respect: +2
  • Referrals: 0
    • View Profile
Looking for pointers
« on: August 13, 2011, 06:09:30 PM »
0
Good day

I'm on a mission. I'm an extreme novice when it comes to writing scripts. I have a basic understanding of what is going on when I read through them, in my younger years I learned the basics of Vbasic going blind entering in 100000's of lines of 'if then goto', but writing a scipt myself has left me a bit on the frustrated side. A while back I decided I wanted to write a simple script to move stacks of yarn balls from my backpack to a secure. I failed. I yelled. I swore. I gave up. Today the flame of wanting this has been rekindled.

Here's my new goal:

target a secure which will contain wool and cotton
use all of one on the wheely thing
move stacks of thread/yarn to secure as they're made
once all cotton and wool are gone switch to using yarn/thread on stringy thing
move bolts of cloth into secure
end

Seems rather complex for a first script but I have a feeling it wont be all that difficult once I get going. Here's where I need some help. The tutorials I read were very well done here, but I couldnt find anything on dragging stacks, setting a location for dragging to, or much on subs and loops. Did I overlook them?

I'm guessing the basic layout will be something like:

Setup: (to get all the ID's)
 target/set secure
 target/set wheely thing(s) -eventually using more then one but for now..one
 target/set stringy thing
--
Main:
 open and position secure on screen
 open and position backpack on screen (not sure if these would be in the main loop)
    Thread:
      look for cotton in secure if <0 use on wheely thing if =0 goto Yarn
      wait for wheely thing to finish
      drag stack of thread to secure
      repeat

    Yarn:
      same as thread using wool TYPE and yearn TYPE instead
      if =0 goto Tbolt

    Tbolt:
      look for spools of thread in secure if <5 (or whatever the amount is to make bolts) use on stringy thing if >5 goto Ybolt
      wait 1 second
      repeat 5 times
        drag bolt to secure

    Ybolt:
      Same as Tbolt replacing #needed if >#
         halt
end (not sure if end would be needed since everything is step by step finalizing with halt after the last group is out of materials.)
--
That's my basic plan, not a fast get'r'done script but for the time, just something to make me feel like a script writer! Main points I need help with, obviously the actual commands and syntax. Also opening containers and positioning them on screen. And would this work? will it drag stacks from my pack to an open secure containing the same items? or will it confuse it to just keep grabbing and dropping into the same container?
Any and all help, suggestions, pointers, directions and information is accepted with open arms.

Thanks!

Offline Goliath

  • Sr. Member
  • *
  • Posts: 424
  • Activity:
    0%
  • Reputation Power: 5
  • Goliath has no influence.
  • Gender: Male
  • Respect: +37
  • Referrals: 2
    • View Profile
Re: Looking for pointers
« Reply #1 on: August 13, 2011, 09:19:34 PM »
0
Although I do not have your answers I too will be hoping to attempt my first script soon.  You are in good hands here with these guys.  I hope to read more on this and see you making progress... don't give up.

Offline Guadah

  • Full Member
  • ***
  • Posts: 119
  • Activity:
    0%
  • Reputation Power: 3
  • Guadah has no influence.
  • Gender: Male
  • Who farted?!
  • Respect: +29
  • Referrals: 3
    • View Profile
    • L%N Website
Re: Looking for pointers
« Reply #2 on: August 14, 2011, 01:11:40 AM »
0
I learned by reading through other (working) scripts and trying to understand what code was performing what actions in the game.  From there I just start attempting simple things in small scripts and growing upon that.  To be honest without TM Cake and the gang I would have never completed 95% of my active scripts.

When in doubt, ask.

Take a look at my Cartography Trainer (posted below).  In that script I target / set and relocate a Secure Chest (%resource_chest), Tool Bag and my Trash Barrel.  That part of the code is up near the top.  For the most part I'm kind of OCD about my codework, so it should be pretty easy to read.

That should get you started.  Take a look at others work also, and come up with a style that fits yourself... and GROW!

Good luck and again.  When in doubt, just ask.

There are 1 attachment(s) in this post. You must register and post an acceptable introduction to download
Guadahs Cartography Trainer.euo

Offline SardornTopic starter

  • Jr. Member
  • **
  • Posts: 34
  • Activity:
    0%
  • Reputation Power: 2
  • Sardorn has no influence.
  • Respect: +2
  • Referrals: 0
    • View Profile
Re: Looking for pointers
« Reply #3 on: August 14, 2011, 07:39:48 AM »
0
Wonderful, thank you!

Quote
I learned by reading through other (working) scripts and trying to understand what code was performing what actions in the game

made me think of


Anyway! How do you determine the position? I was able to figure out that :
Code: [Select]
set %catposx 30
set %catposy_map 90
set %selposx 230[/li]
Is the position setter. Is there a map that determines the locations vs coordinates? If EUO was updated I would just throw random numbers in and figure this out, but since it's not I'll ask!

Thanks again!

Follow up question and I think I know the answer, but when setting the ID's

Code: [Select]
set %cart_tool CXF
set %blank_scroll DPF
set %crafted_map XVH

are the %items predefined? or can you use whatever you wish? such as:

Code: [Select]
set %writerjobber_with_feather CXF
set %overpriced_rolled_paper DPF
set %pretty_drawing XVH

Thanks thanks again
« Last Edit: August 14, 2011, 10:10:05 AM by Sardorn »

Offline Guadah

  • Full Member
  • ***
  • Posts: 119
  • Activity:
    0%
  • Reputation Power: 3
  • Guadah has no influence.
  • Gender: Male
  • Who farted?!
  • Respect: +29
  • Referrals: 3
    • View Profile
    • L%N Website
Re: Looking for pointers
« Reply #4 on: August 14, 2011, 10:51:06 AM »
0
Anytime you see %word, that is a Variable.  You can make that WHATEVER you want.  I try to keep it simple and name it close to what it truly is.  %sewing_kit for me is the sewing kit id.  However you can name it %frog if you like.  When you see something named with a #, that is predetermined and you can not change that.  You can NOT do:

set #backpackid WERSDFD.  #backpackid is already preset as your backpack's id.

Check out the Documentation at EasyUO.  There is a pretty easy tutorial there also for most of this, and I double check my work from there a lot of the time (like with Event Macro commands)

As for the location.  On the bottom of EasyUO when you move the mouse around there are two sets of numbers.  x and y.  Now to get the contposx and contposy that I use for Menus, you have to drag the menu to the top left of the UO screen and make it flush.  Then move the mouse curser to where you want it, check easyuo and waala.  That, at least, is how I do it.

Offline Crome969

  • Elite
  • *
  • *
  • Posts: 2098
  • Activity:
    0%
  • Reputation Power: 25
  • Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.
  • Gender: Male
  • UO Enthusiast
  • Respect: +211
  • Referrals: 10
    • View Profile
    • ScriptSDK
Re: Looking for pointers
« Reply #5 on: August 14, 2011, 11:56:30 AM »
0

Offline Neo

  • Prime Program
  • Elite
  • *
  • *
  • Posts: 821
  • Activity:
    0%
  • Reputation Power: 13
  • Neo barely matters.Neo barely matters.
  • Respect: +155
  • Referrals: 3
    • View Profile
Re: Looking for pointers
« Reply #6 on: August 14, 2011, 06:23:48 PM »
0
I wrote the script down for you, doing the stuff that I think you meant it to do... I commented each part in detail in the form of a tutorial so that you can learn how each thing is done, and hopefully you can understand better how a script works.
So, here it is, hope you find it useful!
Code: [Select]
; Well, I don't know how much you know about scripting
; so I'm going to try and keep it as simple as I can for
; the main purpose of this script. If you ever don't understand
; a step I used here, just ask me, or look that name up
; at http://wiki.easyuo.com/ you will find good explanations
; there to most things you can need.
;
; As with any script, let's start by setting the variables
; we're going to use. You start a variable with '%' and you
; can name it whatever you want. Then you just have to know the types
; of each item you need, and set those variables to those types.
; To know an item type, just double click it, and then check your
; EUO window and look up the value of #lobjecttype. This will be
; the item type we're going to set.
;------------------------------------------------------------------
set %yarn NLF_PLF_QLF_ ; there are 3 yarn types, as far as I know, we use _ to set different things to 1 var
set %cotton NFF
set %wool OFF
set %bolt ZZF
set %thread UAG

; Don't worry about the loom and the spinning wheel. We're going to
; be setting them through our menu.
; Menu? That's right, it's always easier for any user to do stuff
; just clicking a menu. So we'll use one.
; Before we get to that, I want to tell you a little about how a sub works.
; I've copied this from another little tutorial I wrote:
;
; " Next, the most basic yet very important thing you should
; know is how subs work. You always use 'gosub subname'
; to go to a sub, however, you should only get out
; of a sub using 'return'. This will take you
; back to where the sub was called in the
; first place (the gosub line). "
;---------------------------------------------------------------
; For this little script, we're going to use individual subs for
; every function we need done. The first sub is the one to generate
; our menu. If you want to take a look at it, scroll down to the
; menu sub (sub menu)
; Now we are going to 'call' the menu, using gosub {sub name}
;----------------------------------------------------------------
gosub menu ;this line here will go to the sub named 'menu', and execute
; all the lines there, until it finds a return, and it will come back
; right here. So once that's all done, the user should be seeing our
; menu on his screen. Now we must know how to work with the menu buttons.
; A good way to do this, is writing separate subs for each menu button
; that is clicked. The system variable #menubutton will hold the information
; on the last button that was clicked in the menu. Before any button is
; pushed, the #menubutton var is going to be N/A. Knowing all that, we can
; write our main loop:
;-------------------------------------------------------------------
;======= Main Loop =======
repeat
if #menubutton <> N/A
gosub #menubutton
until #false
;======= End Loop =======

; So how does this loop work? Let's first understand what it's telling
; us line by line.
; Line 1: if #menubutton <> N/A is exactly what it looks like.
; As soon as the #menubutton var is different from N/A, it will perform the next
; line. Once, a user clicks a button, this will be true. So let's take a look at the next line.
;
; While the #menubutton var is equal to N/A, we're gonna do nothing.
; Now, remember what I told you about how buttons work in a menu?
; So, if we click any button, the #menubutton var will be set to
; that button name. So, once this happens, the #menubutton var
; will be different from N/A and we'll go to the gosub line,
; to go to a sub that
; has the name set to our #menubutton var. In other words, it will go to
; the sub that has the name of the menu button we just clicked.
; Great stuff huh?
;-------------------------------------------------------------------
; Now we have to create a sub for each button that is clicked, with the
; name of the corresponding button name. You can just scroll down to
; the menu sub to find the button names I used. So, let's write the
; sub for when the user clicks the resource_button.
; First we need to think: what do we want to happen once that button
; is clicked? The point of that button is to set your Secure Container,
; where you will put your cotton, wool, etc in. Alright, so let's get
; that done!
;---------------------------------------------------------------------

;======= resource_button sub =======
sub resource_button ; 1
event sysMessage Target your secure ; 2
set #targcurs 1 ; 3
while #targcurs = 1 ; 4
wait ; 5
set %resource #ltargetid ; 6
set #lobjectid #ltargetid ; 7
event macro 17 ; 8
wait 20 ; 9
set #menubutton N/A ; 10
return ; 11
;======= end sub =======

; Ok, I put numbers beside each line for reference. I'm going to quickly
; go through all of them.
; 1) sub { name of the sub }, in this case resource_button,
;    this line is where it goes to when we use "gosub { name of the sub }"
; 2) event SysMessage will show a message inside the user's UO window,
;    so he will see a msg to target his secure.
; 3) set #targcurs 1 will change that hand cursor into that little
;    target thing.
; 4 & 5 ) It will wait while that target thing is active, in other words,
;         it will only perform line 6 once you click something.
; 6) After you click something, the target cursor will disappear, and
;    we'll go to this line. The id of the thing you clicked will be
;    set in the system variable #ltargetid. So this line will set
;    our variable %resource to the last target, or the container we clicked.
; 7 and 8) We are going to set #lobjectid to this same value. Why? So that
;          we can use the command Event Macro 17, which will "use" the
;          item with the id set in the #lobjectid variable. So this will
;          open up the user's container.
; 9) wait 20 is just a little wait for the container to be opened
; 10) Remember that our loop will wait until the #menubutton var is different
;     than N/A to do stuff. The user had clicked the resource_button to come here
;     so, if we just return right now, the script will go into an endless loop
;     going to this sub, and back there. So we must set the #menubutton var
;     back to N/A before we use the 'return'.
; 11) Finally, everything is done here, and we can return back to the main loop
;     to wait for another #menubutton to be clicked. Right on !
;------------------------------------------------------------------------
; Alright, now let's write the subs for the other buttons.
; Let's start with the bolt_button, used for targetting a container
; to put our bolts in. It's pretty similar to the sub we just wrote, so
; let's get to it!
;------------------------------------------------------------------------

;======= bolt_button =======
sub bolt_button
event sysMessage Target a container for you bolts
set #targcurs 1
while #targcurs = 1
wait
set %boltbag #ltargetid
set #menubutton N/A
return
;======= end sub =======

;------------------------------------------------------------------------
; Only difference you should notice here, is that I didn't set to open
; this container. Why, you ask? Because we're just gonna put stuff in it,
; so there's no real need to open it. In fact, it's best to leave it closed
; so that there's no danger of confusing the bolts in our backpack with the
; bolts inside this bag.
;-----------------------------------------------------------------------
; Now let's write the subs to set the loom and the wheel. Same deal
; as we just did so far.
;------------------------------------------------------------------------

;======= loom_button =======
sub loom_button
event sysMessage Target your loom
set #targcurs 1
while #targcurs = 1
wait
set %loomid #ltargetid
set %loomkind #ltargetkind
set #menubutton N/A
return
;======= end sub =======

;======= wheel_button =======
sub wheel_button
event sysMessage Target your spinning wheel
set #targcurs 1
while #targcurs = 1
wait
set %wheelid #ltargetid
set %wheelkind #ltargetkind
set #menubutton N/A
return
;======= end sub =======

;-----------------------------------------------------------------------
; One thing you should notice here is %wheelid and %wheelkind (same for loom)
; This is just to make sure we set the correct kind of target kind when
; we are going to be targetting them in the 'making bolts part'.
; The target kinds are:
; 1) Objects, 2) Ground, 3) Resource
; If you want to know more on that, look it up on the easyuo wiki. :)
; Yes, it's done! Now we just need to create the subs which will perform
; the real intended actions of this script. :D
; The button responsible for this is the start_button, so our original sub
; name is going to be...? You guessed it! sub start_button. Now, before we
; get to that, let's think what we need done, once this button is pressed.
; First thing, is have it check if all the ID's we need have been set,
; otherwise it's not gonna work. Next we should think about what we're gonna
; do with the stuff. So, basically, we need to do the following things:
; - Use all the wool on the spinning wheel and put the yarns in the secure.
; - Use all the cotton on the spinning wheel and put all the thread in the secure
; - Use all the thread on the loom, and put the bolts in the bolt container.
; - Use all the yarn on the loom, and put the bolts in the bolt container.
; Ok, that's basically all we need. So, I think the simplest way to do this
; is using a separate sub for each of these parts, until they are all done.
; And we're going to call them all from the start_button sub. So now we have
; an idea on how this sub is gonna look. So let's write it down:
;----------------------------------------------------------------------------

;======= start_button =======
sub start_button
if %resource = N/A
   {
   Display You must set your secure
   set #menubutton N/A
   return
   }
if %boltbag = N/A
   {
   Display You must set your bolt container
   set #menubutton N/A
   return
   }
if %loomid = N/A
   {
   Display You must set the loom you're using
   set #menubutton N/A
   return
   }
if %wheelid = N/A
   {
   Display You must set the wheel you're using
   set #menubutton N/A
   return
   }
; alright, the checking part is done. If one of the above
; variables isn't set, it will be N/A. If it's N/A, the #menubutton will
; be set back to N/A and it will return to the main loop, where
; the user can then set his stuff properly. Great! Now let's just write down
; the gosub's we're going to use, in the order we want them to be called.
gosub wool
gosub cotton
gosub thread
gosub yarn
set #menubutton N/A
Display All Done!
return
;======= End Sub =======

;--------------------------------------------------------------------
; Ok, "All Done", YAY, hip hip hoorah \0/! We did it!
;
; ...
; Wait a minute...
; Aren't we forgetting anything?
;
;
; Of course! We have to write the last subs we need for the script to work,
; otherwise we won't have accomplished anything with this. >:(
;------------------------------------------------------------------------
; So, let's start with the wool sub. We basically need it to check for wool
; in the secure, use it on the spinning wheel, and put the thread back in the
; secure. Pfft, piece of cake, let's do that!
;---------------------------------------------------------------------------
;======= wool sub =======
sub wool
repeat
finditem %wool C_ , %resource
set #lobjectid #findid
event macro 17
set %weight #weight ; 1
while #targcurs <> 1
wait
set #ltargetid %wheelid
set #ltargetkind %wheelkind
event macro 22 ; this will perform target last target
while %weight = #weight  ; 2
wait
finditem %yarn C_ , #backpackid
for #findindex 1 #findcnt
   {
   exevent drag #findid #findstack ; #findstack is the amount of the item found in the same stack, so this will drag all the items from the stack
   wait 20
   exevent dropc %resource  ; this will drop the items to the container we set
   wait 20
   }
finditem %wool C_ , %resource
until #findcnt < 1
return
;======= end sub =======

; This is how I figured would be easy
; to write this, and also easy
; to understand how it works.
; If you want, you can look up more on the
; finditem deal on the easyuo wiki.
; The main thing you should notice here is I use a weight check
; instead of "wait" after targeting the spinning wheel.
; 1) I set %weight to the same value as the #weight system
;    var, which holds the char's current weight value.
; 2) Once the yarn is created, it will be put in your backpack.
;    The wool was in the secure, so you're weight is sure to increase
;    as soon as the ball of yarn is created.
;    So once the #weight increases, it won't be equal to %weight var
;    anymore, thus, continuing the loop.
; Once the yarn is created, it will drag it to the container. This structure
; I used (for #findindex 1 #findcnt) will move all stacks it finds of
; thread to the secure each time it makes yarn. There are faster ways
; to do this, but this one works, and is easy(ier) to understand! :)
; This sub will be repeated until wool #findcnt < 1, in other words
; once we use up all the wool, it will return to the start_button sub.
;----------------------------------------------------------------------
; Let's write a similar one for the cotton.
;----------------------------------------------------------------------

;======= cotton sub =======
sub cotton
repeat
finditem %cotton C_ , %resource
set #lobjectid #findid
event macro 17
set %weight #weight ; 1
while #targcurs <> 1
wait
set #ltargetid %wheelid
set #ltargetkind %wheelkind
event macro 22 ; this will perform target last target
while %weight = #weight  ; 2
wait
finditem %thread C_ , #backpackid
for #findindex 1 #findcnt
   {
   exevent drag #findid #findstack
   wait 20
   exevent dropc %resource
   wait 20
   }
finditem %cotton C_ , %resource
until #findcnt < 1
return
;======= end sub =======

;---------------------------------------------------------------------------
; Alright, now we just need to write the subs for the thread and the yarn to
; be used on the loom! Very similar to these last 2 subs, so let's get started!
;---------------------------------------------------------------------------------
;======= thread sub =======
sub thread
repeat
finditem %thread C_ , %resource
set #lobjectid #findid
event macro 17
while #targcurs <> 1
wait
set #ltargetid %loomid
set #ltargetkind %loomkind
event macro 22 ; this will perform target last target
wait 10
finditem %bolt C_ , #backpackid
for #findindex 1 #findcnt
   {
   exevent drag #findid #findstack
   wait 20
   exevent dropc %boltbag
   wait 20
   }
finditem %thread C_ , %resource
until #findcnt < 1
return
;======= End Sub =======

;----------------------------------
; I've removed the %weight check because it
; can't be used here. Instead I used a simple
; wait. If it's not waiting long enough, we
; can adjust this to whatever we want.
;-----------------------------------------
; Let's do the same thing for the yarn sub
;-----------------------------------------

;======= yarn sub =======
sub yarn
repeat
finditem %yarn C_ , %resource
set #lobjectid #findid
event macro 17
while #targcurs <> 1
wait
set #ltargetid %loomid
set #ltargetkind %loomkind
event macro 22 ; this will perform target last target
wait 10
finditem %bolt C_ , #backpackid
for #findindex 1 #findcnt
   {
   exevent drag #findid #findstack
   wait 20
   exevent dropc %boltbag
   wait 20
   }
finditem %yarn C_ , %resource
until #findcnt < 1
return
;======= End Sub =======

;-------------------------------
; Ok, guess we're done! Now if you check back at the
; start_button sub, you will see that once we return
; from the yarn sub, the script will display All Done
; and halt, meaning that all our bolts where made and are
; in the secure. Our at least they should be :)
;-----------------------------------------------------
; Guess this is it, I didn't have the time to test this,
; since my wife is yelling at me already, but the idea
; surely is correct. Hope that be reading this, you can
; get a good enough idea to how to write this stuff on your
; own!
;-------------------------------------------------------
; Below you can check out the menu sub too.
; Well, I hope you found this useful.
; Cheers!
; frneo
;------------------------------------------------------

;======= Menu Sub =======
sub menu
menu Clear
menu Window Title Sardorn's Bolt'em
menu Window Color BtnFace
menu Window Size 132 145
menu Font Transparent #true
menu Font Align Right
menu Font Name Arial
menu Font Size 8
menu Font Style
menu Font Color WindowText
menu Font Transparent #false
menu Font Align Left
menu Text EUOLabel1 12 24 Set Resource
menu Text EUOLabel2 12 44 Set Bolt Bag
menu Text EUOLabel3 12 64 Set Loom
menu Text EUOLabel4 12 84 Set Wheel
menu Button resource_button 84 20 27 21 set
menu Button bolt_button 84 40 27 21 set
menu Button start_button 24 108 75 25 Start
menu Button loom_button 84 60 27 21 set
menu Button wheel_button 84 80 27 21 set
menu Show
return
;======= End Sub =======
I couldn't test it, because my wife is already yelling at me, but I think it should work properly. The idea behind it is sure to be correct though, so if needed, you can adjust this to make it fully work and turn it more to your liking!

You can also try and add a counter to this later, or any other feature you think will be nice to have...

Hope you can find this useful!

neo
« Last Edit: August 15, 2011, 05:19:00 AM by frneo »
Never refuse an invitation.
Never resist the unfamiliar.
Never fail to be polite.
And never outstay your welcome.

Offline Crome969

  • Elite
  • *
  • *
  • Posts: 2098
  • Activity:
    0%
  • Reputation Power: 25
  • Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.
  • Gender: Male
  • UO Enthusiast
  • Respect: +211
  • Referrals: 10
    • View Profile
    • ScriptSDK
Re: Looking for pointers
« Reply #7 on: August 14, 2011, 09:20:43 PM »
0
frneo,
i know i wanted give him a look and learn direct example, but where you have the time to code all the time :o . I wish i would have!
But i just noticed your timers are too slow.
Code: [Select]

  exevent drag #findid #findstack
   wait 20
   exevent dropc %boltbag
   wait 20
would work with 4 or 5,too.
And you often doing that Drag and Drop instead of a neutral Sub to have lesser Code.
Example:
Code: [Select]
Sub Swap
   exevent drag %1 %2
   wait 5
   exevent dropc %3
   wait 5
return
and go in via
Code: [Select]
Gosub Swap #findid #findstack %ressource
would be a few lines lesser Code.

But that are just some small things.
All in all looks the example as a good Learning Code!

Crome


Offline Neo

  • Prime Program
  • Elite
  • *
  • *
  • Posts: 821
  • Activity:
    0%
  • Reputation Power: 13
  • Neo barely matters.Neo barely matters.
  • Respect: +155
  • Referrals: 3
    • View Profile
Re: Looking for pointers
« Reply #8 on: August 15, 2011, 03:58:03 AM »
0
frneo,
i know i wanted give him a look and learn direct example, but where you have the time to code all the time :o . I wish i would have!
But i just noticed your timers are too slow.
Code: [Select]

  exevent drag #findid #findstack
   wait 20
   exevent dropc %boltbag
   wait 20
would work with 4 or 5,too.
And you often doing that Drag and Drop instead of a neutral Sub to have lesser Code.
Example:
Code: [Select]
Sub Swap
   exevent drag %1 %2
   wait 5
   exevent dropc %3
   wait 5
return
and go in via
Code: [Select]
Gosub Swap #findid #findstack %ressource
would be a few lines lesser Code.

But that are just some small things.
All in all looks the example as a good Learning Code!

Crome


Yes, I know I could shorten the drag times... But I have high ping, as lots of other people have, I'm sure... And exevent drag and dropc will cause crashes in your client if you set low times with lag... So this is just a safe way I use to not let it crash... And I use a similar sub to the one you posted in my crafter, but I didn't want to overwhelm him in the tutorial...

Anyway, thank you for the input Crome...

Cheers!

edit: I work and I go to college, and I have a wife who takes up a lot of my time as well... But I always try to make time to do
the stuff I love, in between responsibilities, and scripting is my new found love! :)

Have a good one!

neo
« Last Edit: August 15, 2011, 04:13:42 AM by frneo »
Never refuse an invitation.
Never resist the unfamiliar.
Never fail to be polite.
And never outstay your welcome.

Offline Crome969

  • Elite
  • *
  • *
  • Posts: 2098
  • Activity:
    0%
  • Reputation Power: 25
  • Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.
  • Gender: Male
  • UO Enthusiast
  • Respect: +211
  • Referrals: 10
    • View Profile
    • ScriptSDK
Re: Looking for pointers
« Reply #9 on: August 15, 2011, 04:13:10 AM »
0
If you would write an file Parser for the Output this could give you the ping to a adress:
Code: [Select]
set %string www.google.com
execute cmd.exe /c ping %String >>text.txt
stop
But this is an other Chapter;)
« Last Edit: August 15, 2011, 04:15:54 AM by Crome969 »

Offline Neo

  • Prime Program
  • Elite
  • *
  • *
  • Posts: 821
  • Activity:
    0%
  • Reputation Power: 13
  • Neo barely matters.Neo barely matters.
  • Respect: +155
  • Referrals: 3
    • View Profile
Re: Looking for pointers
« Reply #10 on: August 15, 2011, 04:15:46 AM »
0
If you would write an file Comparser for the Output this could give you the ping to a adress:
Code: [Select]
set %string www.google.com
execute cmd.exe /c ping %String >>text.txt
stop
But this is an other Chapter;)
Wow, that's a good idea... This could be used in a script to determine the ping of a user on his server, and adjust the drag times accordingly right? Very nice!

Thank you Crome!
Never refuse an invitation.
Never resist the unfamiliar.
Never fail to be polite.
And never outstay your welcome.

Offline Crome969

  • Elite
  • *
  • *
  • Posts: 2098
  • Activity:
    0%
  • Reputation Power: 25
  • Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.
  • Gender: Male
  • UO Enthusiast
  • Respect: +211
  • Referrals: 10
    • View Profile
    • ScriptSDK
Re: Looking for pointers
« Reply #11 on: August 15, 2011, 04:17:23 AM »
0
If you would write an file Comparser for the Output this could give you the ping to a adress:
Code: [Select]
set %string www.google.com
execute cmd.exe /c ping %String >>text.txt
stop
But this is an other Chapter;)
Wow, that's a good idea... This could be used in a script to determine the ping of a user on his server, and adjust the drag times accordingly right? Very nice!

Thank you Crome!
Well it saves the output of ping adress in a txt.
now you would need to write a method to get the amount of ms out of this file and then you could make a "Best Case wait" + "CalculationDelay depending on your Ping" as a wait to optimize waiting for faster and lower connections..

Offline Neo

  • Prime Program
  • Elite
  • *
  • *
  • Posts: 821
  • Activity:
    0%
  • Reputation Power: 13
  • Neo barely matters.Neo barely matters.
  • Respect: +155
  • Referrals: 3
    • View Profile
Re: Looking for pointers
« Reply #12 on: August 15, 2011, 04:19:18 AM »
0
If you would write an file Comparser for the Output this could give you the ping to a adress:
Code: [Select]
set %string www.google.com
execute cmd.exe /c ping %String >>text.txt
stop
But this is an other Chapter;)
Wow, that's a good idea... This could be used in a script to determine the ping of a user on his server, and adjust the drag times accordingly right? Very nice!

Thank you Crome!
Well it saves the output of ping adress in a txt.
now you would need to write a method to get the amount of ms out of this file and then you could make a "Best Case wait" + "CalculationDelay depending on your Ping" as a wait to optimize waiting for faster and lower connections..
Yes, that would be really awesome... Do you think it would work? I'm gonna try that out as soon as I can...
Never refuse an invitation.
Never resist the unfamiliar.
Never fail to be polite.
And never outstay your welcome.

Offline Crome969

  • Elite
  • *
  • *
  • Posts: 2098
  • Activity:
    0%
  • Reputation Power: 25
  • Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.
  • Gender: Male
  • UO Enthusiast
  • Respect: +211
  • Referrals: 10
    • View Profile
    • ScriptSDK
Re: Looking for pointers
« Reply #13 on: August 15, 2011, 05:06:26 AM »
0
i know someone who did this in any case. But he never allowed me to take a look on that Code.I have maybe an Idea how i could solve it in Openuo.When it would allow me to catch the cmd ping pipes:P

Offline SardornTopic starter

  • Jr. Member
  • **
  • Posts: 34
  • Activity:
    0%
  • Reputation Power: 2
  • Sardorn has no influence.
  • Respect: +2
  • Referrals: 0
    • View Profile
Re: Looking for pointers
« Reply #14 on: August 15, 2011, 03:14:43 PM »
0
Thanks Chrome and Neo.

I'm reading through the very nice tutorial Neo wrote for me and have a question right out of the gate. pretty much first thing you have is the #menubutton <> N/A. the only thing I dont understand is the N/A I'm sure this is something simple that I'll say "oh, duh" for. And also, this may be addressed in your tutorial but havent gotten very far yet, so if this is addressed disregard, and this will be for other things I have in mind as well which is why I ask..when you're using something like finditem %thingIwant c_ with the intent of using Exevent Drag, will that only grab the item in my backpack? For example if I have my pack open with a stack of yarn balls in it and also have a container that I'm dropping into with more balls in it, will it only grab the id in my backpack?
And I did like Chrome's idea about writing each sub separate, making sure it works and then plugging it all back in in the end, which is what I'm going to try to do once I can use EUO again. I played around with the SUO a little but unfortunately since I dont quite understand all the commands yet, I need to actually see it in action to see where I'm goofing up. A lot of my questions will be answered by trial and error once I get to the point of seeing them in action.
If there's a way around waiting for EUO to update, other then not patching (since I cant log in unless I patch) I'd love to know it!

Thanks again!

Tags: