Saltyspoons
06-06-2012, 08:45 AM
EDIT: Wrong section, sorry! Move if you must
Ok, so I am beginning to work on a script for the game some are familiar with (Puzzle Pirates) and I am having trouble thinking of what to write for a part in my script.
First off
Here is a "good board":
http://img822.imageshack.us/img822/456/examplekf.png
I have defined a "good board" as a board with the red region to be empty of the crates that are randomly generated on the board. (Showed in blue)
What I want to do is find out how I can make my bot do my procedure until there is a good board displayed.
procedure CheckBoard;
var x, y: integer;
begin
PlainCrate := DTMFromString('mQwAAAHicY2ZgYBBlZGDQA2J1IH4KxP+B+B MQL2pKYghys2RY2BDLgAwYkTAQAAAitwci');
RockCrate := DTMFromString('mLgAAAHicY2JgYNgNxVxMDAwSQKwiL8qwZF oHAwwwQjEDAwBtVwO7');
RedCrate := DTMFromString('mLgAAAHicY2JgYHgNxPeAmJuRgUGaEcKezQ hkQAEjFDMwAABxAQNx');
if FindDTM(PlainCrate, x, y, 19, 441, 443, 487) = true then
begin
Abandon; // a previously defined procedure that exits the board
FindCannon; // procedure that opens new puzzle board
end;
if FindDTM(RedCrate, x, y, 19, 441, 443, 487) = true then
begin
Abandon;
FindCannon;
end;
if FindDTM(RockCrate, x, y, 19, 441, 443, 487) = true then
begin
Abandon;
FindCannon;
end;
FreeDTM(PlainCrate);
FreeDTM(RockCrate);
FreeDTM(RedCrate);
end;
The DTM's in my script are the 3 randomly generated crates, one being the crate full of rocks, one being the box with berries, etc.
So, my bot will open a board, and check the board if it has any crates in the red region. If there are any crates in the region, it will abandon the puzzle board and re open it. It stops after the second try. Sometimes it takes about 4-5 tries to get a good board, so i need to find out how to make my procedure continue abandoning multiple times until it has a good board.
If you understood this load of crap i just wrote, any help is appreciated. thanks
Ok, so I am beginning to work on a script for the game some are familiar with (Puzzle Pirates) and I am having trouble thinking of what to write for a part in my script.
First off
Here is a "good board":
http://img822.imageshack.us/img822/456/examplekf.png
I have defined a "good board" as a board with the red region to be empty of the crates that are randomly generated on the board. (Showed in blue)
What I want to do is find out how I can make my bot do my procedure until there is a good board displayed.
procedure CheckBoard;
var x, y: integer;
begin
PlainCrate := DTMFromString('mQwAAAHicY2ZgYBBlZGDQA2J1IH4KxP+B+B MQL2pKYghys2RY2BDLgAwYkTAQAAAitwci');
RockCrate := DTMFromString('mLgAAAHicY2JgYNgNxVxMDAwSQKwiL8qwZF oHAwwwQjEDAwBtVwO7');
RedCrate := DTMFromString('mLgAAAHicY2JgYHgNxPeAmJuRgUGaEcKezQ hkQAEjFDMwAABxAQNx');
if FindDTM(PlainCrate, x, y, 19, 441, 443, 487) = true then
begin
Abandon; // a previously defined procedure that exits the board
FindCannon; // procedure that opens new puzzle board
end;
if FindDTM(RedCrate, x, y, 19, 441, 443, 487) = true then
begin
Abandon;
FindCannon;
end;
if FindDTM(RockCrate, x, y, 19, 441, 443, 487) = true then
begin
Abandon;
FindCannon;
end;
FreeDTM(PlainCrate);
FreeDTM(RockCrate);
FreeDTM(RedCrate);
end;
The DTM's in my script are the 3 randomly generated crates, one being the crate full of rocks, one being the box with berries, etc.
So, my bot will open a board, and check the board if it has any crates in the red region. If there are any crates in the region, it will abandon the puzzle board and re open it. It stops after the second try. Sometimes it takes about 4-5 tries to get a good board, so i need to find out how to make my procedure continue abandoning multiple times until it has a good board.
If you understood this load of crap i just wrote, any help is appreciated. thanks