PDA

View Full Version : [ogl] passing more than 1 ID in the getModels method



moring
11-29-2015, 08:16 PM
I'm trying to learn the OGL library and did understand something I couldn't find in the guide (Clarity's guide)


airEssling:=ogl.getModels(3039914149,1252751151);
mouse.click(clientCenter.closest(airEssling)[0].randomizePointEllipse(500));

(airEssling)[0] refers to the first element in the array , But if the object has 2 ID'S?
I tried to play with it, check if I replace it with (airEssling)[1] it will search only the second ID, it's not.
Maybe I didn't understand it correctly?

Obscurity
11-29-2015, 08:42 PM
[3039914149,1252751151]

moring
11-29-2015, 09:08 PM
[3039914149,1252751151]

Thank you :D
I know this kind of questions are ridiculous so i'm sorry for that I didn't program a lot of years.

edit: I get an error "Don't know which overloaded method to call with params"

Obscurity
11-29-2015, 10:52 PM
Clarity; Ross;

On my phone and won't be home a few days. Wanna type our a quick description/explanation?

moring
11-29-2015, 11:02 PM
Clarity; Ross;

On my phone and won't be home a few days. Wanna type our a quick description/explanation?

First of all, thank you and them for the desire to help.
I still didn't understand how it works.
clientCenter.closest(airEssling)[0].randomizePointEllipse(500));
the zero here means the first element in the array airEssling?If so why do we have the [0] outside the parenthesis?
and how can I access all the ID's of airEssling with this function?

moring
11-30-2015, 01:29 AM
Ok so I found I had to add the function TCardinalArray([3039914149,1252751151])
I also found that "t" should be added to methods that conflict with the srl library.
I think someone should add it to the pinned guide. it will help people.
I still don't understand why the index is [0] if there are two elements and why it's outside the parenthesis.

Clarity
11-30-2015, 11:35 PM
Reposting PM response:



1. A TCardinalArray is an array of cardinals, which are a type of integer:



// Integer data types :
Int1 : Byte; // 0 to 255
Int2 : ShortInt; // -127 to 127
Int3 : Word; // 0 to 65,535
Int4 : SmallInt; // -32,768 to 32,767
Int5 : LongWord; // 0 to 4,294,967,295
Int6 : Cardinal; // 0 to 4,294,967,295
Int7 : LongInt; // -2,147,483,648 to 2,147,483,647
Int8 : Integer; // -2,147,483,648 to 2,147,483,647
Int9 : Int64; // -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807


TCardinalArray should no longer be necessary - did the following not work for you?


myModels := ogl.getModels([ID1, ID2, ID3]);


It used to be necessary - but we changed ogLib to make it easier to code. It used to be necessary simply because cardinal was the data type that the GLX.dll plugin accepted for models, as opposed to an integer.

2. Because you are clicking on the [0] of clientCenter.closest(airEssling) rather than simply the [0] of airEssling. clientCenter.closest(airEssling) returns a new and different array that is being used in the mouse.click function, and you are trying to get the [0] of that result, rather than the [0] of airEssling by itself.

Here's a better way to look at it:


var
airEssling, sortedEsslings: glModelArray;
begin
airEssling := ogl.getModels([1452224228,403123861]);
sortedEsslings := clientCenter.closest(airEssling);
mouse.click(sortedEsslings[0].randomizePointEllipse(15));
end;


It's my pleasure to help. Please feel free to ask any more questions - we are also working on more documentation - ogLib is only maintained by two people so we'll get to it when we have free time!

I'll be updating the tutorial to reflect the cardinalarray changes - I thought I had done this, my apologies!