SRL Archive - RS3 Help

Forms, native, sync


bonsai

2014-12-26 07:46:57

Can anyone with the knowhow explain the native keyword and sync function?

Specifically, I am playing with a form app and all the code examples use these features. I have no clue what they are doing or what requirements I need to meet while using them.

I am having some fun crashing simba though. I got most of my issues sorted by chance but it would be nice to understand what I am doing.

:sasmokin:

Brandon

2014-12-26 09:33:16

From: bonsai
Can anyone with the knowhow explain the native keyword and sync function?

Specifically, I am playing with a form app and all the code examples use these features. I have no clue what they are doing or what requirements I need to meet while using them.

I am having some fun crashing simba though. I got most of my issues sorted by chance but it would be nice to understand what I am doing.

:sasmokin:


Native keyword is a modifier that allows a function to be called in native code. Example: Callbacks.
Simba's internals may need to call that function or maybe a plugin.

Sync is for thread synchronization. Allows a thread to time sync with another. Sync in this case, synchronizes a thread function with the main thread to allow the main thread to call that procedure.

bonsai

2015-01-01 05:09:09

Right now I'm trying to figure out how to update my screen image with a FindColorsTolerance()

My buffer is a TMufasaBitmap and the image in the panel is a TImage. I need to query the TMufasaBitmap for colors (with tolerance) and highlight them.

I know how to do this in a regular script with SetTargetBitmap() but I can't get that to work within a form. I'm having problems with many base functions that don't seem to be thread safe (or whatever the issue is).

If I have a 'normal' bitmap already set up in the main code, I can't call getMufasaBitmap(xx) against it in the form code. Bitmap functions in general seem to be unhappy in the form thread. File operations too. I could call TMufasaBitmap.loadfromfile(). For some other data I had to use a TStringList instead of OpenFile().

Frustrating, but I'm pretty happy with what I got working so far. It's still buggy and I keep crashing simba but there is a sense of accomplishment when the thing displays what you wanted when you wanted it ehehehe. I just keep slapping everything inside try phrases to see what works and what craps out!

Olly

2015-01-01 05:16:11

Client.getIOManager().SetTarget(bmp);

bonsai

2015-01-01 05:22:53

From: Olly
Client.getIOManager().SetTarget(bmp);


bmp as in integer bmp or bmp as in TMufasaBitmap. Cause I have a TMufasaBitmap in hand :)

Olly

2015-01-01 05:27:38

From: bonsai
bmp as in integer bmp or bmp as in TMufasaBitmap. Cause I have a TMufasaBitmap in hand :)


mufasa