View Full Version : finding an amount of dtms
so basically, i want to find a specific amount of the same dtm before doing something, how can i do this? thanks
YoHoJo
06-01-2012, 08:46 AM
Is it a DTM of an item? Or something else?
Is item, is it stackable?
just simple unstackable items in the inventory
YoHoJo
06-01-2012, 09:56 AM
Look in Inventory.simba
function CountItems(ItemType: string; Identifier: Integer; tol: TIntegerArray): Integer;
Counts Items in the inventory:
- ItemType: 'dtm', 'bitmap', 'bitmap mask', 'color'
- Item: name/value of your dtm/bmp/color/bmpmask.
- Tol:
* 'dtm' - [] (dtm's can't have tolerance).
* 'bmp' - [BMPTol].
* 'color' - [COLOUR Tol, Colour Count].
* 'bmpmask' - [BMPTol, ContourTol].
.. note::
by WT-Fakawi / Sumilion
Example:
.. code-block:: pascal
numbOfItems := CountItems('dtm', TheDTM, []);
Will most likely do what you need.
procedure asdf;
var
CountItems:Integer;
begin
RandomDTM:= DTMFromString('445335434');
if 15 := CountItems('dtm', RandomDTM, x, y, 10, 20, 30, 40) then
begin
3sadfgasg;
end;
end;
something like this right? i have no idea
YoHoJo
06-01-2012, 10:39 AM
if CountItems('dtm', RandomDTM, x, y, 10, 20, 30, 40) = 15 then
Is what you want I believe.
Actually
CountItems('dtm', RandomDTM, []) = 15 Then
Look at the example, make sure you follow the parameters it asks for, you made up a search box when one isn't needed silly!
i dont get it, so how does it actually find dtms? and what does the [] mean? this is all confusing
YoHoJo
06-01-2012, 11:02 AM
CountItems('dtm', RandomDTM, []);
That counts 'dtm' , with name RandomDTM, the brackets are meant for tolerance, but DTMs (as a whole) don't have tolerance, so then we leave the brackets blank.
If CountItems('dtm', RandomDTM, []) = 15 Then
Would do something if over 15 of RandomDTM are found.
It searches the inventory by default (it only searches inventory).
dam, well i was going to make this for a private server so i needed a box for it to search in, is there any other way to do it within a searching box?
YoHoJo
06-01-2012, 11:13 AM
Go to inventory.simba
Copy the function, paste it into your script, rename it from CountItems to anything else like CountItemsX, and then edit the line(s) in the code that specify a box with a box of your own.
I can give exact code later/tomorrow if you want, maybe someone else will beat me though.
Not too hard to do.
yeh thanks it would be great if you could show me, all i can see is tmpbox.x2 and pointinbox and heaps of stuff i cant understand
Le Jingle
06-01-2012, 09:51 PM
(*
CountItems
~~~~~~~~~~
.. code-block:: pascal
function CountItems(ItemType: string; Identifier: Integer; tol: TIntegerArray): Integer;
Counts Items in the inventory:
- ItemType: 'dtm', 'bitmap', 'bitmap mask', 'color'
- Item: name/value of your dtm/bmp/color/bmpmask.
- Tol:
* 'dtm' - [] (dtm's can't have tolerance).
* 'bmp' - [BMPTol].
* 'color' - [COLOUR Tol, Colour Count].
* 'bmpmask' - [BMPTol, ContourTol].
.. note::
by WT-Fakawi / Sumilion
Example:
.. code-block:: pascal
numbOfItems := CountItems('dtm', TheDTM, []);
*)
function CountItems(ItemType: string; Identifier: Integer; tol: TIntegerArray): Integer;
begin
GameTab(tab_Inv);
Result := CountItemsIn('inv', ItemType, Identifier, Tol)
end;
^ This is from inventory.simba
This is one of many ways that you could incorporate into your script.
// CountItems('DTM', Identifier: Integer; tol: TIntegerArray): Integer;
//'DTM' means we are searching for a DTM.
//OurDTM means we are referencing the DTM we actually created/made/found/are using.
//[] for our tolerance, since we probably already used a good tol upon making our DTM
// --- Now our Script ---
Procedure InventoryCheckingStuffs;
Var
OurDTM: Integer;
Begin
OurDTM:= DTMFromString('...The DTM code goes here...');
If (CountItems('DTM', OurDTM, []) = 20) Then
Begin
InvMouse(20, Mouse_Right);
WaitOption('rop', 500);
End;
FreeDTM(OurDTM);
End;
I was meaning how I can edit the code inside inventory.simba so I can change the co ords of it, but thanks for the in depth response!
Le Jingle
06-01-2012, 10:58 PM
You probably don't want to edit inventory.simba unless you really know what you are doing.
But if you are trying to find inventory.simba and see all the proc/func its usually found udner Simba/includes/srl/srl/core
but you could make an entire new function like what yohojo said and use it a script right?
bolshak25
06-02-2012, 04:01 PM
copy the function and paste it into your script, but rename it. then you can change the coords in it, and instead of calling the inv function, call the newly named one thats in your script
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.