Author Topic: Puzzle Boards  (Read 19224 times)

0 Members and 1 Guest are viewing this topic.

Offline manwinc

  • Elite
  • *
  • *
  • Posts: 2556
  • Activity:
    0%
  • Reputation Power: 32
  • manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!
  • Gender: Male
  • "The Devs Hard at Work"
  • Respect: +123
  • Referrals: 1
    • View Profile
Re: Puzzle Boards
« Reply #30 on: October 03, 2009, 11:41:46 AM »
0
I posted mine, Hope it helps :)
Monkeys and Typewriters!

" Oh I know, We'll make a Boss Encounter that requires 3 keys per player to enter, Then we'll make it not a closed instance so you never know if you are going to pop into a fresh room or a boss that has 1% Health left with 20 dudes smashing its face in, wasting your time and effort"

Offline cgeorgemoTopic starter

  • Hero Member
  • *
  • Posts: 586
  • Activity:
    0%
  • Reputation Power: 5
  • cgeorgemo has no influence.
  • Gender: Male
  • I'm Brian...cgeorgemo is Curious George Missouri
  • Respect: +19
  • Referrals: 1
    • View Profile
Re: Puzzle Boards
« Reply #31 on: October 03, 2009, 03:12:22 PM »
0
Well I will have to wait until the wall comes down before I can get a board to measure some distances.
Sarcasm is your body's natural defense against stupidity.

Offline cgeorgemoTopic starter

  • Hero Member
  • *
  • Posts: 586
  • Activity:
    0%
  • Reputation Power: 5
  • cgeorgemo has no influence.
  • Gender: Male
  • I'm Brian...cgeorgemo is Curious George Missouri
  • Respect: +19
  • Referrals: 1
    • View Profile
Re: Puzzle Boards
« Reply #32 on: October 03, 2009, 05:43:37 PM »
0
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

Sarcasm is your body's natural defense against stupidity.

Offline cgeorgemoTopic starter

  • Hero Member
  • *
  • Posts: 586
  • Activity:
    0%
  • Reputation Power: 5
  • cgeorgemo has no influence.
  • Gender: Male
  • I'm Brian...cgeorgemo is Curious George Missouri
  • Respect: +19
  • Referrals: 1
    • View Profile
Re: Puzzle Boards
« Reply #33 on: October 03, 2009, 06:55:23 PM »
0
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

Sarcasm is your body's natural defense against stupidity.

Offline manwinc

  • Elite
  • *
  • *
  • Posts: 2556
  • Activity:
    0%
  • Reputation Power: 32
  • manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!
  • Gender: Male
  • "The Devs Hard at Work"
  • Respect: +123
  • Referrals: 1
    • View Profile
Re: Puzzle Boards
« Reply #34 on: October 03, 2009, 07:32:29 PM »
0
Finditem AHQ C_ , #backpackid
set #Lobjectid #findid



Have to use the "ID" For last object.
Monkeys and Typewriters!

" Oh I know, We'll make a Boss Encounter that requires 3 keys per player to enter, Then we'll make it not a closed instance so you never know if you are going to pop into a fresh room or a boss that has 1% Health left with 20 dudes smashing its face in, wasting your time and effort"

Scrripty

  • Guest
Re: Puzzle Boards
« Reply #35 on: October 03, 2009, 07:33:20 PM »
0
Damnit manwinc I was posting that at the SAME time. :)

Code: [Select]
finditem %tokentype C_ , #backpackid
SET #ltargetid #findid

Offline cgeorgemoTopic starter

  • Hero Member
  • *
  • Posts: 586
  • Activity:
    0%
  • Reputation Power: 5
  • cgeorgemo has no influence.
  • Gender: Male
  • I'm Brian...cgeorgemo is Curious George Missouri
  • Respect: +19
  • Referrals: 1
    • View Profile
Re: Puzzle Boards
« Reply #36 on: October 03, 2009, 07:36:32 PM »
0
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.
Sarcasm is your body's natural defense against stupidity.

Offline manwinc

  • Elite
  • *
  • *
  • Posts: 2556
  • Activity:
    0%
  • Reputation Power: 32
  • manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!
  • Gender: Male
  • "The Devs Hard at Work"
  • Respect: +123
  • Referrals: 1
    • View Profile
Re: Puzzle Boards
« Reply #37 on: October 03, 2009, 08:56:08 PM »
0
uh... still need


 Event macro 17 0 <- Last Object
Monkeys and Typewriters!

" Oh I know, We'll make a Boss Encounter that requires 3 keys per player to enter, Then we'll make it not a closed instance so you never know if you are going to pop into a fresh room or a boss that has 1% Health left with 20 dudes smashing its face in, wasting your time and effort"

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: Puzzle Boards
« Reply #38 on: October 03, 2009, 09:05:02 PM »
0
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!
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: Puzzle Boards
« Reply #39 on: October 03, 2009, 10:40:09 PM »
0
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!
« Last Edit: October 03, 2009, 10:42:16 PM by UOMaddog »
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 manwinc

  • Elite
  • *
  • *
  • Posts: 2556
  • Activity:
    0%
  • Reputation Power: 32
  • manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!
  • Gender: Male
  • "The Devs Hard at Work"
  • Respect: +123
  • Referrals: 1
    • View Profile
Re: Puzzle Boards
« Reply #40 on: October 04, 2009, 05:50:22 AM »
0
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.
Monkeys and Typewriters!

" Oh I know, We'll make a Boss Encounter that requires 3 keys per player to enter, Then we'll make it not a closed instance so you never know if you are going to pop into a fresh room or a boss that has 1% Health left with 20 dudes smashing its face in, wasting your time and effort"

Offline cgeorgemoTopic starter

  • Hero Member
  • *
  • Posts: 586
  • Activity:
    0%
  • Reputation Power: 5
  • cgeorgemo has no influence.
  • Gender: Male
  • I'm Brian...cgeorgemo is Curious George Missouri
  • Respect: +19
  • Referrals: 1
    • View Profile
Re: Puzzle Boards
« Reply #41 on: October 04, 2009, 07:12:58 AM »
0
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.
Sarcasm is your body's natural defense against stupidity.

Offline cgeorgemoTopic starter

  • Hero Member
  • *
  • Posts: 586
  • Activity:
    0%
  • Reputation Power: 5
  • cgeorgemo has no influence.
  • Gender: Male
  • I'm Brian...cgeorgemo is Curious George Missouri
  • Respect: +19
  • Referrals: 1
    • View Profile
Re: Puzzle Boards
« Reply #42 on: October 04, 2009, 07:39:04 AM »
0
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.
Sarcasm is your body's natural defense against stupidity.

Offline cgeorgemoTopic starter

  • Hero Member
  • *
  • Posts: 586
  • Activity:
    0%
  • Reputation Power: 5
  • cgeorgemo has no influence.
  • Gender: Male
  • I'm Brian...cgeorgemo is Curious George Missouri
  • Respect: +19
  • Referrals: 1
    • View Profile
Re: Puzzle Boards
« Reply #43 on: October 04, 2009, 07:46:36 AM »
0
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.
Sarcasm is your body's natural defense against stupidity.

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: Puzzle Boards
« Reply #44 on: October 04, 2009, 04:26:31 PM »
0
They may have changed the way those particular gumps work.
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: