Cstrike
2010-11-30 13:54:09
One of the issues with making a whole array was the compiling issue. Compiling the true item database was a bit much… so some ideas batted around that seemed very feasible is a plugin. Only downside is noobs who don't know about moving plugins won't be able to use this feature.
I stumbled across reading .txt files, and spent all morning learning how to do it. If you want to test it, go update your reflection to the newest version, and you'll find a script in /Reflection/Development/Object_List/
Run it (its standalone, doesn't need SRL/SMART/Reflection to work!), and see how it outputs stuff.
Or you can try this (same code):
If this is a feasible idea, we can replace items.simba with the same idea (since Method got us a bigger items database, and objects.txt as well… thank you very much to him for this work). Next step if you guys like this idea is to make it go from name to integer, or integer to name for objects, and items. If we could get an NPC database we're set.
Advantages
Heres a quick example:
1) Grab all object names with the fragment 'bank booth'
2) With the TIA, search on screen for any valid bank booth object [interactable]
3) Open it
Not bad huh? UNIVERSAL BANKING! :stirthepot:
EDIT: If you want to put it to the test you can always search a blank string, it will harvest every item :)
EDIT2: If further developed, would have to customize pathname obviously to account for people who don't name their folder "Reflection"
I stumbled across reading .txt files, and spent all morning learning how to do it. If you want to test it, go update your reflection to the newest version, and you'll find a script in /Reflection/Development/Object_List/
Run it (its standalone, doesn't need SRL/SMART/Reflection to work!), and see how it outputs stuff.
Or you can try this (same code):
program ReflectionObjectFinder;
function R_FindObjectArray(ObjectName: String): TIntegerArray;
var FileInt, i: Integer;
FilePath, Data: String;
TSA: TStringArray;
begin
Result := [];
FilePath := AppPath+'Includes\Reflection\Development\Object_Files\Objects.txt';
FileInt := OpenFile(FilePath, true);
try
if not ReadFileString (FileInt, Data, FileSize(FileInt)) then
begin
Writeln ('[Reflection] Error in file while reading: "'+FilePath+'"');
Exit;
end;
except
Writeln ('[Reflection] File doesn''t exist at path: "'+FilePath+'"');
Exit;
end;
CloseFile(FileInt);
TSA := Explode(chr(10), Data);
for i:=0 to high(TSA) do
if (Pos(lowercase(ObjectName), lowercase(TSA[i]))) > 0 then
begin
Insert('&', TSA[i], 1);
SetArrayLength(Result, high(Result)+2);
Result[high(Result)] := StrToInt(Between('&', ':', TSA[i]));
end;
end;
begin
writeln(R_FindObjectArray('ank boot'));
end.
It can generate the list in 0.046 sec if I recall the number correctly. I tried 'ank boot' to get all the bank booths and it does. The code probably can be optimized a bit more, I didn't know how to work around Between(…), so I just injected my own letter at the start of each string and read the numbers between my injected character and the colon.If this is a feasible idea, we can replace items.simba with the same idea (since Method got us a bigger items database, and objects.txt as well… thank you very much to him for this work). Next step if you guys like this idea is to make it go from name to integer, or integer to name for objects, and items. If we could get an NPC database we're set.
Advantages
Heres a quick example:
1) Grab all object names with the fragment 'bank booth'
2) With the TIA, search on screen for any valid bank booth object [interactable]
3) Open it
Not bad huh? UNIVERSAL BANKING! :stirthepot:
EDIT: If you want to put it to the test you can always search a blank string, it will harvest every item :)
EDIT2: If further developed, would have to customize pathname obviously to account for people who don't name their folder "Reflection"