Author Topic: Scan Journal or watch Backpack?  (Read 5614 times)

0 Members and 1 Guest are viewing this topic.

Offline PyargyTopic starter

  • Jr. Member
  • **
  • Posts: 31
  • Activity:
    0%
  • Reputation Power: 0
  • Pyargy has no influence.
  • Respect: +6
  • Referrals: 0
    • View Profile
Scan Journal or watch Backpack?
« on: February 11, 2010, 10:30:31 AM »
0
I have read through the scripting tutorials on this site and want to try and write my first script.  I am sure its something really easy but mind you, I am an OLD dog trying to learn new tricks.

Based on Cerveza's tutorial here is what I have so far.

Step 1 is listing out what I want to do- 

I want to play a wav file each time I get one of the special items from the smugglers edge.

Step 2 is to start defining what needs to happen-

-Scan journal for "you succesfully steal a special item from this creature" OR watch backpack for item type to drop in.  (Here is my main question for now, which of these is most efficient and if watching backpack is the best choice can someone please point me in the direction to look at so I can learn about that? I have already read Twinkle McNugget's scan journal tutorial and if that is the best way to go I will have more question on that as well.)

-Sound wav file when condition above it met.

Ok I know this is something that most of you are saying this is just way to easy and a waste of your time, but hey you all had to start somewhere and this is my start. So any advice and or help in the most lamens terms is very much appreciated.

Offline _C2_

  • AFK FtW
  • Global Moderator
  • *
  • *
  • Posts: 4077
  • Activity:
    0%
  • Reputation Power: 48
  • _C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!_C2_ has great potential!
  • RIP Pen Trick
  • Respect: +254
  • Referrals: 4
    • View Profile
Re: Scan Journal or watch Backpack?
« Reply #1 on: February 11, 2010, 11:30:33 AM »
0
Well a nice thing u can do is ignoreitem id everything in your pack and then continue to scan for new items that appear in the pack.  Script then picks up any new items and records them.  I have  a script that steals items and uses journal scans.  either way is nicely.  The great part of ignoring everything is that you do not need ids to search for new items.  you can use ...
finditem * c_ , #backpackid   

the start will find any and all items in pack 

Offline Cerveza

  • Hacksimus Maximus
  • Scripthack
  • *
  • Posts: 5857
  • Activity:
    0%
  • Reputation Power: 80
  • Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!
  • Gender: Male
  • So... Hows that Hopey-Changey thing working out?
  • Respect: +403
  • Referrals: 11
    • View Profile
Re: Scan Journal or watch Backpack?
« Reply #2 on: February 11, 2010, 11:33:56 AM »
0
Is there a message that appears when you steal one of the *good* items?

Is there a message when you just steal an item?

Do you know the different item types that are the *good* ones to steal?
XXXXXXXXXX________________________________________] 20%
I've forgotten more about this game then most people will ever know.
Thank you for controlling your children. Their manners reflect your love for them.
Give a man a fish and you feed him for a day. Don't teach a man to fish, and you feed yourself. He's a grown man. Fishing's not that hard.

Offline UOMaddog

  • Maddog
  • Elite
  • *
  • *
  • Posts: 1625
  • Activity:
    0%
  • Reputation Power: 22
  • UOMaddog might someday be someone...UOMaddog might someday be someone...UOMaddog might someday be someone...UOMaddog might someday be someone...
  • Gender: Male
  • Biggest B@D@$$ of the Universe
  • Respect: +165
  • Referrals: 8
    • View Profile
    • Insane UO
Re: Scan Journal or watch Backpack?
« Reply #3 on: February 11, 2010, 11:36:38 AM »
0
Glad to see you're off to a good start!

My advice would be to scan the backpack for that particular item. It is much more reliable than journal scanning. I speak from experience when saying that journal scanning is not executed very well by EasyUO and you'd probably end up using TM's Journal Scanner subs to get it to work every time (and even then it's still quite confusing)

That being said, I'd recommend reading this page: http://wiki.easyuo.com/index.php/FindItem and looking at the example. I'll give you some additional help that usually clears things up:

Let's start out searching for EVERYTHING in ANY open bag. Your code would read:
(Note: * = a wildcard character meaning it looks for everything)
Code: [Select]
finditem * CYou can read this as: "Find (finditem) everything (*) in an open container (C)"



Now let's say you have a bag who's ID is ABCDEF. If you want to find everything within that bag, you would do:
Code: [Select]
finditem * C_ABCDEFYou can read this as: "Find (finditem) everything (*) in an open container (C_) whose ID is ABCDEF (ABCDEF)"



Now the next step is to find everything in a bag who's ID might change for each person (for example, each person's backpack has a different ID, but you don't want to have them type in their backpackid each time). So you have to use a variable like #BACKPACKID. But this causes an issue!! EasyUO does not like the following statement:
Code: [Select]
finditem * C_#BACKPACKD


So it seems that we are stuck! However, there is a solution! We use the "comma" string concatenator! It's a big word, but it's really simple! The problem with the line above is that the ID of your backpack is not #BACKPACKID it's the actual characters stored IN #BACKPACKID (such as HCAOTD) so EasyUO will never find a bag whose ID is "#BACKPACKID" but it WILL find a bag whose ID is "HCAOTD". What we want to do is pull out the string from #BACKPACKID and add (concatenate) it onto the line "finditem * C_" The way we do this is:
Code: [Select]
finditem * C_ , #BACKPACKIDThe comma says "pull out the string from #BACKPACKID and paste it onto the end of this line!" So the way EasyUO interprets it is actually:
Code: [Select]
finditem * C_HCAOTD even though the code is "C_ , #BACKPACKID"



Whew! Glad we got that covered! Now we know how to find everthing in ANY open container, a SPECIFIC open container, AND an open container who's ID could vary for whatever reason! The next step is, finding something specific instead of everything! This is much simpler!!

All items in game have 2 things associated with them (actually they have alot more, but only 2 things that are important here), a TYPE and an ID. The TYPE is the same for all of the same item, such as explosion pots (TYPE = TUF). The type is almost always either 2 or 3 characters. Then, each individual pot (or stack of pots) has it's unique ID. This is the 6 letter ID (such as HCAOTD that was the ID of our backpack above).

So, let's say we want to find ANY explosion pots in our backpack! We would do this:
Code: [Select]
finditem TUF C_ , #BACKPACKID
If there are multiple things we want to find, we just put a "_" between them such as (GFZ = Gargish Luck Totems)
Code: [Select]
finditem TUF_GFZ C_ , #BACKPACKID
You can put as many things as you want on the line, although it might be easier to do something like this:
Code: [Select]
set %itemtypestofind TUF_GFZ
finditem %itemtypestofind C_ , #BACKPACKID
That way you can just keep adding things to the first line!

You can also use the ID instead of the TYPE, but unless you know the exact ID of something, it wouldn't really do you much good (hence why I'm not putting an example in since it is rarely, if ever, used!)



Hopefully this will help you out a little bit! If the item type you are searching for is shared amongst a few different items (EA loves to re-use item types) then you may need to take it a step further and use "event property" on the #FINDID

You can learn more about event property and #FINDID here:
http://wiki.easyuo.com/index.php/Event_Property
http://wiki.easyuo.com/index.php/FindID


There are 10 kinds of people in this world: those that understand binary and those that don't!

Windows:  A 64-bit tweak of a 32-bit extension to a 16-bit user interface for an 8-bit operating system based on a 4-bit architecture from a 2-bit company that can't stand 1 bit of competition!

Offline UOMaddog

  • Maddog
  • Elite
  • *
  • *
  • Posts: 1625
  • Activity:
    0%
  • Reputation Power: 22
  • UOMaddog might someday be someone...UOMaddog might someday be someone...UOMaddog might someday be someone...UOMaddog might someday be someone...
  • Gender: Male
  • Biggest B@D@$$ of the Universe
  • Respect: +165
  • Referrals: 8
    • View Profile
    • Insane UO
Re: Scan Journal or watch Backpack?
« Reply #4 on: February 11, 2010, 11:49:08 AM »
0
C2's suggestion is a very good one, you'll just have to look into the "ignoreitem" command! If you still need help, just let us know!
There are 10 kinds of people in this world: those that understand binary and those that don't!

Windows:  A 64-bit tweak of a 32-bit extension to a 16-bit user interface for an 8-bit operating system based on a 4-bit architecture from a 2-bit company that can't stand 1 bit of competition!

Offline PyargyTopic starter

  • Jr. Member
  • **
  • Posts: 31
  • Activity:
    0%
  • Reputation Power: 0
  • Pyargy has no influence.
  • Respect: +6
  • Referrals: 0
    • View Profile
Re: Scan Journal or watch Backpack?
« Reply #5 on: February 11, 2010, 01:06:10 PM »
0
Ok folks the light is getting a little brighter now  ;D  here is what I have so far

Code: [Select]
SUO:
repeat

set %SpecialItemDrop ATL_IYD


finditem %SpecialItemDrop C_ , #backpackid
sound woohoo.wav

until #CharGhost = YES
While #Charghost = YES
Wait 0
GoTo SUO

I have the Item Type for the Smuggelers Tool Kit "ATL"  and the Smuggelers Lantern "IYD"

At first I only had

Code: [Select]
set %SpecialItemDrop ATL_IYD


finditem %SpecialItemDrop C_ , #backpackid
sound woohoo.wav

But after looking at it I thought maybe that was just going to run through the code just once and then do nothing so I went back to the tutorial and added in the SUO repeat stuff and the GoTo.

Now the WAV file I have is in the same folder as EasyUO.exe and this txt file.   The way I have tested it is to just drag and drop one of these items to my backpack, but nothing is happening.  I am unclear about needing an "if" or some kind of a command that tells the sound file to play when the finditem command comes back true.


Thanks for all the help so far, again I know this seems so small but at least its starting to make a little more sense to me.

Offline Cerveza

  • Hacksimus Maximus
  • Scripthack
  • *
  • Posts: 5857
  • Activity:
    0%
  • Reputation Power: 80
  • Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!
  • Gender: Male
  • So... Hows that Hopey-Changey thing working out?
  • Respect: +403
  • Referrals: 11
    • View Profile
Re: Scan Journal or watch Backpack?
« Reply #6 on: February 11, 2010, 01:38:45 PM »
0
Wow, your really coming along. A couple of things ;)

Since you only need to set a variable once, you don't need it inside the repeat.

Code: [Select]
set %SpecialItemDrop ATL_IYD_

SUO:
repeat

You are looking exactly where you should be, but you aren't saying if you find it or not. You look in your backpack then sound the file. You need some type of logic there.

Code: [Select]
finditem %SpecialItemDrop C_ , #backpackID
if #findCnt > 0
  {
  sound woohoo.wav
  }

See what I did there? You'll have to read up on a couple things at this point. Read up on the IF command and then read what #findCnt means.

Now that you've "woohoo'd" you don't want to keep finding the same thing over and over... the woohoo's would drive you batty.

You'll have to ignoreitem so you don't keep finding it.

I'll let you work on that and see how you do.
XXXXXXXXXX________________________________________] 20%
I've forgotten more about this game then most people will ever know.
Thank you for controlling your children. Their manners reflect your love for them.
Give a man a fish and you feed him for a day. Don't teach a man to fish, and you feed yourself. He's a grown man. Fishing's not that hard.

Offline PyargyTopic starter

  • Jr. Member
  • **
  • Posts: 31
  • Activity:
    0%
  • Reputation Power: 0
  • Pyargy has no influence.
  • Respect: +6
  • Referrals: 0
    • View Profile
Re: Scan Journal or watch Backpack?
« Reply #7 on: February 11, 2010, 04:08:45 PM »
0
WOOHOO  I think I got it!

Code: [Select]
set %SpecialItemDrop ATL_IYD

SUO:
repeat
 
  finditem %SpecialItemDrop C_ , #backpackid
  }
  if #findtype = ATL
  {
    sound woohoo.wav
    IGNOREITEM #FINDID
  }
  if #findtype = IYD
  {
  sound woohoo.wav
  IGNOREITEM #FINDID
  }
  }

until #CharGhost = YES
While #Charghost = YES
  Wait 0
GoTo SUO

After thinking about it a bit I did realize I needed to move set variable line.  I laughed so hard when I realized what you were saying about the woohoo file playing over and over again. :)

I set the script up like this
 
Code: [Select]
if #findCnt > 0
{
sound woohoo.wav
}

IgnorItem %SpecialItemDrop

but I was still not getting the woohoo sound.  So I thought i was doing something wrong so I dove into the #Find function (not sure thats even a function, but thats what I will call it for now)  After learning about the #FindId I found that my whoohoo.wav file was in the wrong location.  So know I think I have got it all worked out.

Offline UOMaddog

  • Maddog
  • Elite
  • *
  • *
  • Posts: 1625
  • Activity:
    0%
  • Reputation Power: 22
  • UOMaddog might someday be someone...UOMaddog might someday be someone...UOMaddog might someday be someone...UOMaddog might someday be someone...
  • Gender: Male
  • Biggest B@D@$$ of the Universe
  • Respect: +165
  • Referrals: 8
    • View Profile
    • Insane UO
Re: Scan Journal or watch Backpack?
« Reply #8 on: February 12, 2010, 03:02:17 AM »
0
You're very very close!!!

Code: [Select]
set %SpecialItemDrop ATL_IYD

SUO:
repeat
  
  finditem %SpecialItemDrop C_ , #backpackid
  if #findcnt > 0
  }
  sound woohoo.wav
  IGNOREITEM #FINDID
  }

until #CharGhost = YES
While #Charghost = YES
  Wait 1
GoTo SUO

You do the same thing for both so you can use #findCnt, also you want to ignore the #findid NOT %SpecialItemDrop, otherwise, you'll be ignore all of the type, not the specific one! Also, for computer purposes, it's better to use a "wait 1" instead of "wait 0". With a "wait 1" EasyUO gives up its resources for a second so your processor can check on other stuff. This will SIGNIFICANTLY reduce your CPU usage!
There are 10 kinds of people in this world: those that understand binary and those that don't!

Windows:  A 64-bit tweak of a 32-bit extension to a 16-bit user interface for an 8-bit operating system based on a 4-bit architecture from a 2-bit company that can't stand 1 bit of competition!

Offline PyargyTopic starter

  • Jr. Member
  • **
  • Posts: 31
  • Activity:
    0%
  • Reputation Power: 0
  • Pyargy has no influence.
  • Respect: +6
  • Referrals: 0
    • View Profile
Re: Scan Journal or watch Backpack?
« Reply #9 on: February 12, 2010, 06:08:23 AM »
0
Quote
Also, for computer purposes, it's better to use a "wait 1" instead of "wait 0". With a "wait 1" EasyUO gives up its resources for a second so your processor can check on other stuff. This will SIGNIFICANTLY reduce your CPU usage!

This makes a lot of sense, I was just following the template in the tutorial and really didnt know why there was a "wait" in the script at all. Thank you for clearing that up. Since in take up to a few minutes before I get another drop, would it be even more beneficial to set the wait to a longer time?


Code: [Select]
finditem %SpecialItemDrop C_ , #backpackid
  if #findcnt > 0
  }
  sound woohoo.wav
  IGNOREITEM #FINDID
  }


Is this just a cleaner way to do what I have posted above?  The code above seems to working just fine, however I can see if I wanted to add more items to monitor this would be a much cleaner way to do that.

Offline UOMaddog

  • Maddog
  • Elite
  • *
  • *
  • Posts: 1625
  • Activity:
    0%
  • Reputation Power: 22
  • UOMaddog might someday be someone...UOMaddog might someday be someone...UOMaddog might someday be someone...UOMaddog might someday be someone...
  • Gender: Male
  • Biggest B@D@$$ of the Universe
  • Respect: +165
  • Referrals: 8
    • View Profile
    • Insane UO
Re: Scan Journal or watch Backpack?
« Reply #10 on: February 12, 2010, 10:17:16 AM »
0
The method I posted is ideal if you want the same sound for everything. You're just looking if it found ANY of the item types listed (that weren't already ignored). That's what "#findcnt>0" does. It's the total number of items or stacks found. If you wanted a different sound for each one, you could do the "if #findtype = XXX" and "#if findtype = YYY" and have a different sound under each. Since you were doing the same sound for both of them, it's better to consolidate your code. It's less to read and less for your processor to step through
There are 10 kinds of people in this world: those that understand binary and those that don't!

Windows:  A 64-bit tweak of a 32-bit extension to a 16-bit user interface for an 8-bit operating system based on a 4-bit architecture from a 2-bit company that can't stand 1 bit of competition!

Tags: