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

0 Members and 1 Guest are viewing this topic.

Offline MonoxideTopic starter

  • Jr. Member
  • **
  • Posts: 29
  • Activity:
    0%
  • Reputation Power: 1
  • Monoxide has no influence.
  • Gender: Male
  • Respect: +4
  • Referrals: 0
    • View Profile
Hey my first script in the making! Please help lol
« on: October 03, 2011, 02:50:39 PM »
0
Alright, im trying to make a script that recalls to two locations on a rune book. buys from one npc vendor, bucklers and battle axes. (which i have razor buy agent on background to make the buying part easy in my script) then recall back and donate both.

so i do have a plan

Look for runebook
Open runebook
chose first rune
click npc choose buy
recall to spot #2
double click npc
chose  bucklers
enter 20
double click npc
chose battle axes
enter 20

repeat


well that being said i got this so far

findItem ZBN EGSD , #backpackID
  if if #findKind = -1
    halt
set #lobjectID #findID
set #ltargetKind 1
event macro 17 0
wait 5


but its not opening my runebook. i think its finding it because it stays on play.. unlike when i had a different backpack id then it just kept halting. but i thought event macro was to use it?

ill be playing around with it for more time. but also if i do figure this out, and i get it opened.. would i have it look for the rune spot 1 by using coords? or is there an easier way incase rune book opens up somewhere else?

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 #1 on: October 03, 2011, 03:26:18 PM »
0
sorry, i just relized i post this in the wrong section, and i also realized the first problem. i made the mistake of putting in
 if #findKind = -1
halt.

i guess it was messing up because runebooks do not have a counter? hmm anyhow back to getting this going!

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: Hey my first script in the making! Please help lol
« Reply #2 on: October 03, 2011, 04:06:05 PM »
0
Code: [Select]
findItem ZBN EGSD , #backpackID
  if if #findKind = -1
    halt
set #lobjectID #findID
set #ltargetKind 1
event macro 17 0
wait 5
What is this EGSD here? I'm not familiar with that... I think you should use Finditem ZBN C_ , #backpackid

also, no reason to set #ltargetkind to 1, that's necessary for event macro 22 (last target) sometimes... You also have 2 consecutive "ifs" in there...

What you're trying to do should look sth like this:

Code: [Select]
findItem ZBN C , #backpackID
  if #findKind = -1
    halt
set #lobjectID #findID
event macro 17 0
wait 5


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

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 #3 on: October 03, 2011, 04:06:49 PM »
0
Okay so i got my script looking like this.. and it may look silly to you guys, but its my first born and actually does something!!! amazing!!

Code: [Select]
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

halt

now so far it gets my rune book, and recalls me to my first location. which is the blacksmith i want. Im trying to read thru tutorials to find something that will help me find the npc, then choose buy. ohhh and looks like im gonna need to add in a check to see if i actually recalled to the spot too.. man now i understand why these can get so long.. im just doing simple stuff!!!  

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: Hey my first script in the making! Please help lol
« Reply #4 on: October 03, 2011, 04:10:20 PM »
0
Okay so i got my script looking like this.. and it may look silly to you guys, but its my first born and actually does something!!! amazing!!

Code: [Select]
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

halt

now so far it gets my rune book, and recalls me to my first location. which is the blacksmith i want. Im trying to read thru tutorials to find something that will help me find the npc, then choose buy. ohhh and looks like im gonna need to add in a check to see if i actually recalled to the spot too.. man now i understand why these can get so long.. im just doing simple stuff!!!  
Actually, a script to recall properly requires some pretty advanced scripting knowledge in my opinion... Don't think it should be your first script... You could always use someone else's recall/travel sub to do this, and focus on writing the rest of the script yourself... I've been using recall/sj in my scripts for some time now, but not until a month ago or so I decided to write my own travel sub...
Never refuse an invitation.
Never resist the unfamiliar.
Never fail to be polite.
And never outstay your welcome.

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 #5 on: October 03, 2011, 04:16:36 PM »
0
yea i figured is i could get the runebook gump to move to the certain location and i have it click on the blue buttons it should work alright.. i didnt want to get it too complicated because its only 2 rune locations.

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 #6 on: October 03, 2011, 04:24:33 PM »
0
Yes, recall a good recall sub is key.

As for being able to buy from the npc, look up exevent popup , and then contpos and click. 

When I started learning, I'd find scripts that do the same type of thing, or at least has something similar in their code, then learn how they coded it and know what all the code does, then adjust it to your preferences.  You could find a script that clicks a blue beetle, or donates, or something of the like.

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 #7 on: October 03, 2011, 05:06:41 PM »
0
okay i found some info on exeevent popup and i found this, but i dont understand this one line

finditem %vendor G_10    <------ where is the g_10 coming from? should that be an item id #?
if #FINDCNT > 0
   exevent Popup #findid 1
halt

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: Hey my first script in the making! Please help lol
« Reply #8 on: October 03, 2011, 05:10:16 PM »
0
okay i found some info on exeevent popup and i found this, but i dont understand this one line

finditem %vendor G_10    <------ where is the g_10 coming from? should that be an item id #?
if #FINDCNT > 0
   exevent Popup #findid 1
halt
You should really consider reading up on EUO Wiki, when you find stuff you don't understand in a script... You'll find answers to most (all?) of your questions there...

The answer to this one can be found here:

http://wiki.easyuo.com/index.php?title=FindItem
Never refuse an invitation.
Never resist the unfamiliar.
Never fail to be polite.
And never outstay your welcome.

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 #9 on: October 03, 2011, 05:37:31 PM »
0
Okay that makes sense  :P now one last stupid question then i should be good for the night lol. when i recall into the shop the npc is different, has different id# is there another way around this? i tried using %vendor but its not registering.

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: Hey my first script in the making! Please help lol
« Reply #10 on: October 03, 2011, 05:45:20 PM »
0
Okay that makes sense  :P now one last stupid question then i should be good for the night lol. when i recall into the shop the npc is different, has different id# is there another way around this? i tried using %vendor but its not registering.
You have to search for #findtype, and then it will give you findid...

Let's say the item TYPE for vendors is HS and IS...

You can set up a variable (read up on variables here -> http://wiki.easyuo.com/index.php?title=Variables) with the item types for vendors.

Code: [Select]
set %vendor HS_IS
Now, when you use "finditem %vendor" it will look for item types HS and IS.

Once one of those "items" are found, the #findid variable will hold the ID of the item that was found...

That's why you're gonna use something like:
Code: [Select]
finditem %vendor G_10 ;-> will look up HS_IS whithin 10 tiles of your char
exevent popup #findid ;-> assuming a vendor type was found, it's ID will be held in #findid, so you're popping up this particular vendor's gump
Hope this was clear enough...
Never refuse an invitation.
Never resist the unfamiliar.
Never fail to be polite.
And never outstay your welcome.

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 #11 on: October 04, 2011, 04:34:40 AM »
0
hmm, well i did find anything that helped me get good id types, i dont know if my sever is using dif code? but the ones i keep running into not working. anyhow though i got this much.. now it does what i want it to do, but is a bit glitchy.

Code: [Select]
findItem ZBN
set #lobjectID #findID
set #ltargetKind 1
event macro 17 0
wait 20

set #contPosX 10
set #contPosY 10
contpos
wait 20

click 144 80
wait 50

msg vendor buy$                       <---- got away from needing to find type, but i know in future ill need to know
wait 20

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

set #contPosX 10
set #contPosY 10
contpos
wait 20

click 144 95
wait 100

finditem BGKH G_20
if #FINDCNT > 0
click 443 303 d f
click 443 303 d f                  <---- this double click gets glitchy why i put it in 3 times but still rough.
click 443 303 d f
wait 20

set #contPosX 10
set #contPosY 10
contpos
wait 20

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

loop



its my rough copy, i guess i gotta add in checks to make sure things happened right.. and put in a save pauser so it doesnt get messed up in world saves.

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 #12 on: October 04, 2011, 12:16:29 PM »
0
congrats on the first script... glitches and all. :)
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."

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 #13 on: October 04, 2011, 05:42:33 PM »
0
thank you, and i feel like such an idiot!!! my double clicking glitch was such a stupid glitch, all i had to do was after the findid was to set ltarget = findid then event 17 0..
« Last Edit: October 04, 2011, 06:17:25 PM by Monoxide »

Offline Ultima

  • Insane Scripter
  • *
  • Posts: 1580
  • Activity:
    0%
  • Reputation Power: 26
  • Ultima is on the verge of being accepted.Ultima is on the verge of being accepted.Ultima is on the verge of being accepted.Ultima is on the verge of being accepted.Ultima is on the verge of being accepted.
  • Gender: Male
  • Respect: +160
  • Referrals: 4
    • View Profile
Re: Hey my first script in the making! Please help lol
« Reply #14 on: October 04, 2011, 08:46:41 PM »
0
thank you, and i feel like such an idiot!!! my double clicking glitch was such a stupid glitch, all i had to do was after the findid was to set ltarget = findid then event 17 0..

No no no don't say that.....your farther along than I am...what does that make me? And I've been lurking around these boards for far too long.  ???

I've looked at those wiki tutorials and I'm not a huge fan of them. Wiki could go much more in depth and give more examples...better examples!

Cerveza has written some good tutorials that explain step by step what the hell is going on with the code. Wiki...I'm sorry I'm not a fan and I wish there was an alternate resource besides that one.

Sure you guys that are natural coders and programmers it comes easy to ..then there's guys like me that need an explanation of exactly what the hell is happening put into laymens terms. What I'd really like is a book...UO Scripting Basics like one of my current school books where I go and do lessons and answer questions! ;)

Not everyone learns the same way!

Granted I need more patience and should take ALOT more time learning the coding but my interest hasn't been there. Some of you guys...coders...love the stuff more than playing the game! Going to school taking computer courses my interest in coding and all stuff pertaining  to computers has grown however it doesn't come easy for some of us.

I'll have to post my fish cutting sub for everyone to tear to pieces. I'm so proud I got the FaFer to cut up all the fish! It's not pretty but it works. I pieced it together looking at C2's code.  8)

Anyways nice job Monoxide on your first script! I'm right there with you...well maybe a couple of steps behind. We'll get there.... ;)
« Last Edit: October 04, 2011, 08:50:29 PM by Ultima »

Tags: