SRL Archive - News and General

storing multiple values in 1 variable


StevenV

2012-08-14 18:38:15

in order to make text reader for a specific website i need to use dtm, cause i can't make a font, because the font has 2 shaduw which sometimes overlay from 2 letters.

so i would like to use dtm to solve this problem.
but i would like to use the alphabeth as variables and each variable should contain 3 values,
ex: a:= width dtm, height dtm, dtm

in this case the 3 values are of the same type, so you could use array's, but what should you do when the 3 values are not of the same type

x[Warrior]x3500

2012-08-14 18:41:28

record?

edit: yah, ninja skills ;)

eska

2012-08-14 18:41:31

A record?

Edit: Ninja'd

NCDS

2012-08-14 18:42:25

Use a T2DIntegerArray.

intArr := [TIntegerArray([dtmFromString'…', width, height]), etc];

eska

2012-08-14 18:43:52

From: NCDS
Use a T2DIntegerArray.

intArr := [TIntegerArray([dtmFromString'…', width, height]), etc];


That won't work if the type of the variables isn't the same.

NCDS

2012-08-14 18:46:15

From: eska
That won't work if the type of the variables isn't the same.


But all those variables are the same…

Even so, we do have variant arrays as well.

eska

2012-08-14 18:51:33

From: NCDS
But all those variables are the same…

Even so, we do have variant arrays as well.


Oh yeah I forgot about these. I have yet to see someone use it lol.

StevenV

2012-08-14 18:53:22

indeed, in the example you could use a T2DintegerArray, because everything is an integer
here is an other example

a:= string, w dtm, h dtm, dtm

is there a way to do something like this.
in this way i could let simba try to locate a dtm and return it's string value

Le Jingle

2012-08-14 18:56:01


var
x, y: integer;
v: TVariantArray;
begin
v:= [x, y, 223, adfa, 6534, 'ADSFASDFASDFASDF'];
if WaitFuncEx('finddtm', v, 250, 5000) then
mouse(x,y,0,0,mouse_left);
end;
Would that example work?

StevenV

2012-08-14 18:59:57

i think this would actual do it, now i still have to play around a bit, but it might work out fine

fre

2012-08-14 19:02:02

MultiDimensional arrays, with type variant.

StevenV

2012-08-15 05:51:31

i think i might be on to something better, but i will need some help.
In the attachements you can find a zip with some 'font' char in it.
Now i would like to use them in this way,
simba would have to search for the exact same colors except for the white area, that should not be included in the search.
I would like simba to combine the char to from a bitmap from the word 'Bedrijf' and then find this word based on the colors (only the colors and not the white)

riwu

2012-08-15 06:32:04

You should use FindBitmapToleranceIn. You can color the white area black so the bitmap search will ignore the black regions. Fonts are always best handled using bitmaps.

Sex

2012-08-15 06:36:20

From: eska
Oh yeah I forgot about these. I have yet to see someone use it lol.


TVariantArrays are used a lot within SRL. They are also used for thread safe calls and such to pass parameters.

putonajonny

2012-08-15 06:44:05

type
letter = record
Width, Height : integer;
DTM, ASCII : String;
end;

Var
TheLetters : array [0..25] of letter;

//Then set them up like this:

with TheLetters[0] do
begin
ASCII := 'a';
Width := 10;
Height := 20;
DTM := 'dewuifbvnd';
end;

//Then use them like this:
WriteLn(TheLetters[0].Height);

StevenV

2012-08-15 06:49:27

From: riwu
You should use FindBitmapToleranceIn. You can color the white area black so the bitmap search will ignore the black regions. Fonts are always best handled using bitmaps.


i know they are best handled using bitmaps but it's a font which has 2 shadows, these shadows can overlap of 2 letters and so the shadow get's an other color.

at this point i'm use settransparentcolor for the white and it's working for me to find the different letters.

The only thing i need now is a way to combine them together, so i can like make a bitmap of 'Bedrijf' using the font bitmaps and then start the search for the bitmap 'Bedrijf', but i'm not sure if there is a way to paste the font bitmaps together, i'm looking at all the functions in simba but haven't found the solution yet.

for now the only way i can think of is to let simba find 'B', then look if he can find 'e' next to it and next to 'e' if there is a 'd', but that will be a long program,
so i'm hoping there is an easier way

riwu

2012-08-15 07:04:38

From: StevenV
i know they are best handled using bitmaps but it's a font which has 2 shadows, these shadows can overlap of 2 letters and so the shadow get's an other color.

at this point i'm use settransparentcolor for the white and it's working for me to find the different letters.

The only thing i need now is a way to combine them together, so i can like make a bitmap of 'Bedrijf' using the font bitmaps and then start the search for the bitmap 'Bedrijf', but i'm not sure if there is a way to paste the font bitmaps together, i'm looking at all the functions in simba but haven't found the solution yet.

for now the only way i can think of is to let simba find 'B', then look if he can find 'e' next to it and next to 'e' if there is a 'd', but that will be a long program,
so i'm hoping there is an easier way

You can always use tolerance or just color the shadow black (and using the above bitmap finding function which will ignore black pixels) to resolve that issue.

StevenV

2012-08-15 07:12:36

you mean instead of like i did (i made the shadow white) make the shadow black?
that would give me the same result as i have now because i set the white as transparent, so simba does not look for the white,

the only thing i actually need now, is a way to make 1 bitmap out of the font bitmaps.
so i can search for 1 bitmap instead of searching for a serie of bitmaps