SRL Archive - OSR Help

ID's? Explain Please.


Death12652

2010-12-11 02:31:20

I am seeing all these things about ID's and I see them in the includes folder but I can't seem to find a tutorial or thread that explains them or how to use them. Someone want to dirrect me or explain to me how to use them. They seem to be useful rather than colors.

TomTuff

2010-12-11 02:50:01

In reflection, IDs are assigned to different things. For example, a monkfish will have a certain ID, where as a death rune will have a different ID. The same is true for objects and NPCs (objects being things like doors, ladders, the rock you mine pure/rune essence from, et cetera). IDs are specific to one type, but generic to all items of that type; that means that every monkfish has the same ID, but no other item will have the same ID as a monkfish. Again, the same holds true for objects and NPCs. Using item, NPC, and object IDs, reflection can be used to accurately click things with much ease. I recommend using reflection as a backup; here's an example of good usage of reflection:


function ClickSomeItem: Boolean;
var
ItemBitmap, x, y, i: Integer;
begin
Itembitmap := BitmapFromString(10, 15, 'adsfasdf');
if FindBitmapToleranceIn(ItemBitmap, x, y, MIX1, MIY1, MIX2, MIY2, 5) then
begin
MMouse(x, y, 9, 14);
if WaitUptext('Item''s uptext', 800) then
begin
ClickMouse2(false);
Result := WaitOption('option text here', 800);
end else
begin
Result := False;
FreeBitmap(ItemBitmap);
end;
end else
begin
Writeln('couldnt find bitmap, attempting reflection');
Result := R_ClickItemID(12345, False, 'option text here');
end;
FreeBitmap(ItemBitmap);
end;

Death12652

2010-12-11 11:57:47

So if you have a rock you want to mine for example. Would each different type of rock like mithril, iron, or coal have a different ID. Using the R_ClickItemID it is able to search for that item then left click or right click and choose and option. If each different ore I.E iron or mithril how do you find out what the ID's are that you should use?

Another question not really related to this but is there a way to search for an item (Which I can do easily) and then count that item. This item is a stacking item.

traveler

2010-12-11 12:00:54

best way to find ids are to use the grand exchange website. for example, irons ore page is http://services.runescape.com/m=itemdb_rs/Iron_ore/viewitem.ws?obj=440. see the 440 at the end, that is the id number for iron ore.

Death12652

2010-12-11 12:04:27

I don't see this 440 your talking about?

Oh nevermind I see it now. Its in the address bar.

Cstrike

2010-12-11 12:06:25

If you havent seen: http://villavu.com/forum/showthread.php?p=756983
Great place to start


There's a difference between NPC ID's, invi ID's and object ID's

For Inventory:
This is where R_ClickItemID's come in, it's specific for inventory

For NPC's
Use
NPCs := SortNPCs(FindNPCs); // declare NPCs: TNPCArray;

For objects:
Objects are things that are not NPC's, nor items. They are things in runescape that do not have a yellow dot on the minimap. A rock is one of them.
Search my tutorial for objects :)

You can't use R_ClickItemIDs for NPCs or Objects because they appear on the mainscreen, you need to get the NPC, get it's tile, and then use TP := TileToMS (Tile, height); to get it's point on the mainscreen (Tpoints ftw)

GL!

Death12652

2010-12-11 12:11:46

Thanks that helps a lot, now I can start my next script, maybe I'll add an all reflection one and a not all reflection in my script wen I release version 1. I like reflection but it seems to make scripting so easy. Can you answer my other question. The counting items at the top?

Cstrike

2010-12-11 12:28:01

R_CountItemID (one of the count items) would count them, I don't think I've ever had to use it when I had stacked items, so that'd be interesting to try out.

Feel free to either use color or reflection. Reflection makes it much easier, but it also makes your scripts run for a very long time. In addition, without reflection, randoms will make your life quite hell and cause early termination.
Reflection can also be just as hard as color ;) I made a fletcher that only fletches one thing next to a bank, opens it, deposits and withdraws more logs to cut. It ended up being 800 lines with failsafes and all. Quite a big challenge still if you ask me ;)

Death12652

2010-12-11 12:35:34

Yes I agree with you that it does take a long time but I like to learn all the aspects of scripting not just reflection. Although reflection does make my life easier I like to user DTM's and Bitmaps when making my script. I don't want everyone to think that I can only use reflection to script. And I will try the count items but I would think that only counts the amount according to you inventory slots not the stacked amount?

Hey I read your tutoiral (again) and I am going to use the TileToMS as a failsafe but you know how you have this…


var TP : TPoint;
begin
TP := TileToMS (Tile(3433,4433), 0); // Assuming we're near that tile…
MMouse (TP.x, TP.y, 3, 3);
if GetUpText ('ree') then ChopTree; // This isn't really part of the demonstration, but an example of where you go from hereend;


I don't quite get why but when I have GetUpText('urnace') I get an invalid number of parameters?

You know why?

Feroc1ty

2010-12-11 13:51:40

I can't get NPC finding to work (for archery ticket vendor,) his ID is 694, but when I convert his tile to MS it's always off, or is there another way of going about finding an NPC without using his tile?

Shuttleu

2010-12-11 14:06:30

from my fishing script

  if FindNPC({ID here}, TheSpot) then
begin
if (not(TileonMS(TheSpot.Tile, 10))) then
begin
SpotPos:= TileToMM(TheSpot.Tile);
Mouse(SpotPos.x, SpotPos.y, 5, 5, True);
Wait(500+Random(500));
R_Flag;
Wait(500+Random(500));
end;
SpotPos:= TileToMS(TheSpot.Tile, 10);
Mouse(SpotPos.x, SpotPos.y, 5, 5, False);
R_ChooseOption('Lure Fishing spot');
Wait(500+Random(500));
R_Flag;
Wait(1000+Random(1000));
end
you should be able to work it out from that ;)
TheSpot is a TNPC
SpotPos is a TPoint

~shut

Feroc1ty

2010-12-11 14:30:42

Weird, I was using similar code but it would move to the wrong spot half the time… maybe it sees the NPC on the new tile before the character physically moves there… sigh.

Shuttleu

2010-12-11 14:32:04

From: Feroc1ty
Weird, I was using similar code but it would move to the wrong spot half the time… maybe it sees the NPC on the new tile before the character physically moves there… sigh.


nope, it will see the NPC on the tile is is on when the function gets called not where it will be after walking

~shut

Cstrike

2010-12-11 15:25:06

From: Feroc1ty
I can't get NPC finding to work (for archery ticket vendor,) his ID is 694, but when I convert his tile to MS it's always off, or is there another way of going about finding an NPC without using his tile?

Is it on a second floor? You may need to play around with GetPlaneIndex and TileToMSEx, and using Height as well. If not, try height = 0


From: death12652
Yes I agree with you that it does take a long time but I like to learn all the aspects of scripting not just reflection. Although reflection does make my life easier I like to user DTM's and Bitmaps when making my script. I don't want everyone to think that I can only use reflection to script.

IMO depends on the end product. If my script can work for a long time and return to me the amount of experience that I want while solving randoms/getting flagged, I will choose that no matter what script type it is. If a color script owns a reflection script, I will 101% use the color script all the time. Depends on if you care about the end product or not.
IMO if you use reflection a tiny bit, you might as well go the full way since if it breaks, you're doomed. If you can do 100% color, then I highly recommend going to color over reflection since color doesn't usually change. Just my views :)

And I will try the count items but I would think that only counts the amount according to you inventory slots not the stacked amount?

One thing you could do is use is grab the child component stack, that'd give you the stack amount. Interface 149, 0, (slot here + 1) I believe.


I don't quite get why but when I have GetUpText('urnace') I get an invalid number of parameters?

You know why?

Use R_IsUpText or R_IsUpTextMulti, I shouldn't have put GetUpText

Death12652

2010-12-11 18:23:14

Okay thanks, so your saying that using a 100% reflection or a 100% color would be better than using color and reflection. In my script it uses color finding, but reflection walking, and for failsafes to the colors as a last resort it uses reflection object finding.

Shuttleu

2010-12-11 18:24:54

personally, i use a combination of color and reflection

take a look at my vine vanquisher, it uses color to find the vines, and a combination to find the nest and reflection for everything else

~shut

EDIT: on the other hand, my fisher is 100% reflection

Death12652

2010-12-11 18:52:12

Yeah I have been using yours and a couple others for examples.

Cstrike

2010-12-11 18:53:36

From: death12652
Okay thanks, so your saying that using a 100% reflection or a 100% color would be better than using color and reflection. In my script it uses color finding, but reflection walking, and for failsafes to the colors as a last resort it uses reflection object finding.


yeah :)

My logic is this:
- If you use any reflection, one should go 100% since reflection breaking nukes the script.
- If you use reflection as a backup, that's always good – but that means that the goal is to keep it running for as long as possible, and thus you'd want to use more efficient methods to achieve this. Going 100% reflection does achieve this.
- If it is 99% color and 1% ref, and if ref breaks and you can still do it in color without reflection, then there's no need to put reflection in if it's that stable, better just to whore out color failsafes to compensate for reflection.

As long as one part is dependent, the whole program would fall if reflection falls.

Death12652

2010-12-18 23:05:23

So I tried R_CountItemID(2); not sure if I did it right but I went to runescape.com and got the ID from the address bar. And I don't know if thats the ID of and object or of your inventory. Cause I need the count the amount of the item in your inventory. If I did do it right then it doesn't count stacked items becuase it outputed 1.

Nevermind I think this will work.

GetItemStackSizeAt();

Edit: I kinda have an understanding of this but I have one last question. I am looking at Travelers miner and I want to know where he is getting his ID's at? He has a lot of them for each type of ore and I was wandering where he got them?