Jump to content
shadowrecon

Questions About Scar Command Lines >> Look Freddy

Recommended Posts

My question is How is Scar Executed, does each individual Procedure or Function Load into memory when called upon, or is it loaded when you start the program then just called when the code Calls it?

 

Reason im asking is im trying to optimize the scripts, make them more computer friendly, but i guess if the script is just loaded directly into memory then all u can do is make them shorter. but if it calls function by function from the script off the hard disk then you could shorten your longer functions into shorter functions. Ive been doing some debugging myself and looking at hard disk/ usage and i do seem to find a collation to the script calling long procedures vs shorter ones, just wanted to clarify or maybe im just seeing what i want to see.. i dunno.

Link to comment
Share on other sites

Hmm... The script is parsed by my custom preprocessor which incorporates all includes in it, removes comments, etc... Basically minimizing the script quite a lot. Then it's sent off to the script engine which runs it through the parser which converts it to tokens, then those tokens are used by the compiler to generate a form of bytecode in the memory it can execute with it's runtime engine.

Link to comment
Share on other sites

I sort of understand what you saying here, i did a bit of making codes for old ps2 games with the mips processor, the engine we used to send the codes to the processor read 20 lines at a time so it used 'chunks' is that what you mean when the bytecode is sent to memory or do u just mean the whole script is sent to memory? i mean most scripts are not over 100kb so i dont think it would much matter <_>

 

I guess my really question is whats the best way to keep a script running at its optimum lvls using the least amount of cpu along with ram(i guess keep em short =p)

 

Another question is how do u properly kill a form with out killing the whole script, i tried calling the '.......Modalresult:=mrOK;' line and it killed the form and the scirpt ran fine but a few times of doing that and i ended up with a 'Pluggin Container ...' Still running in processes, and was killing the cpu usage.. like 85% of it was just for that.. lol.

Link to comment
Share on other sites

The scripts are compiled, the script itself in it's code form isn't executed, only the bytecode, which will take up (a lot) less space in the memory, but the entire thing is loaded into the memory in that format.

 

Are you using ThreadSafeCall to load and show the form?

Link to comment
Share on other sites

the code below is how i am starting the form

procedure United_Bots_1_SafeInit;
var
 v: TVariantArray;
begin
 SetLength(v, 0);
 ThreadSafeCall('United_Bots_1_Init', v);
end;

Procedure FormStart;

begin
 United_Bots_1_SafeInit;
 if United_Bots_1_SafeShowModal then
   WriteLn('Form returned modalresult ok');
   FreeForm(United_Bots_1);
end;

 

then to end it i use a button click like this

procedure StartButton(sender: TObject);
begin
  United_Bots_1.Modalresult:=mrOK;
end;

 

Should i call FreeForm() within the button click?

Link to comment
Share on other sites

alright i was just wondering, maybe it was just a one time deal, its been fine since, when the Start button is pressed the showmodal kills the form correct? there isnt much documentation out there on it, and i tried going between a few old wikis you had, and a delphi scripting site, and finally got everything together =) amazing everything is pretty much the same, except how you load a picture into the form lol. i spent hours trying to figure that out, in delphi you call the object then loadfromfile then name, where as in scar you simply call it the same way but what messed me up is the do with statemeant at the top of the object, so i put the objects name in front of loadfromfile. anywho i figured it out, and works great. im really starting to like INI files to=))

 

another question

 

if the x buttion is pushed to exit the form is there away to call terminate script?

Edited by shadowrecon
another question
Link to comment
Share on other sites

Yeah i was wondering it just a bit laggy and i use a good computer, and was just kinda shocked, that was why i was asking the questions about how scar was executed and stores the data because i wanted to simply no my limitations, i thought i had unlimited amount of lines < _ > lol. but that is a huge bottle neck in any actually smart program, but i guess its quality over quantity, but quantity + quality make an awesome Coding program, im sure you will get it fixed. =)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...