SRL Archive - Jr. Member General Help and Discussion

Creating a loot function


Ross

2014-08-29 15:54:54

I'm writing a Rorarius script at the moment, and it's running pretty smoothly. I'm able to babysit the script for hours and only pause it to pick up loot every 5-10 minutes, making 4m+ an hour.
I'm having a lot of trouble coming up with a way to loot, so I'd like to request help from people that are much smarter/more creative than me.

Here's what I'm working with currently:




Variables
  • Script is only going to loot items that appear with Golden Beam
  • Script is only looting Keystones and Sirenic Scales



Problems
  • Monsters drop many, many other items, leading to piles of items on the ground
  • Keystone doesn’t always appear on top of loot
  • Can’t check for loot after each kill, because they fight in groups
  • Loot Beam only appears for a few seconds
  • Monster can walk on top of loot beam and obscure it


I think the best course of action would be to check for “A golden beam of light appears” in chatbox, if true then start loot function.



Possible loot function solutions
  • look for loot beam, right click, get loot
  • If beam isn't found, Right click all monsters until key is found
  • If it's not under monsters, Right click all loot on the ground until key is found (Beam will have probably disappeared by this point and this could be very bot like)



Thanks in advance guys!

Camel

2014-08-29 16:03:50

You could get the color of the floor. Then any color that isn't the floor could be loot, except for those river things (i'm going off what I see in the video https://www.youtube.com/watch?v=FC6aL771hs4) but you could probably filter those out as well and get something working.

If you do it with melee, looting will probably be easier by alot. If you're right up next to the thing you can just make a Tbox in the general direction of it and search in there for loot (possibly using the floor color filtering method).

They also always drop ascension shards, you could look for that right after you get a kill (you'll probably have to filter out the monsters) and right click that. Then you will see all the drops. This depends on if the acension shard is always visible regardless of loot. This is the method I did for cockroaches by searching for the color of the carapace.

But yeah, those are some ideas

Ross

2014-08-29 16:11:03

From: buttdestroyr
You could get the color of the floor. Then any color that isn't the floor could be loot, except for those river things (i'm going off what I see in the video https://www.youtube.com/watch?v=FC6aL771hs4) but you could probably filter those out as well and get something working.

If you do it with melee, looting will probably be easier by alot. If you're right up next to the thing you can just make a Tbox in the general direction of it and search in there for loot (possibly using the floor color filtering method).

They also always drop ascension shards, you could look for that right after you get a kill (you'll probably have to filter out the monsters) and right click that. Then you will see all the drops. This depends on if the acension shard is always visible regardless of loot. This is the method I did for cockroaches by searching for the color of the carapace.

But yeah, those are some ideas




Thank you for the ideas.

The room I'm in has a more blue colored floor (less populated area so less likely for a crash from someone else), and even then there can be up to 20 piles of loot at any given time.

Melee slow down kills by a whole heck of a lot, but the idea is solid, i'll look into it (maybe with drygores?)

The problem with looking for something right after a kill is that they fight in groups so "a kill" is hard to find, since I'm constantly in combat basically.

The Mayor

2014-08-29 17:02:38

@Clarity I vaguely remember you made something like this?

Clarity

2014-08-29 17:13:57

From: The Mayor
@Clarity I vaguely remember you made something like this?

Yeah, my rorarii script is all OGL though, so the looting part was very easy to make!

@therossity, you might want to consider scripting in OGL instead when color item detecting ends up being too difficult. Especially when the items pile over each other, color becomes a total mess to work with. Combining the two methods, I've found, makes for the best scripts :)

If you don't know what I mean by OGL, I mean doing something like this (credit to my buddy @Obscurity who wrote this):

procedure mainLoop;
var
modelArray:glModelArray;
modelArrayIndex:cardinal;
textureArray:glTextureArray;
textureArrayIndex:cardinal;
begin
//Removed IDs because I'd rather you learn what to do than just C&P this
//rorariiDebug('Retrieving models...');
modelArray:=glGetModels(__glModelArray);
//rorariiDebug('Retrieving texture...');
textureArray:=glGetTextures(__glTextureArray);
//rorariiDebug('Building model variables...');
for modelArrayIndex:=0 to length(modelArray)-1 do
begin
case modelArray[modelArrayIndex].ID of
IDHere: //~ Ascension Keystone
begin
hasDrop:=true;
positionDrop:=point(modelArray[modelArrayIndex].x,modelArray[modelArrayIndex].y);
end;
IDHere: //~ Light Beam
begin
hasDrop:=true;
positionDrop:=point(modelArray[modelArrayIndex].x,modelArray[modelArrayIndex].y);
end;
IDHere:isFighting:=true; //~ Retaliating Target Marker
IDHere:hasRorarii:=true;//~ Rorarius
IDHere: //~ Sirenic Scale
begin
hasDrop:=true;
writeLN();
positionDrop:=point(modelArray[modelArrayIndex].x,modelArray[modelArrayIndex].y);
end;
IDHere:isFighting:=true;//~ Target Marker
end;
end;
^Using that ensures total accuracy and detection, which you should also be careful of, because humans are not perfect when looking at the screen!
Obscurity and I have a fully functioning rorarii script already (made 3bil+ from it so far!) so if you have any questions about making your own let me know.

Ross

2014-08-29 17:17:54

From: Clarity
Yeah, my rorarii script is all OGL though, so the looting part was very easy to make!

@therossity, you might want to consider scripting in OGL instead when color item detecting ends up being too difficult. Especially when the items pile over each other, color becomes a total mess to work with. Combining the two methods, I've found, makes for the best scripts :)

I have a fully functioning rorarii script already (made 2bil+ from it so far!) so if you have any questions about making your own let me know.


You have no idea what you've done by offering your help, ask @The Mayor :D. So thanks! I have never scripted before coming here about a month ago, so I wouldn't know where to start with OGL. Do you have any resources/tutorials I could look at to start myself out?

Edit: Just saw your edit, I'm going to steal that and play with it for a bit. I'll ask when I get stuck! Do I need to define anything at the start of the script?

Edit2: Looked at it more closely and my head hurts. I might need a little bit of dissection if possible!

Clarity

2014-08-29 17:29:26

We probably should PM about this sometime, using the code I provided requires using a whole new set of includes (GLX, not SRL-6), a different SMART layout, and a lot of other changes. You won't be able to just put it into the script you're currently writing.

I'm busy at the moment and also have some other people to tutor first, but send me a forum PM and I'd be happy to help.

Don't worry, it's very fun for me to teach things! :)

Ross

2014-08-29 17:33:23

From: Clarity
We probably should PM about this sometime, using the code I provided requires using a whole new set of includes (GLX, not SRL-6), a different SMART layout, and a lot of other changes. You won't be able to just put it into the script you're currently writing.

I'm busy at the moment and also have some other people to tutor first, but send me a forum PM and I'd be happy to help.

Don't worry, it's very fun for me to teach things! :)


PM sent, thanks a bunch!

The Mayor

2014-08-30 06:41:35

From: therossity
PM sent, thanks a bunch!


There may or may not be a whole bunch of OGL tutorials and stuff in mems+ :)

Ross

2014-08-30 10:09:39

From: The Mayor
There may or may not be a whole bunch of OGL tutorials and stuff in mems+ :)


Looks like I need to get to Mems! I was going to use my color based Rorarii script to apply :p

destinyxx

2015-05-09 15:37:08

From: The Mayor
There may or may not be a whole bunch of OGL tutorials and stuff in mems+ :)


Digging up an old topic:P
Mayor, is it possible to implement OGL functions in a non-OGL script, also are any links to good OGL guides in junior or public?
Thanks in advance

destinyxx

2015-05-09 15:41:47

Found Clarity's OGl guide, reading it up now

The Mayor

2015-05-10 02:23:07

From: destinyxx
Digging up an old topic:P
Mayor, is it possible to implement OGL functions in a non-OGL script, also are any links to good OGL guides in junior or public?
Thanks in advance


Yes it is possible. I'd personally like to see some basic OGL methods packaged with srl-6 so you could do things like this by just defining OGL:


program new;
{$DEFINE SMART}
{$DEFINE OGL}
{$i srl-6/srl.simba}

procedure example();
var
i: Integer;
TPA: TPointArray;
begin
TPA := ogl.getModels(2718818122, mainScreen.getBounds()).toTPA();

TPA.sortFromPoint(mainScreen.playerPoint);

for i := 0 to high(TPA) do
begin
mouse(TPA[i].rand(5), MOUSE_MOVE);
if isMouseOverText(['Mine']) then
begin
fastClick(MOUSE_LEFT);
break;
end
end;

// or
mouse(ogl.getModels(2718818122, mainScreen.getBounds()).closest(mainScreen.playerPoint).rand(5), MOUSE_LEFT);

end;

begin
clearDebug();
setupSRL();
ogl.setViewPort(mainScreen.getBounds());

ogl.debugTextures(tabBackpack.getBounds());
example();
end.

This is about a 15 minute job to add, but I doubt others will share my views ;)

Thomas

2015-05-10 02:30:47

@The Mayor
Nope, I share that view! For now atleast because some of the ogl includes are just so premature I think.
Being able to use both would help allot, mainly in combat scripts I think. Looting and clicking monsters in Ogl, breaking, World hopping, login, antiban etc in srl.