ScriptUO

Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: cgeorgemo on October 02, 2009, 07:10:21 AM

Title: Puzzle Boards
Post by: cgeorgemo on October 02, 2009, 07:10:21 AM
This post is about making a script to solve the puzzle boards.

If EUO can be used to check the color of pixels in certain locations then the script should be straight forward.
(Please keep in mind that I don't know how to use the scripting language to do anything so the steps are going to be simplistic.)

Prep for writing the script.
Get an item identifier for the puzzle token.
Open a puzzle and measure all the necessary positions relative to a corner of the puzzle? Some way to determine where the script should look for colors and also where to find the rows and the up or down clickers as well as the button that turns it in. The timer is 30 minutes but I'm not sure how long this measuring would take. For the colored dots the actual position of the color would suffice but for the bars I'd say measuring halfway between the dot positions would be the way to go.



1)Scan for the puzzle token

2)Click the token to open the puzzle box

3)Move the box to a set location.

4) Scan for colors in positions to recognize the puzzle that needs to be solved. Go to correct solution for that puzzle

5) Solution for board 1
      Here would be the correct clicks to solve board 1

6) Solution for board 2
      Here would be the correct clicks to solve board 2

etc.

22) Solution for board 16
      Here would be the correct clicks to solve board 16

End the script.


I'm not sure how fast OCR is but I'd think that doing the prep work to find the colors in the positions would be a one time effort and would cut down on computing time overall.




You know I might have just found a script that is easy enough for me to attempt to write it.
Title: Re: Puzzle Boards
Post by: _C2_ on October 02, 2009, 07:28:00 AM
YOu know I was thinking about how awesome this would be to run when you it the sack at night.  Endless nights scans the pixels on his buff bar scanner.  I bet you can do this.
Title: Re: Puzzle Boards
Post by: cgeorgemo on October 02, 2009, 07:37:11 AM
Well I think I can do it but I'm going to be asking lots of questions.
The logical steps are no problem for me making the script do what I say it needs to. That is the problem for me.
Title: Re: Puzzle Boards
Post by: Masscre on October 02, 2009, 12:24:41 PM
I will help Cgeorgemo, but my knowledge may not be the best that we have here.  I am willing to help in any question you have or guidance you need.
Title: Re: Puzzle Boards
Post by: cgeorgemo on October 02, 2009, 12:32:07 PM
I will help Cgeorgemo, but my knowledge may not be the best that we have here.  I am willing to help in any question you have or guidance you need.
Thanks I'm going to go through the EUO tutorials because I'm fairly certain this script is going to be simple commands.
When those simple things confuse me (and they will) I'll come screaming.
Title: Re: Puzzle Boards
Post by: cgeorgemo on October 02, 2009, 04:36:25 PM
Well I've been looking through EUO wiki and I believe the info I was looking for to compare pixel color might be

savepix to save the color of a pixel

and

#pixcol to return the color of the last pixel saved with savepix

and

cmpPix to compare the color from a previously saved pixel with the current pixel

Have I missed any pixel commands that might help to sniff out certain colors in a specified location?
Title: Re: Puzzle Boards
Post by: Oracle on October 02, 2009, 05:01:53 PM
Sounds like you are getting ready to do a Puzzle Board Solution Script!   I wish I could help you, but I am not familiar with any of those commands...

A small sigh od relief that my Puzzle Board Frustration will be taken care of...!

 :D
Title: Re: Puzzle Boards
Post by: cgeorgemo on October 02, 2009, 05:46:23 PM
A small sigh od relief that my Puzzle Board Frustration will be taken care of...!

 :D
Do not count those chicken just yet....I still have to learn how to write a script.

I have however figured out that every possible shape/color combination in each row of the puzzle can be detected for color and shape in at most 2 checks of the color in a pixel position for each shape.

So it would take at most 8 checks to determine the color and shape of each row the puzzle board that needs to be solved.

And it would therefore require a maximum of 32 pixel checks to determine what board is being solved.


If I have it check from top row down the differences in the patterns will eliminate some further checks.
For instance there are only 4 puzzle boards that have a red single dot on the top row.
Once the script determines that the top row is a red dot I can check the 2nd row and that tells me which of the 4 patterns it is and I can send it to the solutions list.

Title: Re: Puzzle Boards
Post by: Masscre on October 02, 2009, 06:13:07 PM
Very good so for Cg. Mind pming me the info for the puzzle combinations so when i am helping you. we can be looking at the same thing.
Title: Re: Puzzle Boards
Post by: Oracle on October 02, 2009, 06:33:15 PM
Sounds like you are writing a Script for the puzzle board found in the Underworld at coordinates 52o 23'N 17o 47'W. You must navigate a perilous trapped hallway to reach the small room where a strongbox resides. Opening the strongbox will give you a board.

If so, the solutions have already been figured out and they are located at:

http://www.uoguide.com/Puzzle_Board (http://www.uoguide.com/Puzzle_Board)
Title: Re: Puzzle Boards
Post by: cgeorgemo on October 02, 2009, 07:15:13 PM
Very good so for Cg. Mind pming me the info for the puzzle combinations so when i am helping you. we can be looking at the same thing.
Sure I'll send it to you once I get the steps mapped out.

If so, the solutions have already been figured out and they are located at:

http://www.uoguide.com/Puzzle_Board (http://www.uoguide.com/Puzzle_Board)
Yeah I'm using those solutions in the script once I get it down how to have the puzzles recognized by EUO.
There are 16 puzzles and I'm still mapping out the combinations to see how quickly each one can be recognized.
Title: Re: Puzzle Boards
Post by: manwinc on October 02, 2009, 07:18:49 PM
I already have one i'll post when I get home.
Title: Re: Puzzle Boards
Post by: cgeorgemo on October 02, 2009, 07:24:13 PM
I already have one i'll post when I get home.
Woot.

Still going to try to write my own and learn some stuff.
Title: Re: Puzzle Boards
Post by: cgeorgemo on October 02, 2009, 08:35:41 PM
Ok here is what I've come up with so far as far as the logic goes.

There are 4 different colors I need to look for. Red, Blue, Green, and Grey. I'll refer to them as R,B,G,and Grey
 Imagine the rows with 5 locations.
*1*     *2*     *3*     *4*     *5*

Odd positions are where the dots can be in each row.



*********************************MY ROW CHECKING LOGIC*********************

A solid bar will have either R,B, or G in position *2*                   If it's a bar I'm done checking that row and I have it's color. If it's not a bar then I'll go on.

Now I simply need to check position *1* and *3*

Grey in *1* and a color in *3*    If I find that combination it's a single dot in the middle and I know the color

Color in *1* and Grey in *3*       If I find that combination it's 2 dots, one on each end and I know the color.

Color in *1* and *3*                 If I find that combination it's 3 dots all the same color and I know the color.

 Grey in *1* and *3*                 If I find that it's a blank row.

***************************END OF ROW CHECKING LOGIC**************************



There is no need to check more than the first 2 rows on the puzzle board because the 16 individual puzzles all can be identified by at most the first 2 rows.

4 of them have unique top rows
  A Blue Bar
  1 Green Dot
  2 Red Dots
  3 Blue Dots

3 of them start with a Red Bar on top then the 2nd rows are
  A Green Bar
  A Red Bar
  2 Green Dots

3 of them start with a Green Bar on top then the 2nd rows are
  1 Blue Dot
  2 Blue Dots
  A Blank Row
 
4 of them start with 1 Red Dot on top then the 2nd rows are
  A Green Bar
  1 Red Dot
  2 Green Dots
  A Blank Row

2 of them start with 3 Green Dots on top then the 2nd rows are
  A Green Bar
  A Blue Bar

Once I've determined which board it is I can send it to the correct sub for solving each of the boards.
Title: Re: Puzzle Boards
Post by: UOMaddog on October 02, 2009, 11:31:29 PM
Me being the hopeless optimist and specializing in "optimization" (my Comp. Engineering professor thinks I should go into code optimization or compiler coding), I will daresay that there is probably a way to uniquely identify each puzzle with only one pixel per puzzle!
Title: Re: Puzzle Boards
Post by: UOMaddog on October 02, 2009, 11:38:24 PM
Just a little help, I've put all the boards onto one JPEG file so that you can look at them side by side!
Title: Re: Puzzle Boards
Post by: UOMaddog on October 03, 2009, 12:26:51 AM
Ok, so 10 minutes of work and I've done it! You must scan for them in a particular order. I have attached a picture that shows the exact order and which one to scan. I'll check over it again in the morning to make sure that I didn't mess anything up since I'm a little brain dead at 4:26am!

The first three you can uniquely identify by just that one spot, then, by process of elimination, you can find a particular spot in one of the remaining puzzles, so you check for that, then from the remaining puzzles you can uniquely identify another one, and so on and so forth. So while at first glance you may say, "But #12 and #15 both have a green dot in the third row down on the far right!", but you have already determined that it is NOT #12 if you're checking for #15!! Mwahaha!

Hope this helps! 15 scans and you're done!
Title: Re: Puzzle Boards
Post by: Bagenholt on October 03, 2009, 02:45:14 AM
Wow... Impressive.
Title: Re: Puzzle Boards
Post by: cgeorgemo on October 03, 2009, 05:29:24 AM
Big big help Maddog. Using the solutions to help identify the board hadn't occured to me.

Ok I have some questions about the EUO commands

will
Code: [Select]
set contpos 120 120
put the gump at pixel 120 120

or will I have to
Code: [Select]
set %x 120
set %y 120
set contpos %x %y
to make that happen?

Title: Re: Puzzle Boards
Post by: cgeorgemo on October 03, 2009, 05:45:09 AM
You know I think I just answered my own question.


set nextCPos might be what I'm looking for.

so

Code: [Select]
set #lObjectType xxxxxx ;<----puzzle board token type
set NextCPos 120 120
event macro 17
would open the puzzleboard at pixel 120 120 on the game screen right?
Title: Re: Puzzle Boards
Post by: Scrripty on October 03, 2009, 05:51:59 AM
Big big help Maddog. Using the solutions to help identify the board hadn't occured to me.

Ok I have some questions about the EUO commands

will
Code: [Select]
set contpos 120 120
put the gump at pixel 120 120

or will I have to
Code: [Select]
set %x 120
set %y 120
set contpos %x %y
to make that happen?

By the way, this is the same expression.  You did it the same way just using variables set to 120 in the second one.   Pretty fun tho isn't it? :)
Title: Re: Puzzle Boards
Post by: cgeorgemo on October 03, 2009, 06:20:08 AM
Yeah I'm going to use
Code: [Select]
sub open_puzzle_board
set #lObjectType XXXXXX ;<-----whatever the type is for the boards
nextCPos 120 120 ;<-----or something close to that
Event Maco 17 0
pause 20
return

If that works.
I won't be able to check until I get home later tonight......working at Sears for the day.

The potential downfall I've thought of is that the puzzleboard type might be the same as a promotional token type since they are the same thing with different colors.
Title: Re: Puzzle Boards
Post by: cgeorgemo on October 03, 2009, 06:48:17 AM
Okay is this good structure?
Code: [Select]
sub find_board
savepix x y ;<---location of first check
if #pixcol blue ;<---whatever the value for blue is
{
  gosub solve_board_6
}
else
savepix x y ;<---location of second check
if #pixcol green ;<---whatever the value for green is
{
 gosub solve_board_8
}
else
savepix x y ;<---location of third check
if #pixcol blue ;<whatever the value for blue is
{
 gosub solve_board_11
}
else


etc etc etc


savepix x y ;<---location of 15th check
if #colpix blue ;<----whatever the value for blue is
{
 gosub solve_board_2
}
else
{
 gosub solve_board_16
}
return

Or should I have the stuff after the "else" braced as well?

Do I even need the else at all since it only goes to the solution sub if it finds the correct color otherwise it just goes to the next command right and scans the specified pixel?
Title: Re: Puzzle Boards
Post by: Scrripty on October 03, 2009, 06:53:55 AM
If you scan and ignore any tokens in the users pack right off the bat, that should work shouldn't it?
Title: Re: Puzzle Boards
Post by: cgeorgemo on October 03, 2009, 07:05:41 AM
If you scan and ignore any tokens in the users pack right off the bat, that should work shouldn't it?
If there is a need to I'll do that. I'm hoping that they will have different ItemTypes that would be the easiest.

At this point I think I'm mostly worried about figuring out how to use the pixel scanning correctly to find the color values I'm looking for.

Unless somebody sees a problem that hasn't occured to me.

And quite frankly I'm confused about namespace.....
Title: Re: Puzzle Boards
Post by: Scrripty on October 03, 2009, 07:12:27 AM
If you scan and ignore any tokens in the users pack right off the bat, that should work shouldn't it?
If there is a need to I'll do that. I'm hoping that they will have different ItemTypes that would be the easiest.

At this point I think I'm mostly worried about figuring out how to use the pixel scanning correctly to find the color values I'm looking for.

Unless somebody sees a problem that hasn't occured to me.

And quite frankly I'm confused about namespace.....

You'll probly need to scan for tokens and ignore the ones found so you don't end up using someones token that isn't smart enough to bank them before the script runs.  Telling people doesn't work usually. haha
Title: Re: Puzzle Boards
Post by: cgeorgemo on October 03, 2009, 09:45:41 AM
At this point in my texting life I'm willing to let them use the script with their tokens and have to read the instructions.

A wise man once told me that the best thing I'd ever do for scripting was to read the instructions for the script.
Title: Re: Puzzle Boards
Post by: UOMaddog on October 03, 2009, 09:50:24 AM
First off, I had the same thought about tokens vs puzzle boards and knowing UO, they probably are the same item type, but there are some easy fixes for that, no worries! as for your puzzle identification sub, you can model it something like this:

Code: [Select]
sub PuzzleID
if (pixel=whatever) {
return 1
}
if (pixel=whatever) {
return 2
}
if (pixel=whatever) {
return 3
}
if (pixel=whatever) {
return 4
}
if (pixel=whatever) {
return 5
}
if (pixel=whatever) {
return 6
}
if (pixel=whatever) {
return 7
}
if (pixel=whatever) {
return 8
}
if (pixel=whatever) {
return 9
}
if (pixel=whatever) {
return 10
}
if (pixel=whatever) {
return 11
}
if (pixel=whatever) {
return 12
}
if (pixel=whatever) {
return 13
}
if (pixel=whatever) {
return 14
}
if (pixel=whatever) {
return 15
}
return 16 ;You can only get here if it fails everything else!

Basically just 15 "if" statements and you "return" as soon as it identifies itself. Just a note, if we're using the numbering system that I used in my puzzle board picture, it wouldn't be 1, 2, 3, 4, etc it would be whatever order i put them in (6,8,11,1210,7,15,3....etc)
Title: Re: Puzzle Boards
Post by: _C2_ on October 03, 2009, 10:08:57 AM
just out of curiosity will this be posted for public once it is completed?  I would love a version of this.  hehe.
Title: Re: Puzzle Boards
Post by: cgeorgemo on October 03, 2009, 11:40:01 AM
I was wondering if you HAD to tie an else to an if that's why i asked about having to have the else at all.

Now about the different numbered returns. Do they go back to different locations?

I'm under the impression that a return bounced the script to the line after the gosub command. Since there are 16 different solutions that I need to include how would the script then know which one to send to?  I can put an operation  in there after every if that adds to the previous value. The total of the variable then tells the script where to look for the sub for the solution for that value.
If I did this I'd put a rule about clearing the count variable at the top of the script.


just out of curiosity will this be posted for public once it is completed?  I would love a version of this.  hehe.
Oh yeah this would definitely be a public script. I don't see anything gamebreaking with this little learning tool.
Title: Re: Puzzle Boards
Post by: manwinc on October 03, 2009, 11:41:46 AM
I posted mine, Hope it helps :)
Title: Re: Puzzle Boards
Post by: cgeorgemo on October 03, 2009, 03:12:22 PM
Well I will have to wait until the wall comes down before I can get a board to measure some distances.
Title: Re: Puzzle Boards
Post by: cgeorgemo on October 03, 2009, 05:43:37 PM
In the mean time all the tokens I own are Objecttype AHQ so I'm willing to bet that the puzzle board ones are AHQ as well. So then my sub to open the board would be
Code: [Select]
sub open_puzzle_board
set #lObjectType AHQ
nextCPos 20 20
event macro 17 0
pause 20
return

Title: Re: Puzzle Boards
Post by: cgeorgemo on October 03, 2009, 06:55:23 PM
Hmmmm that isn't working when I try it out on my soulstone token to get it to open it.
I can't figure out how to get it to open my token.

I've been able to make it open the token gump if I've previously opened the gump then close it and that saves the #LOBJECTTYPE AHQ

What I can't get it to do is use the token unless I've previously opened it to make it be the #LOBJECTTYPE
I must be missing something.

I don't think that
set #lobjecttype AHQ
works to make AHQ the last type

Title: Re: Puzzle Boards
Post by: manwinc on October 03, 2009, 07:32:29 PM
Finditem AHQ C_ , #backpackid
set #Lobjectid #findid



Have to use the "ID" For last object.
Title: Re: Puzzle Boards
Post by: Scrripty on October 03, 2009, 07:33:20 PM
Damnit manwinc I was posting that at the SAME time. :)

Code: [Select]
finditem %tokentype C_ , #backpackid
SET #ltargetid #findid
Title: Re: Puzzle Boards
Post by: cgeorgemo on October 03, 2009, 07:36:32 PM
Finditem AHQ C_ , #backpackid
set #Lobjectid #findid



Have to use the "ID" For last object.


Thanks
Ok you know when I tried your script it wouldn't open the token either until I clicked it to make it last object.
Title: Re: Puzzle Boards
Post by: manwinc on October 03, 2009, 08:56:08 PM
uh... still need


 Event macro 17 0 <- Last Object
Title: Re: Puzzle Boards
Post by: UOMaddog on October 03, 2009, 09:05:02 PM
I was wondering if you HAD to tie an else to an if that's why i asked about having to have the else at all.

Now about the different numbered returns. Do they go back to different locations?

I'm under the impression that a return bounced the script to the line after the gosub command. Since there are 16 different solutions that I need to include how would the script then know which one to send to?  I can put an operation  in there after every if that adds to the previous value. The total of the variable then tells the script where to look for the sub for the solution for that value.
If I did this I'd put a rule about clearing the count variable at the top of the script.


just out of curiosity will this be posted for public once it is completed?  I would love a version of this.  hehe.
Oh yeah this would definitely be a public script. I don't see anything gamebreaking with this little learning tool.

Ok...here's a little tutorial on how gosub's and returns work! It's a very simple example, but I am adding in a lot of features that kind of seem superfluous for something so basic, but it's just an example. I've added comments to almost every line to help you understand.

Here's a little sample:
Code: [Select]
;Variables
set %bandages ZLF

;Main loop
repeat
if #hits < #maxhits ;If you've taken damage
{
gosub CheckForSomething %bandages #backpackid ;First check for bandages in your backpack
if #result > 0 ;Then, if you have bandages, heal yourself!
{
gosub Heal
}
}
until #clilogged = 1 ;Main loop will repeat until you get disconnected or log out

sub CheckForSomething
finditem %1 C_ , %2 ;Checks for whatever is passed to it in slot 1, in a container specified by slot 2
return #findcnt ;Returns the number of bandages found

sub Heal
event macro 58 ;Bandage Self macro
return

Ok, let's take this one step at a time...

#1. I declare my variables. In this case, %bandages is set to ZLF which is the ItemTYPE for bandages (at least I'm pretty sure it is, I pulled it off the top of my head so I could be wrong)

#2. Our main loop! I almost always use a "repeat until" loop so that my script runs until I log out or get disconnected. Sometimes you may want to set some other conditions, but the repeat/until that I used in the example will almost always suffice!

#3. First we start by checking our hit points. If we are less than our max hit points, we then do something, in this case, check for bandages.

#4. Here's where things are a little more complicated! I call "gosub CheckForSomething %bandages #backpackid".
--Here's how the gosub works: When I call "gosub" I can pass it variables, in this case, %bandages and #backpackid. Once I'm in the subroutine, I can reference those variables by what "slot" they are in. If you hop down to the CheckForSomething sub, you'll notice I say "finditem %1". What this is actually saying is "finditem %bandages" since %bandages is the first thing I pass to the sub! The rest of that line reads "C_ , %2". This is the same as saying "C_ , #backpackid". Don't worry yourself with the meaning of the comma right now, it's a bit too complex (even for me sometimes). So, our line that reads "finditem %1 C_ , %2" is effectively the same as "finditem %bandages C_ , #backpackid". We are trying to find bandages in a specific container (our backpack).

#5. In our CheckForSomething sub, we then "return #findcnt". When we called the finditem command, it fills in a bunch of system variables for us: #findid, #findx, #findy, #findz, #findkind, #findmod, #findindex, #findtype, #findstack, #findrep, #findcnt, #finddist, #findbagid, and #findcol. Each of these gives us some information about whatever it found. The one that we are concerned about is #findcnt! This one tells us how many of our item it found! So in this case, how many bandages it found. We are then "returning" this value ("return #findcnt"). This puts the value of #findcnt into the #result system variable! We'll talk about this in the next step!

#6. Back up in our main loop, our next line is "if #result > 0". Now, we just put our value of #findcnt into the #result system variable, so that will tell us how many bandages if have. Therefore, this whole line is saying that if it found more than zero bandages, then heal yourself!

#7. Our Heal sub simply does event macro 58 (bandage self) and then returns. We do not pass it variables, and it does not return anything to us!


Ok, so you may be asking yourself WHY would I want to do this?! There are easier ways to do it! Well, the nice thing about a sub like "CheckForSomething" is that you can use it for ANYTHING! If you need to check for pots, just pass it %healpots or whatever else. And then specified which container you're looking for it in! Most of the time, it would be #backpackid, but you could look for something in a different container as well. You can also tweak it a bit! Maybe instead of returning it #findcnt, you can return #findid if it find something, or 0 if it doesn't! There's all kinds of fun things you can do!




So....back to the puzzles...What that sub in the script would do is return which puzzle it is in #result. Now, this is just one way to do it! You could alternately do something like:
Code: [Select]
sub PuzzlePicker
if (pixel=whatever)
{
gosub SolvePuzzle1
return
}
if (pixel=whatever)
{
gosub SolvePuzzle2
return
}
.
.
.
return

That way, it would solve the puzzle and then kick back out of the sub to continue the rest of the script!

I think I've written enough in this post, so I'll just end here. Keep posting any questions!
Title: Re: Puzzle Boards
Post by: UOMaddog on October 03, 2009, 10:40:09 PM
Ok, I saw you ask about pixels in the Shout Box so I figured I'd head off some questions for ya:

I am not sure yet how we can hard code in the colors to compare to. SavePix needs X/Y coordinates to pull a color and stores it in #PixCol. But unfortunately, PixCol is read-only. We cannot set it to anything  :-[ Also, cmppix can only compare what was saved to see if it changed. It cannot be used to compare 2 different pixels....

So....Let's start some brainstorming for how to save and compare some pixels!!!! All input is welcome!
Title: Re: Puzzle Boards
Post by: manwinc on October 04, 2009, 05:50:22 AM
Sub Pixel_Code
set %Pixel_Code
For %X_Pos 1 3
{
For %Y_Pos 1 4
{
set %X_Pix ( #contposx + 220 + ( ( %X_Pos - 1 ) * 40 ) )
set %Y_Pix ( #contposy + 90 + ( ( %Y_Pos - 1 ) *  34 ) )
Savepix %X_Pix %Y_Pix 1
Str Left #pixcol 1
set %Pixel_Code %Pixel_Code , #strres
}
}
return

Codes 12 Pixels into a single string that can then be used to figure out what puzzle it is. For one of the puzzle boards anyways.
Title: Re: Puzzle Boards
Post by: cgeorgemo on October 04, 2009, 07:12:58 AM
Ok, I saw you ask about pixels in the Shout Box so I figured I'd head off some questions for ya:

I am not sure yet how we can hard code in the colors to compare to. SavePix needs X/Y coordinates to pull a color and stores it in #PixCol. But unfortunately, PixCol is read-only. We cannot set it to anything  :-[ Also, cmppix can only compare what was saved to see if it changed. It cannot be used to compare 2 different pixels....

So....Let's start some brainstorming for how to save and compare some pixels!!!! All input is welcome!
Well I was hoping to use savepix to find a pixels color and then use colpix to compare the value against some values I read from a puzzle board. But then I had a thought that the effects of infravision and night sight might throw off those numbers for other players.
Title: Re: Puzzle Boards
Post by: cgeorgemo on October 04, 2009, 07:39:04 AM
Well it has been a frustrating morning.
I can't get the token gumps to open where I want them to.
When I try to use nextcpos it will change the position of the back pack or any bags I open in my backpack but it just throws up the token gump wherever I had dragged it to last.
Title: Re: Puzzle Boards
Post by: cgeorgemo on October 04, 2009, 07:46:36 AM
okay I am successful in getting this to open the token and read a pixel's color but I can't make the token gump move to a correct location so that I can be looking at a specific pixel on it.
Code: [Select]
Finditem AHQ C_ , #backpackid
set #Lobjectid #findid
event macro 17 0
gosub color
halt



sub color
savepix 437 200 1
display #pixcol
return
I'm not having any luck getting the #nextcpos values to have any effect on the token's gump.
Title: Re: Puzzle Boards
Post by: UOMaddog on October 04, 2009, 04:26:31 PM
They may have changed the way those particular gumps work.
Title: Re: Puzzle Boards
Post by: cgeorgemo on October 04, 2009, 04:37:46 PM
They may have changed the way those particular gumps work.
Yeah I'm hoping that the boards will be different than the token for soulstones.
Title: Re: Puzzle Boards
Post by: manwinc on October 04, 2009, 05:28:50 PM
Contpos 0 0

after it has been confirmed it is open.


and you can use #contposx #contposy for where you are scanning so it scans no matter where the gump is. Did noone look at my example!?!?!
Title: Re: Puzzle Boards
Post by: cgeorgemo on October 04, 2009, 08:40:46 PM
Contpos 0 0

after it has been confirmed it is open.


and you can use #contposx #contposy for where you are scanning so it scans no matter where the gump is. Did noone look at my example!?!?!
I could look at your example for a few hours and still not know what over half of it means.
Title: Re: Puzzle Boards
Post by: cgeorgemo on October 04, 2009, 10:14:42 PM
Okay I've been looking through the documentation at http://wiki.easyuo.com/index.php/Main_Page (http://wiki.easyuo.com/index.php/Main_Page) and I think I'm starting to understand.
I'm really impressed with the way you used a cipher to tell the script how to click. I'm just going to write a sub for each click up and down and for each row and have the script run through them in subs.
Does
Code: [Select]
Str Left #pixcol 1 just grab the 1st number in the #pixcol value?

Title: Re: Puzzle Boards
Post by: cgeorgemo on October 05, 2009, 09:22:40 AM
Okay this is what I've come up with so far.
I think I'm done until they unlock the room and let us have access to the puzzle boards again.
Until that happens I cant measure some distances or get some color values I need to make this work.

*WARNING* it isn't nearly as elegant as Manwinc's script is. If you think of his as a marksman's bullet think of mine as an artillery barrage.
[sarcasm]But it is my first script and I think he had done at least a couple more. [/sarcasm]


Code: [Select]
;====================================================
; Script Name: Cgeorgemo's Puzzle Board Clicker
; Author: Cgeorgemo
; Version: 1.0
; Client Tested with: not tested yet
; EUO version tested with: 154
; Shard OSI / FS:  OSI
; Revision Date:
; Public Release:
; Purpose: Clicking the Puzzle Boards
;====================================================

Finditem C_ , #backpackid
set #lobjectid #findid
event macro 17 0
wait 20
gosub Find_Board


;========Find Which Board=====================
sub Find_Board
set %x #contposx + xshift ; measure to find
set %y #contposy + yshift ; measure to find
savepix %x %y 1
If #pixcol xxxxxxxxxxxx ; find this color value
{
 gosub Solve_6
 gosub apply
}
set %x #contposx + xshift
set %y #contposy + yshift
savepix %x %y 1
If #pixcol xxxxxxxxxxxx
{
 gosub Solve_8
 gosub apply
}
set %x #contposx + xshift
set %y #contposy + yshift
savepix %x %y 1
If #pixcol xxxxxxxxxxxx
{
 gosub Solve_11
 gosub apply
}
set %x #contposx + xshift
set %y #contposy + yshift
savepix %x %y 1
If #pixcol xxxxxxxxxxxx
{
 gosub Solve_12
 gosub apply
}
set %x #contposx + xshift
set %y #contposy + yshift
savepix %x %y 1
If #pixcol xxxxxxxxxxxx
{
 gosub Solve_10
 gosub apply
}
set %x #contposx + xshift
set %y #contposy + yshift
savepix %x %y 1
If #pixcol xxxxxxxxxxxx
{
 gosub Solve_7
 gosub apply
}
set %x #contposx + xshift
set %y #contposy + yshift
savepix %x %y 1
If #pixcol xxxxxxxxxxxx
{
 gosub Solve_15
 gosub apply
}
set %x #contposx + xshift
set %y #contposy + yshift
savepix %x %y 1
If #pixcol xxxxxxxxxxxx
{
 gosub Solve_3
 gosub apply
}
set %x #contposx + xshift
set %y #contposy + yshift
savepix %x %y 1
If #pixcol xxxxxxxxxxxx
{
 gosub Solve_5
 gosub apply
}
set %x #contposx + xshift
set %y #contposy + yshift
savepix %x %y 1
If #pixcol xxxxxxxxxxxx
{
 gosub Solve_9
 gosub apply
}
set %x #contposx + xshift
set %y #contposy + yshift
savepix %x %y 1
If #pixcol xxxxxxxxxxxx
{
 gosub Solve_13
 gosub apply
}
set %x #contposx + xshift
set %y #contposy + yshift
savepix %x %y 1
If #pixcol xxxxxxxxxxxx
{
 gosub Solve_14
 gosub apply
}
set %x #contposx + xshift
set %y #contposy + yshift
savepix %x %y 1
If #pixcol xxxxxxxxxxxx
{
 gosub Solve_4
 gosub apply
}
set %x #contposx + xshift
set %y #contposy + yshift
savepix %x %y 1
If #pixcol xxxxxxxxxxxx
{
 gosub Solve_1
 gosub apply
}
set %x #contposx + xshift
set %y #contposy + yshift
savepix %x %y 1
If #pixcol xxxxxxxxxxxx
{
 gosub Solve_2
 gosub apply
}
gosub Solve_16
gosub apply

;===========Solution Subs=================
sub Solve_1
gosub Row_1
gosub Row_1u
gosub Row_4
gosub Row_4u
gosub Row_3
gosub Row_3u
gosub Row_2
gosub Row_2u
gosub Row_1
gosub Row_1u
gosub Row_2
gosub Row_2d
return

sub Solve_2
gosub Row_1
gosub Row_1u
gosub Row_4
gosub Row_4u
gosub Row_4d
gosub Row_3
gosub Row_3d
gosub Row_1
gosub Row_1u
gosub Row_3
gosub Row_3u
return

sub Solve_3
gosub Row_1
gosub Row_1d
gosub Row_2
gosub Row_2u
gosub Row_1
gosub Row_1d
gosub Row_4
gosub Row_4u
return

sub Solve_4
gosub row_3
gosub Row_3u
gosub Row_2
gosub Row_2u
gosub Row_1
gosub Row_1u
gosub Row_2
gosub Row_2d
gosub Row_1
gosub Row_1d
gosub Row_1d
gosub Row_4
gosub Row_4d
return

sub Solve_5
gosub Row_1
gosub Row_1u
gosub Row_4
gosub Row_4u
gosub Row_3
gosub Row_3u
gosub Row_2
gosub Row_2u
gosub Row_3
gosub Row_3d
gosub Row_1
gosub Row_1u
gosub Row_2
gosub Row_2u
return

sub Solve_6
gosub Row_1
gosub Row_1u
gosub Row_3
gosub Row_3u
gosub Row_2
gosub Row_2u
gosub Row_2d
gosub Row_1
gosub Row_1d
gosub Row_4
gosub Row_4u
gosub Row_3
gosub Row_3u
gosub Row_4
gosub Row_4u
return

sub Solve_7
gosub Row_2
gosub Row_3d
gosub Row_1
gosub Row_1d
gosub Row_4
gosub Row_4u
gosub Row_1
gosub Row_1u
gosub Row_2
gosub Row_2u
return

sub Solve_8
gosub Row_4
gosub Row_4d
gosub Row_1
gosub Row_1d
gosub Row_2
gosub Row_2u
gosub Row_2u
return

sub Solve_9
gosub Row_4
gosub Row_4u
gosub Row_3
gosub Row_3d
gosub Row_1
gosub Row_1d
gosub Row_1u
gosub Row_4
gosub Row_4u
gosub Row_4d
gosub Row_3
gosub Row_3u
return

sub Solve_10
gosub Row_4
gosub Row_4u
gosub Row_3
gosub Row_3u
gosub Row_4
gosub Row_4d
gosub Row_2
gosub Row_2u
gosub Row_1
gosub Row_1u
gosub Row_3
gosub Row_3d
return

sub Solve_11
gosub Row_4
gosub Row_4d
gosub Row_3
gosub Row_3u
gosub Row_2
gosub Row_2u
gosub Row_1
gosub Row_1u
gosub Row_4
gosub Row_4u
gosub Row_1
gosub Row_1d
return

sub Solve_12
gosub Row_4
gosub Row_4u
gosub Row_2
gosub Row_2u
gosub Row_1
gosub Row_1u
gosub Row_1d
gosub Row_2
gosub Row_2d
return

sub Solve_13
gosub Row_2
gosub Row_2u
gosub Row_2d
gosub Row_1
gosub Row_1d
gosub Row_2
gosub Row_2d
gosub Row_2u
gosub Row_3
gosub Row_3d
return

sub Solve_14
gosub Row_3
gosub Row_3d
gosub Row_2
gosub Row_2u
gosub Row_1
gosub Row_1u
gosub Row_2
gosub Row_2u
gosub Row_4
gosub Row_4u
gosub Row_3
gosub Row_3u
gosub Row_1
gosub Row_1d
return

sub Solve_15
gosub Row_3
gosub Row_3u
gosub Row_2
gosub Row_2u
gosub Row_4
gosub Row_4d
gosub Row_3
gosub Row_3d
gosub Row_2
gosub Row_2d
gosub Row_4
gosub Row_4u
return

sub Solve_16
gosub Row_3
gosub Row_3u
gosub Row_4
gosub Row_4u
gosub Row_3
gosub Row_3u
gosub Row_4
gosub Row_4d
gosub Row_1
gosub Row_1u
gosub Row_2
gosub Row_2d
return

;=====================Row and Direction Subs==========
sub Row_1
set %clickx #contpos + 115
set %clicky #contpos + 90
click %clickx %clicky
wait 5
return

sub Row_2
set %clickx #contposx + 115
set %clicky #contposy + 123
click %clickx %clicky
wait 5
return


sub Row_3
set %clickx #contposx + 115
set %clicky #contposy + 156
click %clickx %clicky
wait 5
return

sub Row_4
set %clickx #contposx + 115
set %clicky #contposy + 189
click %clickx %clicky
wait 5
return

sub Row_1u
set %clickx #contposx + 95
set %clicky #contposy + 90
click %clickx %clicky
wait 5
return

sub Row_1d
set %clickx #contposx + 137
set %clicky #contposy + 90
click %clickx %clicky
wait 5
return

sub Row_2u
set %clickx #contposx + 95
set %clicky #contposy + 123
click %clickx %clicky
wait 5
return

sub Row_2d
set %clickx #contposx + 137
set %clicky #contposy + 123
click %clickx %clicky
wait 5
return

sub Row_3u
set %clickx #contposx + 95
set %clicky #contposy +156
click %clickx %clicky
wait 5
return

sub Row_3d
set %clickx #contposx + 137
set %clicky #contposy + 156
click %clickx %clicky
wait 5
return

sub Row_4u
set %clickx #contposx + 95
set %clicky #contposy + 189
click %clickx %clicky
wait 5
return

sub Row_4d
set %clickx #contposx + 137
set %clicky #contposy + 189
click %clickx %clicky
wait 5
return

;============Apply Sub==============
sub apply
set %Clickx #contposx + 120
set %Clicky #contposy + 330
click %clickx %Clicky
wait 5
halt





Well there it sits waiting for OSI to stop all those bad cheaters from getting too much goodies so I can get in the room and finish it.
Title: Re: Puzzle Boards
Post by: cgeorgemo on October 05, 2009, 02:30:22 PM
So I ran the syntax error check in Scriptuo and got these results

Method count: 56
Command count: 56
*** Pass 1 - Label accounting:
*** Error - Subroutine Solve_1 - Line 146 nested without return.
Subroutine labels = 30
Tag labels = 0
15 Code block(s).
0 Warnings(s) encountered.
*** Pass 2 - Execution [SYNTAXCHECK]

When I look at subroutine Solve_1 at line 146 I see a return at line 159 which is meant to end it. What am I missing?
Title: Re: Puzzle Boards
Post by: Masscre on October 05, 2009, 02:58:31 PM
Your structure is a little wacked it problably works but has issues in the structure.

You need a main program
then sub routines to break the main up and make it easy to trouble shoot.


Code: [Select]
;====================================================
; Script Name: Cgeorgemo's Puzzle Board Clicker
; Author: Cgeorgemo
; Version: 1.0
; Client Tested with: not tested yet
; EUO version tested with: 154
; Shard OSI / FS:  OSI
; Revision Date:
; Public Release:
; Purpose: Clicking the Puzzle Boards
;====================================================

Finditem C_ , #backpackid
set #lobjectid #findid
event macro 17 0
wait 20
gosub Find_Board


;========Find Which Board=====================
sub Find_Board                                                   <------------------------ you have a subroutine here but no return for it
set %x #contposx + xshift ; measure to find
set %y #contposy + yshift ; measure to find
savepix %x %y 1
If #pixcol xxxxxxxxxxxx ; find this color value
{
 gosub Solve_6
 gosub apply
}
set %x #contposx + xshift
set %y #contposy + yshift
savepix %x %y 1
If #pixcol xxxxxxxxxxxx
{
 gosub Solve_8
 gosub apply
}
set %x #contposx + xshift
set %y #contposy + yshift
savepix %x %y 1
If #pixcol xxxxxxxxxxxx
{
 gosub Solve_11
 gosub apply
}
set %x #contposx + xshift
set %y #contposy + yshift
savepix %x %y 1
If #pixcol xxxxxxxxxxxx
{
 gosub Solve_12
 gosub apply
}
set %x #contposx + xshift
set %y #contposy + yshift
savepix %x %y 1
If #pixcol xxxxxxxxxxxx
{
 gosub Solve_10
 gosub apply
}
set %x #contposx + xshift
set %y #contposy + yshift
savepix %x %y 1
If #pixcol xxxxxxxxxxxx
{
 gosub Solve_7
 gosub apply
}
set %x #contposx + xshift
set %y #contposy + yshift
savepix %x %y 1
If #pixcol xxxxxxxxxxxx
{
 gosub Solve_15
 gosub apply
}
set %x #contposx + xshift
set %y #contposy + yshift
savepix %x %y 1
If #pixcol xxxxxxxxxxxx
{
 gosub Solve_3
 gosub apply
}
set %x #contposx + xshift
set %y #contposy + yshift
savepix %x %y 1
If #pixcol xxxxxxxxxxxx
{
 gosub Solve_5
 gosub apply
}
set %x #contposx + xshift
set %y #contposy + yshift
savepix %x %y 1
If #pixcol xxxxxxxxxxxx
{
 gosub Solve_9
 gosub apply
}
set %x #contposx + xshift
set %y #contposy + yshift
savepix %x %y 1
If #pixcol xxxxxxxxxxxx
{
 gosub Solve_13
 gosub apply
}
set %x #contposx + xshift
set %y #contposy + yshift
savepix %x %y 1
If #pixcol xxxxxxxxxxxx
{
 gosub Solve_14
 gosub apply
}
set %x #contposx + xshift
set %y #contposy + yshift
savepix %x %y 1
If #pixcol xxxxxxxxxxxx
{
 gosub Solve_4
 gosub apply
}
set %x #contposx + xshift
set %y #contposy + yshift
savepix %x %y 1
If #pixcol xxxxxxxxxxxx
{
 gosub Solve_1
 gosub apply
}
set %x #contposx + xshift
set %y #contposy + yshift
savepix %x %y 1
If #pixcol xxxxxxxxxxxx
{
 gosub Solve_2
 gosub apply
}
gosub Solve_16
gosub apply
                                                                              <---------------------------------------structure wise it appears you should have a  return here
;===========Solution Subs=================
sub Solve_1
gosub Row_1
gosub Row_1u
gosub Row_4
gosub Row_4u
gosub Row_3
gosub Row_3u
gosub Row_2
gosub Row_2u
gosub Row_1
gosub Row_1u
gosub Row_2
gosub Row_2d
return

sub Solve_2
gosub Row_1
gosub Row_1u
gosub Row_4
gosub Row_4u
gosub Row_4d
gosub Row_3
gosub Row_3d
gosub Row_1
gosub Row_1u
gosub Row_3
gosub Row_3u
return

sub Solve_3
gosub Row_1
gosub Row_1d
gosub Row_2
gosub Row_2u
gosub Row_1
gosub Row_1d
gosub Row_4
gosub Row_4u
return

sub Solve_4
gosub row_3
gosub Row_3u
gosub Row_2
gosub Row_2u
gosub Row_1
gosub Row_1u
gosub Row_2
gosub Row_2d
gosub Row_1
gosub Row_1d
gosub Row_1d
gosub Row_4
gosub Row_4d
return

sub Solve_5
gosub Row_1
gosub Row_1u
gosub Row_4
gosub Row_4u
gosub Row_3
gosub Row_3u
gosub Row_2
gosub Row_2u
gosub Row_3
gosub Row_3d
gosub Row_1
gosub Row_1u
gosub Row_2
gosub Row_2u
return

sub Solve_6
gosub Row_1
gosub Row_1u
gosub Row_3
gosub Row_3u
gosub Row_2
gosub Row_2u
gosub Row_2d
gosub Row_1
gosub Row_1d
gosub Row_4
gosub Row_4u
gosub Row_3
gosub Row_3u
gosub Row_4
gosub Row_4u
return

sub Solve_7
gosub Row_2
gosub Row_3d
gosub Row_1
gosub Row_1d
gosub Row_4
gosub Row_4u
gosub Row_1
gosub Row_1u
gosub Row_2
gosub Row_2u
return

sub Solve_8
gosub Row_4
gosub Row_4d
gosub Row_1
gosub Row_1d
gosub Row_2
gosub Row_2u
gosub Row_2u
return

sub Solve_9
gosub Row_4
gosub Row_4u
gosub Row_3
gosub Row_3d
gosub Row_1
gosub Row_1d
gosub Row_1u
gosub Row_4
gosub Row_4u
gosub Row_4d
gosub Row_3
gosub Row_3u
return

sub Solve_10
gosub Row_4
gosub Row_4u
gosub Row_3
gosub Row_3u
gosub Row_4
gosub Row_4d
gosub Row_2
gosub Row_2u
gosub Row_1
gosub Row_1u
gosub Row_3
gosub Row_3d
return

sub Solve_11
gosub Row_4
gosub Row_4d
gosub Row_3
gosub Row_3u
gosub Row_2
gosub Row_2u
gosub Row_1
gosub Row_1u
gosub Row_4
gosub Row_4u
gosub Row_1
gosub Row_1d
return

sub Solve_12
gosub Row_4
gosub Row_4u
gosub Row_2
gosub Row_2u
gosub Row_1
gosub Row_1u
gosub Row_1d
gosub Row_2
gosub Row_2d
return

sub Solve_13
gosub Row_2
gosub Row_2u
gosub Row_2d
gosub Row_1
gosub Row_1d
gosub Row_2
gosub Row_2d
gosub Row_2u
gosub Row_3
gosub Row_3d
return

sub Solve_14
gosub Row_3
gosub Row_3d
gosub Row_2
gosub Row_2u
gosub Row_1
gosub Row_1u
gosub Row_2
gosub Row_2u
gosub Row_4
gosub Row_4u
gosub Row_3
gosub Row_3u
gosub Row_1
gosub Row_1d
return

sub Solve_15
gosub Row_3
gosub Row_3u
gosub Row_2
gosub Row_2u
gosub Row_4
gosub Row_4d
gosub Row_3
gosub Row_3d
gosub Row_2
gosub Row_2d
gosub Row_4
gosub Row_4u
return

sub Solve_16
gosub Row_3
gosub Row_3u
gosub Row_4
gosub Row_4u
gosub Row_3
gosub Row_3u
gosub Row_4
gosub Row_4d
gosub Row_1
gosub Row_1u
gosub Row_2
gosub Row_2d
return

;=====================Row and Direction Subs==========
sub Row_1
set %clickx #contpos + 115
set %clicky #contpos + 90
click %clickx %clicky
wait 5
return

sub Row_2
set %clickx #contposx + 115
set %clicky #contposy + 123
click %clickx %clicky
wait 5
return


sub Row_3
set %clickx #contposx + 115
set %clicky #contposy + 156
click %clickx %clicky
wait 5
return

sub Row_4
set %clickx #contposx + 115
set %clicky #contposy + 189
click %clickx %clicky
wait 5
return

sub Row_1u
set %clickx #contposx + 95
set %clicky #contposy + 90
click %clickx %clicky
wait 5
return

sub Row_1d
set %clickx #contposx + 137
set %clicky #contposy + 90
click %clickx %clicky
wait 5
return

sub Row_2u
set %clickx #contposx + 95
set %clicky #contposy + 123
click %clickx %clicky
wait 5
return

sub Row_2d
set %clickx #contposx + 137
set %clicky #contposy + 123
click %clickx %clicky
wait 5
return

sub Row_3u
set %clickx #contposx + 95
set %clicky #contposy +156
click %clickx %clicky
wait 5
return

sub Row_3d
set %clickx #contposx + 137
set %clicky #contposy + 156
click %clickx %clicky
wait 5
return

sub Row_4u
set %clickx #contposx + 95
set %clicky #contposy + 189
click %clickx %clicky
wait 5
return

sub Row_4d
set %clickx #contposx + 137
set %clicky #contposy + 189
click %clickx %clicky
wait 5
return

;============Apply Sub==============
sub apply                             <--------------------------------- you also have a sub routine here but no return for it either
set %Clickx #contposx + 120
set %Clicky #contposy + 330
click %clickx %Clicky
wait 5
halt
                                             <--------------------------------- you have a halt here but this is not teh main bulk of the program just a subroutine you need a return here also
Title: Re: Puzzle Boards
Post by: UOMaddog on October 05, 2009, 05:15:30 PM
Massacre...for being Elite, you sure don't know how to use Code brackets!!  :P

Fixed - TM
Title: Re: Puzzle Boards
Post by: cgeorgemo on October 05, 2009, 05:40:05 PM
Masscre thanks for the tips. Hell thank all of you for the tips.
I moved some stuff around slightly and came up with this.
Code: [Select]
;====================================================
; Script Name: Cgeorgemo's Puzzle Board Clicker
; Author: Cgeorgemo
; Version: 1.1
; Client Tested with: not tested yet
; EUO version tested with: 154
; Shard OSI / FS:  OSI
; Revision Date:
; Public Release:
; Purpose: Clicking the Puzzle Boards
;====================================================
Finditem C_ , #backpackid
set #lobjectid #findid
event macro 17 0
wait 20
gosub Find_Board
gosub apply
halt


;========Find Which Board=====================
sub Find_Board
  set %x #contposx + xshift ; measure to find
  set %y #contposy + yshift ; measure to find
  savepix %x %y 1
  If #pixcol xxxxxxxxxxxx ; find this color value
  {
    gosub Solve_6
    return
  }
  set %x #contposx + xshift
  set %y #contposy + yshift
  savepix %x %y 1
  If #pixcol xxxxxxxxxxxx
  {
    gosub Solve_8
    return
  }
  set %x #contposx + xshift
  set %y #contposy + yshift
  savepix %x %y 1
  If #pixcol xxxxxxxxxxxx
  {
    gosub Solve_11
    return
  }
  set %x #contposx + xshift
  set %y #contposy + yshift
  savepix %x %y 1
  If #pixcol xxxxxxxxxxxx
  {
    gosub Solve_12
    return
  }
  set %x #contposx + xshift
  set %y #contposy + yshift
  savepix %x %y 1
  If #pixcol xxxxxxxxxxxx
  {
    gosub Solve_10
    return
  }
  set %x #contposx + xshift
  set %y #contposy + yshift
  savepix %x %y 1
  If #pixcol xxxxxxxxxxxx
  {
    gosub Solve_7
    return
  }
  set %x #contposx + xshift
  set %y #contposy + yshift
  savepix %x %y 1
  If #pixcol xxxxxxxxxxxx
  {
    gosub Solve_15
    return
  }
  set %x #contposx + xshift
  set %y #contposy + yshift
  savepix %x %y 1
  If #pixcol xxxxxxxxxxxx
  {
    gosub Solve_3
    return
  }
  set %x #contposx + xshift
  set %y #contposy + yshift
  savepix %x %y 1
  If #pixcol xxxxxxxxxxxx
  {
    gosub Solve_5
    return
  }
  set %x #contposx + xshift
  set %y #contposy + yshift
  savepix %x %y 1
  If #pixcol xxxxxxxxxxxx
  {
    gosub Solve_9
    return
  }
  set %x #contposx + xshift
  set %y #contposy + yshift
  savepix %x %y 1
  If #pixcol xxxxxxxxxxxx
  {
    gosub Solve_13
    return
  }
  set %x #contposx + xshift
  set %y #contposy + yshift
  savepix %x %y 1
  If #pixcol xxxxxxxxxxxx
  {
    gosub Solve_14
    return
  }
  set %x #contposx + xshift
  set %y #contposy + yshift
  savepix %x %y 1
  If #pixcol xxxxxxxxxxxx
  {
    gosub Solve_4
    return
  }
  set %x #contposx + xshift
  set %y #contposy + yshift
  savepix %x %y 1
  If #pixcol xxxxxxxxxxxx
  {
    gosub Solve_1
    return
  }
  set %x #contposx + xshift
  set %y #contposy + yshift
  savepix %x %y 1
  If #pixcol xxxxxxxxxxxx
  {
    gosub Solve_2
    return
  }
  gosub Solve_16
  return

;===========Solution Subs=================
sub Solve_1
  gosub Row_1
  gosub Row_1u
  gosub Row_4
  gosub Row_4u
  gosub Row_3
  gosub Row_3u
  gosub Row_2
  gosub Row_2u
  gosub Row_1
  gosub Row_1u
  gosub Row_2
  gosub Row_2d
return

sub Solve_2
  gosub Row_1
  gosub Row_1u
  gosub Row_4
  gosub Row_4u
  gosub Row_4d
  gosub Row_3
  gosub Row_3d
  gosub Row_1
  gosub Row_1u
  gosub Row_3
  gosub Row_3u
return

sub Solve_3
  gosub Row_1
  gosub Row_1d
  gosub Row_2
  gosub Row_2u
  gosub Row_1
  gosub Row_1d
  gosub Row_4
  gosub Row_4u
return

sub Solve_4
  gosub row_3
  gosub Row_3u
  gosub Row_2
  gosub Row_2u
  gosub Row_1
  gosub Row_1u
  gosub Row_2
  gosub Row_2d
  gosub Row_1
  gosub Row_1d
  gosub Row_1d
  gosub Row_4
  gosub Row_4d
return

sub Solve_5
  gosub Row_1
  gosub Row_1u
  gosub Row_4
  gosub Row_4u
  gosub Row_3
  gosub Row_3u
  gosub Row_2
  gosub Row_2u
  gosub Row_3
  gosub Row_3d
  gosub Row_1
  gosub Row_1u
  gosub Row_2
  gosub Row_2u
return

sub Solve_6
  gosub Row_1
  gosub Row_1u
  gosub Row_3
  gosub Row_3u
  gosub Row_2
  gosub Row_2u
  gosub Row_2d
  gosub Row_1
  gosub Row_1d
  gosub Row_4
  gosub Row_4u
  gosub Row_3
  gosub Row_3u
  gosub Row_4
  gosub Row_4u
return

sub Solve_7
  gosub Row_2
  gosub Row_3d
  gosub Row_1
  gosub Row_1d
  gosub Row_4
  gosub Row_4u
  gosub Row_1
  gosub Row_1u
  gosub Row_2
  gosub Row_2u
return

sub Solve_8
  gosub Row_4
  gosub Row_4d
  gosub Row_1
  gosub Row_1d
  gosub Row_2
  gosub Row_2u
  gosub Row_2u
return

sub Solve_9
  gosub Row_4
  gosub Row_4u
  gosub Row_3
  gosub Row_3d
  gosub Row_1
  gosub Row_1d
  gosub Row_1u
  gosub Row_4
  gosub Row_4u
  gosub Row_4d
  gosub Row_3
  gosub Row_3u
return

sub Solve_10
  gosub Row_4
  gosub Row_4u
  gosub Row_3
  gosub Row_3u
  gosub Row_4
  gosub Row_4d
  gosub Row_2
  gosub Row_2u
  gosub Row_1
  gosub Row_1u
  gosub Row_3
  gosub Row_3d
return

sub Solve_11
  gosub Row_4
  gosub Row_4d
  gosub Row_3
  gosub Row_3u
  gosub Row_2
  gosub Row_2u
  gosub Row_1
  gosub Row_1u
  gosub Row_4
  gosub Row_4u
  gosub Row_1
  gosub Row_1d
return

sub Solve_12
  gosub Row_4
  gosub Row_4u
  gosub Row_2
  gosub Row_2u
  gosub Row_1
  gosub Row_1u
  gosub Row_1d
  gosub Row_2
  gosub Row_2d
return

sub Solve_13
  gosub Row_2
  gosub Row_2u
  gosub Row_2d
  gosub Row_1
  gosub Row_1d
  gosub Row_2
  gosub Row_2d
  gosub Row_2u
  gosub Row_3
  gosub Row_3d
return

sub Solve_14
  gosub Row_3
  gosub Row_3d
  gosub Row_2
  gosub Row_2u
  gosub Row_1
  gosub Row_1u
  gosub Row_2
  gosub Row_2u
  gosub Row_4
  gosub Row_4u
  gosub Row_3
  gosub Row_3u
  gosub Row_1
  gosub Row_1d
return

sub Solve_15
  gosub Row_3
  gosub Row_3u
  gosub Row_2
  gosub Row_2u
  gosub Row_4
  gosub Row_4d
  gosub Row_3
  gosub Row_3d
  gosub Row_2
  gosub Row_2d
  gosub Row_4
  gosub Row_4u
return

sub Solve_16
  gosub Row_3
  gosub Row_3u
  gosub Row_4
  gosub Row_4u
  gosub Row_3
  gosub Row_3u
  gosub Row_4
  gosub Row_4d
  gosub Row_1
  gosub Row_1u
  gosub Row_2
  gosub Row_2d
return

;=====================Row and Direction Subs==========
sub Row_1
  set %clickx #contpos + 115
  set %clicky #contpos + 90
  click %clickx %clicky
  wait 5
return

sub Row_2
  set %clickx #contposx + 115
  set %clicky #contposy + 123
  click %clickx %clicky
  wait 5
return


sub Row_3
  set %clickx #contposx + 115
  set %clicky #contposy + 156
  click %clickx %clicky
  wait 5
return

sub Row_4
  set %clickx #contposx + 115
  set %clicky #contposy + 189
  click %clickx %clicky
  wait 5
return

sub Row_1u
  set %clickx #contposx + 95
  set %clicky #contposy + 90
  click %clickx %clicky
  wait 5
return

sub Row_1d
  set %clickx #contposx + 137
  set %clicky #contposy + 90
  click %clickx %clicky
  wait 5
return

sub Row_2u
  set %clickx #contposx + 95
  set %clicky #contposy + 123
  click %clickx %clicky
  wait 5
return

sub Row_2d
  set %clickx #contposx + 137
  set %clicky #contposy + 123
  click %clickx %clicky
  wait 5
return

sub Row_3u
  set %clickx #contposx + 95
  set %clicky #contposy +156
  click %clickx %clicky
  wait 5
return

sub Row_3d
  set %clickx #contposx + 137
  set %clicky #contposy + 156
  click %clickx %clicky
  wait 5
return

sub Row_4u
  set %clickx #contposx + 95
  set %clicky #contposy + 189
  click %clickx %clicky
  wait 5
return

sub Row_4d
  set %clickx #contposx + 137
  set %clicky #contposy + 189
  click %clickx %clicky
  wait 5
return

;============Apply Sub==============
sub apply
  set %Clickx #contposx + 120
  set %Clicky #contposy + 330
  click %clickx %Clicky
  wait 5
return


No syntax errors and about half as many sub calls.
Still a crap ton of sub calls though............yeah a crap ton.......it's a metric unit.....
Title: Re: Puzzle Boards
Post by: UOMaddog on October 05, 2009, 05:59:06 PM
You could probably use my tutorial to combine all the different subs into 1 sub where you pass it the correct coordinates. It'd be a good practice is sub-passing arguments!
Title: Re: Puzzle Boards
Post by: cgeorgemo on October 05, 2009, 08:15:10 PM
You could probably use my tutorial to combine all the different subs into 1 sub where you pass it the correct coordinates. It'd be a good practice is sub-passing arguments!
I'll take a look.
I'm not sure how you could combine those subs without basically ripping off what Manwinc did. But then again I didn't understand what he'd done till I read it about 30 times.
Title: Re: Puzzle Boards
Post by: UOMaddog on October 05, 2009, 08:26:49 PM
I honestly didnt look at manwinc's so i don't know...I'll take a look!
Title: Re: Puzzle Boards
Post by: Scrripty on October 05, 2009, 08:42:10 PM
You could probably use my tutorial to combine all the different subs into 1 sub where you pass it the correct coordinates. It'd be a good practice is sub-passing arguments!
I'll take a look.
I'm not sure how you could combine those subs without basically ripping off what Manwinc did. But then again I didn't understand what he'd done till I read it about 30 times.

Hey, no scripters have a copyright on a script you write.  So if his way is the ONLY way to do it, its probly ok to do it that way, just try to write it yourself.
Title: Re: Puzzle Boards
Post by: cgeorgemo on October 05, 2009, 09:41:53 PM
If the only way to do it was the way manwinc did I don't think I'd bother trying to skin that cat again.
You really should go look a this script it's elegant.
He creates a loop that saves the first number of 12 different color values from scans that he takes at
221 91
221 126
221 161
221 196
262 92
262  127
262 162
262 197
303 93
303 128
303 163
303 198
After he gets the pixel code he then assigns a cipher that passes the correct movements by breaking apart the cipher 2 values at a time.
Freaking cool!
Title: Re: Puzzle Boards
Post by: Scrripty on October 06, 2009, 07:35:39 AM
If the only way to do it was the way manwinc did I don't think I'd bother trying to skin that cat again.
You really should go look a this script it's elegant.
He creates a loop that saves the first number of 12 different color values from scans that he takes at
After he gets the pixel code he then assigns a cipher that passes the correct movements by breaking apart the cipher 2 values at a time.
Freaking cool!

I believe I read something about it posted by cheffe.  He explained something like that very technique in a tutorial on #pixcol scanning I believe. :)  Basically showing that the best way to come up with a unique value was to add a bunch of the number results for the pixels together to come up with a unique number.  Definately good reading.  I'll see if I can find it.
Title: Re: Puzzle Boards
Post by: _C2_ on October 06, 2009, 08:39:30 AM
after yesterdays maintenance or whatever that caused xfers and housing servers to go down... the boxes were turned back on.  I t was most likely unintentionally but if you are logged in there, you can do them again while waiting for the bigger fix.
Title: Re: Puzzle Boards
Post by: manwinc on October 06, 2009, 11:42:28 AM
Yeah, I need to relook over it. I think I goofed when I first wrote it and forgot to use #contposx and #contposy, Meaning that all of the " Pixel Codes " Will be different, but its easy as hell to update.

All you have to do is figure out which puzzle it is, then you just need to know what %Pixel_Code is and what %Cipher is.

%Pixel_Code is the the first Number Of 12 Scanned Pixels on The puzzle Board. Each Code is Unique to that puzzle.

%Cipher is a string that determines how you solve it using Numbers 1-4 For the Row, and U and D for whether its Up or Down. Ending the String with EN Signifies that you are through solving the puzzle.

So
if %Pixel_Code = XXXXXXXXXXXX
set %Cipher 1U2D3U4D1D4UEN


I figure whenever I get to take a look at the other puzzle boards that it will be a similar System just with a different cipher and a different Pixel scanner.
Title: Re: Puzzle Boards
Post by: UOMaddog on October 06, 2009, 11:46:45 AM
Couple of things...

#1. I found a mistake in your Solve_7 sub You clicked row 2, but then called to click row 3down.

#2. I took the liberty of re-writing your Solve routines using a new "Clicker" sub that takes arguments of (Row, Up/Down). So you can call it like "gosub Clicker %two %down" You'll see in the re-write I attached. Oh, and I fixed #1 ^^^ for you already and checked all the rest against UOGuide.com


Code: [Select]
Here's the code:
;====================================================
; Script Name: Cgeorgemo's Puzzle Board Clicker
; Author: Cgeorgemo
; Version: 1.1
; Client Tested with: not tested yet
; EUO version tested with: 154
; Shard OSI / FS:  OSI
; Revision Date:
; Public Release:
; Purpose: Clicking the Puzzle Boards
;====================================================

;Variable Declaration Section
set %one 90
set %two 123
set %three 156
set %four 189
set %up 22
set %down -20
set %clickdelay 5 ;Make longer if you're laggy!

;Main Section
Finditem C_ , #backpackid
set #lobjectid #findid
event macro 17 0
wait 20
gosub Find_Board
gosub apply
halt

;========Find Which Board=====================
sub Find_Board
  set %x #contposx + xshift ; measure to find
  set %y #contposy + yshift ; measure to find
  savepix %x %y 1
  If #pixcol xxxxxxxxxxxx ; find this color value
  {
    gosub Solve_6
    return
  }
  set %x #contposx + xshift
  set %y #contposy + yshift
  savepix %x %y 1
  If #pixcol xxxxxxxxxxxx
  {
    gosub Solve_8
    return
  }
  set %x #contposx + xshift
  set %y #contposy + yshift
  savepix %x %y 1
  If #pixcol xxxxxxxxxxxx
  {
    gosub Solve_11
    return
  }
  set %x #contposx + xshift
  set %y #contposy + yshift
  savepix %x %y 1
  If #pixcol xxxxxxxxxxxx
  {
    gosub Solve_12
    return
  }
  set %x #contposx + xshift
  set %y #contposy + yshift
  savepix %x %y 1
  If #pixcol xxxxxxxxxxxx
  {
    gosub Solve_10
    return
  }
  set %x #contposx + xshift
  set %y #contposy + yshift
  savepix %x %y 1
  If #pixcol xxxxxxxxxxxx
  {
    gosub Solve_7
    return
  }
  set %x #contposx + xshift
  set %y #contposy + yshift
  savepix %x %y 1
  If #pixcol xxxxxxxxxxxx
  {
    gosub Solve_15
    return
  }
  set %x #contposx + xshift
  set %y #contposy + yshift
  savepix %x %y 1
  If #pixcol xxxxxxxxxxxx
  {
    gosub Solve_3
    return
  }
  set %x #contposx + xshift
  set %y #contposy + yshift
  savepix %x %y 1
  If #pixcol xxxxxxxxxxxx
  {
    gosub Solve_5
    return
  }
  set %x #contposx + xshift
  set %y #contposy + yshift
  savepix %x %y 1
  If #pixcol xxxxxxxxxxxx
  {
    gosub Solve_9
    return
  }
  set %x #contposx + xshift
  set %y #contposy + yshift
  savepix %x %y 1
  If #pixcol xxxxxxxxxxxx
  {
    gosub Solve_13
    return
  }
  set %x #contposx + xshift
  set %y #contposy + yshift
  savepix %x %y 1
  If #pixcol xxxxxxxxxxxx
  {
    gosub Solve_14
    return
  }
  set %x #contposx + xshift
  set %y #contposy + yshift
  savepix %x %y 1
  If #pixcol xxxxxxxxxxxx
  {
    gosub Solve_4
    return
  }
  set %x #contposx + xshift
  set %y #contposy + yshift
  savepix %x %y 1
  If #pixcol xxxxxxxxxxxx
  {
    gosub Solve_1
    return
  }
  set %x #contposx + xshift
  set %y #contposy + yshift
  savepix %x %y 1
  If #pixcol xxxxxxxxxxxx
  {
    gosub Solve_2
    return
  }
  gosub Solve_16
  return

;===========Solution Subs=================
sub Solve_1
  gosub Clicker %one %up
  gosub Clicker %four %up
  gosub Clicker %three %up
  gosub Clicker %two %up
  gosub Clicker %one %up
  gosub Clicker %two %down
return

sub Solve_2
  gosub Clicker %one %up
  gosub Clicker %four %up
  gosub Clicker %four %down
  gosub Clicker %three %down
  gosub Clicker %one %up
  gosub Clicker %three %up
return

sub Solve_3
  gosub Clicker %one %down
  gosub Clicker %two %up
  gosub Clicker %one %down
  gosub Clicker %four %up
return

sub Solve_4
  gosub Clicker %three %up
  gosub Clicker %two %up
  gosub Clicker %one %up
  gosub Clicker %two %down
  gosub Clicker %one %down
  gosub Clicker %one %down
  gosub Clicker %four %down
return

sub Solve_5
  gosub Clicker %one %up
  gosub Clicker %four %up
  gosub Clicker %three %up
  gosub Clicker %two %up
  gosub Clicker %three %down
  gosub Clicker %one %up
  gosub Clicker %two %up
return

sub Solve_6
  gosub Clicker %one %up
  gosub Clicker %three %up
  gosub Clicker %two %up
  gosub Clicker %two %down
  gosub Clicker %one %down
  gosub Clicker %four %up
  gosub Clicker %three %up
  gosub Clicker %four %up
return

sub Solve_7
  gosub Clicker %two %down
  gosub Clicker %one %down
  gosub Clicker %four %up
  gosub Clicker %one %up
  gosub Clicker %two %up
return

sub Solve_8
  gosub Clicker %four %down
  gosub Clicker %one %down
  gosub Clicker %two %up
  gosub Clicker %two %up
return

sub Solve_9
  gosub Clicker %four %up
  gosub Clicker %three %down
  gosub Clicker %one %down
  gosub Clicker %one %up
  gosub Clicker %four %up
  gosub Clicker %four %down
  gosub Clicker %three %up
return

sub Solve_10
  gosub Clicker %four %up
  gosub Clicker %three %up
  gosub Clicker %four %down
  gosub Clicker %two %up
  gosub Clicker %one %up
  gosub Clicker %three %down
return

sub Solve_11
  gosub Clicker %four %down
  gosub Clicker %three %up
  gosub Clicker %two %up
  gosub Clicker %one %up
  gosub Clicker %four %up
  gosub Clicker %one %down
return

sub Solve_12
  gosub Clicker %four %up
  gosub Clicker %two %up
  gosub Clicker %one %up
  gosub Clicker %one %down
  gosub Clicker %two %down
return

sub Solve_13
  gosub Clicker %two %up
  gosub Clicker %two %down
  gosub Clicker %one %down
  gosub Clicker %two %down
  gosub Clicker %two %up
  gosub Clicker %three %down
return

sub Solve_14
  gosub Clicker %three %down
  gosub Clicker %two %up
  gosub Clicker %one %up
  gosub Clicker %two %up
  gosub Clicker %four %up
  gosub Clicker %three %up
  gosub Clicker %one %down
return

sub Solve_15
  gosub Clicker %three %up
  gosub Clicker %two %up
  gosub Clicker %four %down
  gosub Clicker %three %down
  gosub Clicker %two %down
  gosub Clicker %four %up
return

sub Solve_16
  gosub Clicker %three %up
  gosub Clicker %four %up
  gosub Clicker %three %up
  gosub Clicker %four %down
  gosub Clicker %one %up
  gosub Clicker %two %down

;=====================Row and Direction Subs==========

sub Clicker     ;%1=Row   %2=Up/Down     (Both are offsets (declared above) from base values or cont pos)
;Click on proper row (given by %1)
set %clickx #contpos + 115 ;X is always the same
set %clicky #contpos + %1 ;Y changes based on row called (%one, %two, %three, %four)
click %clickx %clicky
wait %clickdelay
;Click up or down (given by %2)
set %clickx #contpos + 115 + %2 ;Adjust left by 20 or right by 22
set %clicky #contpos + %1 ;Y changes based on row called
click %clickx %clicky
wait %clickdelay
return

;============Apply Sub==============
sub apply
  set %Clickx #contposx + 120
  set %Clicky #contposy + 330
  click %clickx %Clicky
  wait %clickdelay
return

If you can, test it to make sure I didn't have any math errors or mind farts!
Title: Re: Puzzle Boards
Post by: cgeorgemo on October 06, 2009, 03:50:55 PM
Couple of things...

#1. I found a mistake in your Solve_7 sub You clicked row 2, but then called to click row 3down.

#2. I took the liberty of re-writing your Solve routines using a new "Clicker" sub that takes arguments of (Row, Up/Down). So you can call it like "gosub Clicker %two %down" You'll see in the re-write I attached. Oh, and I fixed #1 ^^^ for you already and checked all the rest against UOGuide.com

If you can, test it to make sure I didn't have any math errors or mind farts!

The only mind fart I see right off the bat is leaving the AHQ off the Finditem statement. And that's my mind fart not yours.
I'd been working on something like what you did but was running in circles it seems.
Title: Re: Puzzle Boards
Post by: UOMaddog on October 06, 2009, 06:18:29 PM
It's always refreshing to see 1 sub used 8 ways!
Title: Re: Puzzle Boards
Post by: cgeorgemo on October 08, 2009, 03:04:41 PM
Do we need a return at the end of Solve_16?
Title: Re: Puzzle Boards
Post by: UOMaddog on October 08, 2009, 06:30:17 PM
yuppers! I accidentally chopped it out when I was clearing out blank lines! My Bad!
Title: Re: Puzzle Boards
Post by: cgeorgemo on October 08, 2009, 07:16:10 PM
The two variables at the end of the gosub lines
Code: [Select]
gosub clicker %one %up
That passes those two values to the clicker to be used in the sub?
Title: Re: Puzzle Boards
Post by: UOMaddog on October 11, 2009, 07:38:55 PM
Yup! If you look at the top of the script in the variable declaration area, you'll see I added %one, %two, etc and %up, %down. Each of these is the value that you were "offsetting from before...
Here's the before and after: (I'm using 4 - UP as my example)

Before:
Part for Row:
Code: [Select]
sub Row_4
set %clickx #contposx + 115
set %clicky #contposy + [color=yellow]189[/color]
click %clickx %clicky
wait 5
return
Part for Up/Down:
Code: [Select]
sub Row_4u
set %clickx #contposx + 95
set %clicky #contposy + [color=yellow]189[/color]
click %clickx %clicky
wait 5
return


After:
To Call It:
Code: [Select]
;This was at the top...
set [color=yellow]%four 189[/color]
set %up 22

;This is the actual call...
gosub Clicker %four %up

Actual Sub:
Code: [Select]
sub Clicker
set %clickx #contpos + 115
set %clicky #contpos + [color=yellow]%1[/color]
click %clickx %clicky
wait %clickdelay

set %clickx #contpos + 115 + %2
set %clicky #contpos + [color=yellow]%1[/color]
click %clickx %clicky
wait %clickdelay
return

Ok, now if you look at the example side by side...Anywhere that I highlighted in yellow is the same thing (189) for row 4. If it was row 3 you wanted, you would just change it to %three, which is 156.

Now the up/down was a little more complicated. You'll notice that I made it always #contpos + 115 + %2...this is because 115 is the center button (where you would click for the row), but up and down are on either side of it! So...%2 is the offset from 115. For up, you move to the right 22 (115 + 22), for down you move to the left 20 (or in this case: 115  +  -20).


Hopefully that clears i up a little...I know it's confusing...feel free to keep posting questions or PM or even ICQ me!
Title: Re: Puzzle Boards
Post by: cgeorgemo on October 12, 2009, 09:36:13 PM
Ok update.
I don't want you to think I stopped working on this.
I've got 3 puzzles left to map because I can't seem to get those puzzles to drop for me and I need to scan in the solution which you aren't able to manipulate.
Once I get those 3 to drop I'll post up the final version and let everybody give it a run.
Title: Re: Puzzle Boards
Post by: manwinc on October 12, 2009, 10:16:17 PM
Is it back up and Running?
Title: Re: Puzzle Boards
Post by: cgeorgemo on October 13, 2009, 04:41:37 AM
Is it back up and Running?
The Puzzles are available if that's what you're asking.
Title: Re: Puzzle Boards
Post by: Khameleon on October 13, 2009, 06:35:37 PM
they fixed it now Freezing is randomizing.. Caught me off guard I was like where do I go for Blue?