SRL Archive - Research & Development Lounge

Item ID Grabber.


Sandstorm

2009-02-21 20:30:53

Simple script, my first large form. Forms aren't all that hard (one page forms anyways).

Easy to use. Just type in the name, click Get Id, and wait a second or two. It will then pop up the id in the second box. It takes about four to sive milliseconds seconds per ID for me (on average, after the update.).

*Note - The name must be the exact name, or it will return a false positive most of the time.

program New;
{.include srl/srl.scar}

var
EndItemForm : Boolean;
frmdesign : TForm;
Button1, Button2, Button3 : TButton;
Edit1 : TEdit;
Input, Output : TGroupBox;
Memo1, Memo2, Memo3, Memo4 : TMemo;
Items, Npcs : TObject;
Page : Integer;
itemsini, npcsini : String;

procedure ItemFormOnClose(Sender : TObject; var Action : TCloseAction);
begin
if (not(frmdesign.ModalResult = 1)) then
EndItemForm := True;
end;

Function Contain(Stringz, Strings : String) : Boolean;
Begin
Result := Pos(Stringz, Strings) <> 0;
End;

Function GetId(QueryIs : String) : String;
Var
H, Quereh : String;
C, T : Integer;
Begin
MarkTime(T);
Quereh := Lowercase(QueryIs);
H := Lowercase(itemsini);
If lowercase(Quereh) = 'cannonball' Then
Begin
Result := '2';
WriteLn('Took: ' + IntToStr(TimeFromMark(T)) + ' milliseconds');
Exit;
End;
If Not Contain(Quereh, H) Then
Begin
Result := 'Unknown Item Id';
WriteLn('Took: ' + IntToStr(TimeFromMark(T)) + ' milliseconds');
Exit;
End;
C := Pos(Quereh, H);
While not (StrGet(H, C) = Chr(10)) Do
Begin
Dec(C);
End;
Result := GetNumbers(Copy(H, C, Length(Quereh)));
WriteLn('Took: ' + IntToStr(TimeFromMark(T)) + ' milliseconds');
End;

Function GetNpcId(QueryIs : String) : String;
Var
S, Quereh : String;
C : Integer;
Begin
S := Lowercase(npcsini)
Quereh := Lowercase(QueryIs);
C := Pos(Lowercase(Quereh), S);
If Not Contain(Quereh, S) Then
Begin
Result := 'Unknown Npc Id';
Exit;
End;
While Not Contain('npc', Quereh) Do
Begin
Dec(C);
Quereh := StrGet(S, C - 1) + Quereh;
End;
Result := GetNumbers(Quereh);
End;

procedure StartButton(sender: Tobject);
begin
Case (Memo1.Visible and Memo2.Visible) Of
True: Begin
With Memo1.Lines Do
Add(Edit1.text);
With Memo2.Lines Do
Add(GetId(Edit1.text));
End;
False : Begin
With Memo3.Lines Do
Add(Edit1.text);
With Memo4.Lines Do
Add(GetNpcId(Edit1.text));
End;
End;
end;

procedure Changing(Sender: TObject);
begin
If Page = 1 Then
Begin
Memo2.Visible := False;
Memo1.Visible := False;
Memo3.Visible := True;
Memo4.Visible := True;
Edit1.Text := 'Npc Name';
End else
Begin
Memo3.Visible := False;
Memo4.Visible := False;
Memo2.Visible := True;
Memo1.Visible := True;
Edit1.Text := 'Item Name';
End;
end;

Procedure Changing1(Sender: TObject);
Begin
Dec(Page);
If Page <> (0 or 1) Then
Page := 0;
Changing(Items);
End;

Procedure Changing2(Sender: TObject);
Begin
Inc(Page);
If Page <> (0 or 1) Then
Page := 1;
Changing(Npcs);
End;

procedure ItemForm;
var
TimeItemForm : Integer;
begin
TimeItemForm := GetSystemTime;
frmdesign := CreateForm;
with frmdesign do
begin
OnClose := @ItemFormOnClose;
Position := poScreenCenter;
BorderStyle := bsSingle;
BorderIcons := [biMinimize,biSystemMenu];
ClientWidth := 439;
ClientHeight := 359;
Caption := 'frmDesign';
Color := clBtnFace;
Font.Color := clWindowText;
Font.Height := -11;
Font.Name := 'MS Sans Serif';
Font.Style := [];
PixelsPerInch := 96;
end;
Button1 := TButton.Create(frmdesign);
with Button1 do
begin
Parent := frmdesign;
Left := 176;
Top := 48;
Width := 75;
Height := 25;
Caption := 'Get Id!';
TabOrder := 0;
OnClick := @StartButton;
end;
Button2 := TButton.Create(frmdesign);
with Button2 do
begin
Parent := frmdesign;
Left := 90;
Top := 48;
Width := 75;
Height := 25;
Caption := 'Items';
TabOrder := 0;
OnClick := @Changing1;
end;
Button3 := TButton.Create(frmdesign);
with Button3 do
begin
Parent := frmdesign;
Left := 262;
Top := 48;
Width := 75;
Height := 25;
Caption := 'Npcs';
TabOrder := 0;
OnClick := @Changing2;
end;
Edit1 := TEdit.Create(frmdesign);
with Edit1 do
begin
Parent := frmdesign;
Left := 152;
Top := 24;
Width := 121;
Height := 21;
TabOrder := 1;
Text := 'Item Name';
end;
Input := TGroupBox.Create(frmdesign);
with Input do
begin
Parent := frmdesign;
Left := 8;
Top := 80;
Width := 201;
Height := 265;
Caption := 'Input';
TabOrder := 2;
end;
Memo1 := TMemo.Create(Input);
with Memo1 do
begin
Parent := Input;
Memo1.Visible := True;
Left := 8;
Top := 16;
Width := 185;
Height := 241;
ReadOnly := True;
ScrollBars := ssVertical;
TabOrder := 0;
end;
Output := TGroupBox.Create(frmdesign);
with Output do
begin
Parent := frmdesign;
Left := 224;
Top := 80;
Width := 201;
Height := 265;
Caption := 'Output';
TabOrder := 3;
end;
Memo2 := TMemo.Create(frmdesign);
with Memo2 do
begin
Parent := frmdesign;
Memo2.Visible := True;
Left := 232;
Top := 96;
Width := 185;
Height := 241;
ReadOnly := True;
ScrollBars := ssVertical;
TabOrder := 4;
end;
Memo3 := TMemo.Create(frmdesign);
with Memo3 do
begin
Parent := Input;
Memo3.Visible := False;
Left := 8;
Top := 16;
Width := 185;
Height := 241;
ReadOnly := True;
ScrollBars := ssVertical;
TabOrder := 0;
end;
Memo4 := TMemo.Create(frmdesign);
with Memo4 do
begin
Parent := frmdesign;
Memo4.visible := False;
Left := 232;
Top := 96;
Width := 185;
Height := 241;
ReadOnly := True;
ScrollBars := ssVertical;
TabOrder := 4;
end;
WriteLn('ItemForm compiled in ' + IntToStr(GetSystemTime - TimeItemForm) + ' milliseconds!');
end;

procedure SafeItemForm;
var
V : TVariantArray;
begin
SetArrayLength(V, 0);
ThreadSafeCall('ItemForm', V);
end;

procedure ShowItemFormModal;
begin
frmdesign.ShowModal;
end;

procedure SafeShowItemFormModal;
var
V : TVariantArray;
begin
SetArrayLength(V, 0);
ThreadSafeCall('ShowItemFormModal', V);
end;

procedure MainItemForm;
begin
try
SafeItemForm;
SafeShowItemFormModal;
finally
FreeForm(frmdesign);
except
WriteLn('An error seems to have occurred in: ItemForm');
end;
end;

begin
WriteLn('Retrieving Item IDs, please wait.');
Itemsini := GetPage('http://schumaker40.site90.com/Auth.scar');
WriteLn('Retreived Item IDs! Now grabbing NPC IDs, please wait.');
Npcsini := GetPage('http://schumaker40.site90.com/Npcs.scar');
WriteLn('Retrieved Item and NPC IDs, initializing script!');
MainItemForm;
end.

~Sandstorm

NCDS

2009-02-21 20:32:53

Good Idea!

This is gonna be used alot.

Sandstorm

2009-02-21 20:38:31

Thanks!

Just finished uploading all the item ids. Did you know there's only about 3300 items in Runescape? I didn't!

Fixed!

~Sandstorm

P1nky

2009-02-21 21:23:24

All i got to say "your a beast"

star troop69

2009-02-21 22:43:49

You are a machine man. I'm going to start scripting soon and this will definitely help me if i use some reflection scripting. This will save heaps of time when attempting to find some id's (if you are going to implement npc's into this script then pm me and i will give you a hand finding as many of them as i can).

Sandstorm

2009-02-21 23:07:11

I'll implement as much as I can, as long as I can get a full list. So yes, find me a full NPC list and I'll add it :).

~Sandstorm

Sandstorm

2009-02-22 23:48:09

Added NPCs. They won't all work, because ones with multiple ids can't be returned more then once (yet), but anything with a unique name (such as Ramara du Croissant) will work.

~Sandstorm

Nava2

2009-02-23 18:12:48

http://schumaker40.site90.com/Soul%20Wars/

Hmm… Whats this?

ian.

2009-02-23 18:18:25

his site for proggies and stuff..

and it has the monsters ID's and stuff..

EDIT:

1045
920
1295
952
968
1139
1170
1232

:p you should change it to like..

It took 1045 ms to find ID for Yew Log
It took 920 ms to find ID for Yew Log
etc.

it confused me because I did all the same ID and the numbers didn't match :p

Sandstorm

2009-02-23 18:29:48

Nava2 - It WAS what I was using to auth my soul wars script, but we decided it was to insecure (as you have demonstrated), so we scrapped it. For now.

99_, the ids don't show up in the debug box :P.

~Sandstorm

ian.

2009-02-23 18:31:23

I know.. it was just confusing the first time =X

Sandstorm

2009-02-23 18:39:23

Lol, ok.

~Sandstorm

Smarter Child

2009-02-23 19:06:16

Sandstorm, many people will use this, you go girl:)///

DAMN RsBot, we'll use this.

Kind Regards~

Smarter Cock~:p—pwnage hybrid

NiCbaZ

2009-02-25 02:02:43

From: Sandstorm
Nava2 - It WAS what I was using to auth my soul wars script, but we decided it was to insecure (as you have demonstrated), so we scrapped it. For now.

99_, the ids don't show up in the debug box :P.

~Sandstorm



Haha Nava thought you where scamming xD lol.

Floor66

2009-02-25 03:53:51

For item ID's you can better find of a way to do it with the G.E db I guess.

http://itemdb-rs.runescape.com/viewitem.ws?obj=ITEM_ID

If we could reverse it somehow and grab the URL.. then you'd have the id.

Sandstorm

2009-02-25 08:34:17

Floor, my way is slightly faster (it's how I use it on my IRC bot's GE function). It's like 2 seconds faster then searching, and it's almost 100% accurate. I find that searching for "Lobster" on the GE returns "Granite Lobster Pouch", and other things do that to.

~Sandstorm

Nava2

2009-02-25 21:11:38

Check out the GE functions in my bank evaluator.. might be of some use :)

E: Sorry, it seemed… a little off. Thought I'd post it. (The scamming thing)

Sandstorm

2009-02-25 21:38:30

From: Nava2
Check out the GE functions in my bank evaluator.. might be of some use :)

E: Sorry, it seemed… a little off. Thought I'd post it. (The scamming thing)


I'm not looking for prices, thanks though ^.^.

What?

~Sandstorm

Nava2

2009-02-26 10:16:15

I meant for getting the ID xD I know you weren't looking for prices ;)

Sandstorm

2009-02-26 21:32:41

Oh! Makes sense, sorry!

I'll take a look at it :).

~Sandstorm

Laur€ns

2009-09-16 18:10:12

Nava, that only comes in handy when you want a tradeable item. :) Good idea though.

Blumblebee

2009-09-16 19:44:36

From: Laur€ns
Nava, that only comes in handy when you want a tradeable item. :) Good idea though.


http://www.youtube.com/watch?v=9FY8hl6b54A

Rich

2009-09-16 20:04:03

Thread is months old… -.-

/Thread

Sandstorm

2009-09-17 02:05:25

Doesn't mean it doesn't work?

~Sandstorm

YoHoJo

2009-09-22 11:02:28

Sandstorm, add me on MSN ive got to talk to you about this.
Aslo, 'feather' is bringing up incorrect ID =/

dRez

2009-09-22 22:20:06

Very usefull for my scripts.

Baked0420

2009-09-24 03:32:46

From: Laur€ns
Nava, that only comes in handy when you want a tradeable item. :) Good idea though.


way to go, look what you started :p

Blumblebee, what the f? that song is very gay lol. from the name of the song, did you post it because this thread was beyond gravedug? lol

Sandstorm

2009-09-25 01:04:21

Reparsed the GE yesterday night, posted it tonight. All items should be correct now.

~Sandstorm

Edit (woops, double post, thanks YoHo):

Small update, now only grabs the IDs from my website once, on start up, and stores it in a variable for later use. Now averages about five milliseconds per grab, with the occasional spike to fifteen milliseconds :P.