PDA

View Full Version : [OGL] claimKey



Lucidity
07-14-2015, 02:43 AM
This is for those little key tokens that spawn in your inventory, they also prevent you from banking with presets if it's in your inventory as it cannot be banked.


function claimKey(): boolean;
var textures:glTextureArray; waitTime: tCountdown;
begin
if (length(textures:=ogl.getTextures(125205))>=1) and waitTime.isFinished() and (result:=true) then
if bank.hasBank() then
sendKeys(#27, 30+normalRandom(0,60), 30+normalRandom(0,60))
else
inventory.clickItem(125205);
waitTime.setTime(2500);
end;

Ian
07-14-2015, 03:41 AM
Can't you check a box to auto-claim the keys?

Citrus
07-14-2015, 04:19 AM
Yeah, you only have to claim the first one afaik.

Lucidity
07-14-2015, 04:25 AM
Didn't know that, there wasn't an option for me

Clarity
07-14-2015, 04:28 AM
Didn't know that, there wasn't an option for me
From the Treasure Hunter interface:

http://i.gyazo.com/0f6497f758a99c16b9d47a6d55f9ce86.png

Turpinator
07-14-2015, 04:42 AM
function claimKey(): boolean;
begin
if length(ogl.getTextures(125205)) > 0 then
if bank.hasBank() then
begin
multiType(VK_ESCAPE, randomRange(30, 50), 2);
result := true;
end
else
result := inventory.clickItem(125205);
end;
i mean... i dont know exactly how oglib works, but... i feel like this actually accomplishes what is you actually want.

but on the topic of auto-redemption, if you have 10+ redeemed keys, i dont think it will let you redeem more. sooo. i mean, its not like this is completely useless. maybe a bit more error checking should be used.

The Mayor
07-14-2015, 05:35 AM
function claimKey(): boolean;
begin
if length(ogl.getTextures(125205)) > 0 then
if bank.hasBank() then
begin
multiType(VK_ESCAPE, randomRange(30, 50), 2);
result := true;
end
else
result := inventory.clickItem(125205);
end;
i mean... i dont know exactly how oglib works, but... i feel like this actually accomplishes what is you actually want.

but on the topic of auto-redemption, if you have 10+ redeemed keys, i dont think it will let you redeem more. sooo. i mean, its not like this is completely useless. maybe a bit more error checking should be used.

Ideally you would check for tickets before you even opened the bank, because you know you will have to close the bank and open it again. It's better to just open it once

function claimKey(): boolean;
begin
if length(ogl.getTextures(125205)) > 0 then
result := inventory.clickItem(125205);
end;

Turpinator
07-14-2015, 02:06 PM
Ideally you would check for tickets before you even opened the bank, because you know you will have to close the bank and open it again. It's better to just open it once

function claimKey(): boolean;
begin
if length(ogl.getTextures(125205)) > 0 then
result := inventory.clickItem(125205);
end;

i was actually rather confused as to what the bank thing had to do with the key, so i just left it in there.

The Mayor
07-14-2015, 03:10 PM
i was actually rather confused as to what the bank thing had to do with the key, so i just left it in there.

This was one of the few snippets of OGL code I actually understood :p

Lucidity
07-14-2015, 03:57 PM
The bank was in there because sometimes I'd get one as I went to click the bank after doing an activity, you can't use a preset if it's in your inventory. So I'd have it close out the bank.