Author Topic: Hey my first script in the making! Please help lol  (Read 7182 times)

0 Members and 1 Guest are viewing this topic.

Offline seeriusly

  • Full Member
  • ***
  • Posts: 219
  • Activity:
    0%
  • Reputation Power: 6
  • seeriusly has no influence.
  • Gender: Male
  • Respect: +40
  • Referrals: 0
    • View Profile
Re: Hey my first script in the making! Please help lol
« Reply #15 on: October 04, 2011, 09:01:05 PM »
0
I agree.  Congrats Monoxide... there is A LOT to learn. 

 Laymens terms FTW!  I don't know much, and sure would like to see more examples of code, torn down and interpreted line by line, variable by variable... In english, not computer science.  That would be awesome.  I spent about 3 hours shredding through google, trying to learn a little more about namespaces.  I got almost nowhere,  I am sure if it were explained in english, I could figure it out eventually, with a little help from the natives...  But I got lost on a programming site that was trying to teach me java script, and C++ and some other stuff that wont help me sleep tonight.

 :-\

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: Hey my first script in the making! Please help lol
« Reply #16 on: October 04, 2011, 10:21:21 PM »
0
Chaka, you can do it!
I would say you should check some Subs on this Board or Easyuo.com.
They have some good Subroutines for Recall\Buy\Sell then u only need to know how to use:)

Offline MonoxideTopic starter

  • Jr. Member
  • **
  • Posts: 29
  • Activity:
    0%
  • Reputation Power: 1
  • Monoxide has no influence.
  • Gender: Male
  • Respect: +4
  • Referrals: 0
    • View Profile
Re: Hey my first script in the making! Please help lol
« Reply #17 on: October 05, 2011, 02:48:31 PM »
0
Yea im a mechanic so im right there with you, this stuff can go over my head fast! What i learned help me thru this script is what i learned in one of the tutorials is think of what you want and to write it down. simple steps.. then put in what u want checked for that one step. Also if i got stuck one trying to figure out codes, i either bothered these guys lmao. or i read into some scripts that did what i wanted to do and play around.

i been writing the script from top to bottom, and testing every few lines by putting halt at the end and seeing if it did what i wanted, i also put all my wait times up high for testing so if it did mess up i can push pause and see where im at. You can always speed up your script at then end. this one here does it super fast for me. but it's also set up to my comp connection. so if u did want to use it play around with the times by adding if too fast. def cant be to slow.. lmao

Code: [Select]
; Created by Monoxide
; Date 10/4/2011
; Created to Help getting Mace and Shield Glasses
;
; <<< THIS ONLY WORKS FOR SERVERS THAT HAVE INSTANT SPAWN NPCS FOR FAST BUYING. IF YOU ARE LOOKING FOR SOMETHING THAT SITS >>>
; <<< THERE TO STOCKUP THE PILE GO SOMEWHERE ELSE!!! >>>
;
;
;
;
;
; Setup
; You will need 1 runebook, no more no less or things will get funny.
;     1st rune the npc vendor selling Bucklers And War Axes within a tile, unless your server allows vendor buy further.
;     2nd rune to the library donation npc (close enough to reach out and touch him)
;     3rd rune the bank somewhere you know u have access to banker and withdrawl money
; You will need razor buying agent enabled, and set to bucklers and war axes, or whatever you want. i believe it will skip over it.. not really sure guess u find out



event macro 8 2




Start

if #gold < 1100
gosub gotta_get_gold




findItem ZBN
set #lobjectID #findID
set #ltargetKind 1
event macro 17 0
wait 5

set #contPosX 10
set #contPosY 10
contpos
wait 5

click 144 80

wait 20
findItem ZBN
set #lobjectID #findID
set #ltargetKind 1
event macro 17 0
wait 20

set #contPosX 10
set #contPosY 10
contpos
wait 10

msg vendor buy$
wait 20

click 144 95
wait 50

finditem BGKH G_20
if #FINDCNT > 0
set #lobjectID #findID
event macro 17 0
wait 10

set #contPosX 10
set #contPosY 10
contpos
wait 10

click 316 352
wait 5
click 316 352
wait 5
click 48 180
wait 10
msg 20$
wait 5
set #contPosX 10
set #contPosY 10
contpos
wait 10
wait 5
click 316 352
wait 5
click 316 352
wait 5
click 50 250
wait 10
msg 20$

wait 20

loop

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

sub gotta_get_gold

findItem ZBN
set #lobjectID #findID
set #ltargetKind 1
event macro 17 0
wait 20

set #contPosX 10
set #contPosY 10
contpos
wait 20

click 142 110
wait 50

msg withdrawl 5000$
wait 50
msg withdrawl 5000$
wait 50

return


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: Hey my first script in the making! Please help lol
« Reply #18 on: October 05, 2011, 09:05:22 PM »
0
I will later show you an example how i structure my scripts;). I will take your Script. You working a lot of with clicks, then u should not set the gump to an contpos, set the click to the gump;)But you learning processs seems be good:)

Crome

Offline camotbik

  • Sr. Member
  • *
  • Posts: 349
  • Activity:
    0%
  • Reputation Power: 3
  • camotbik has no influence.
  • Gender: Male
  • Hello! I'm a UO addict.
  • Respect: +38
  • Referrals: 0
    • View Profile
Re: Hey my first script in the making! Please help lol
« Reply #19 on: October 06, 2011, 01:44:35 AM »
0
Code: [Select]
findItem ZBN
set #lobjectID #findID
set #ltargetKind 1  ; < --- you are not really using any targeting in the script, why are you using this?
event macro 17 0
wait 5

Well your main problem is you dont check where to look for the item, and if you have found the item or not. And you are missing brackets in which case even if you havent found the item, the following lines will be executed - and that's wrong. But if you are having brackets and the statement is true( the way you want it ) it will execute only the code within the brackets.  So this little code should look something like this.

Code: [Select]
finditem ZBN C_ , #backpackid  ; looking for zbn in your main backpack.
if #findcnt > 0                ; if found more than 0
{                              ; open statement found more than 0
   set #lobjectID #findID      ; set last objectid from #findid
   event macro 17 0            ; use last object
   wait 5                      ; wait 0,25s
}                              ; close statement found more than 0
else                           ; if nothing found
{                              ; open statement else
  display did not find ZBN     ; displays [ok] messagebox with text "did not find ZBN"
  stop                         ; stops the script
}                              ; close statement else
Code: [Select]
set #contPosX 10
set #contPosY 10
contpos
wait 5
you could just use
Code: [Select]
contpos 10 10

Code: [Select]
msg vendor buy$
To prevent errors(as this "msg" is direct key pressing - and you may have some writen stuff allready -, so I would suggest to use the method bellow, which is just a direct messaging trough event
Code: [Select]
event macro 1 1 vendor buy

Then you have a looping error. The line 27 says "Start", and the line 100 says "loop".
But it should be
Code: [Select]
Start:
.....................
goto Start

I would recomend you using ScriptUO software, that has syntax error checker inside. It would help you prevent many problems you may encounter. Hope this will help and you will understand what I have writen here down.Anyway, keep on working, it's a good start.
« Last Edit: October 06, 2011, 04:00:12 AM by camotbik »
What you witness -- is whatver..
uogamers hybrid.

Offline Endless Night

  • Global Moderator
  • *
  • *
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +393
  • Referrals: 1
    • View Profile
Re: Hey my first script in the making! Please help lol
« Reply #20 on: October 06, 2011, 05:47:05 AM »
0
Do not know if this will help but think of namespaces as boxes.

-Imagine you are standing in a huge box that contains all the Variables you can see   %myVar %MyVar2  etc.
- Now imagine that you surrounded by Loads of smaller boxes that have no name and are closed but could hold variables !myvar, !myvar2.
- You also notice that one of the small boxes is open and its called Standard namespace. Its currently empty but could hold variables !myvars  (! not %)  You decide to set one  (set !MyTest standardbox)
-So you grab one of the other small boxs and say i'm gona  have a look inside this box, but i don't want it contents to conflict with my existing ! variables
-So you take the open (standard) small box, close it and push it to the side on a stack of empty boxes (namespace push).
-After stacking your closed box you pickup one of the other small boxes and say thats it i'm gona name this box and open it  (namespace local myboxname)
-After opening it you see their is nothing inside so you decide to put something inside (set !MyTest  testBox)
- Now happy after such achievements you pine for your original small box and think it would be so be great to close this box and pop the last one back open...  (namespace Pop)
- you check you var and low and behold !mytest = standardbox

in code
Code: [Select]
set !myTest standardbox
display ok TestVar: !mytest
namespace push
namespace local TestBox
set !myTest TestBox
display ok TestVar: !mytest  (Im using a different namespace)
namespace pop
display ok TestVar: !mytest   (Back to my original namespace)
display ok SElect Tools from EUO MEnu, do a  var dump $ note you have a serveral !Mytest vars $ one Std (default box) and one from the defined box
halt

After running code to a var dump, tools menu option var dump, scroll all the way to the botton you will see you have 2 MYTest Vars, One in Standard namespace one in TestBox namespace.

!L~STD~MYTEST: Defaultbox
!L~TESTBOX~MYTEST: TestBox


Hope this box analogy helps to explain this mystery.

Going to add this into turorials... maybe it will help others.


Also moved this topic to correct section Script debug


« Last Edit: October 06, 2011, 05:55:16 AM by Endless Night »
Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Tags: