how do you get the contents of a TComboBox and a TMemo?
~shut
how do you get the contents of a TComboBox and a TMemo?
~shut
All my scripts are held on Googlecode git, so if you ever see a problem, fork it and send me a pull request
If a script is grey, it doesn't work, if it's colour then it does!
My Tutorials:-
Everything you need to know about setting up Simba, SRL and Reflection!, How to sort out the MSVCR71.dll error
How to set up players for autoing with Simba, SRL/Simba Standards (with examples), Defines
Auto Updater and Git, Using a testing branch for git, Adding SRL Stats to your script
Creating your own font set for Simba, Guide to Cups, How to make 1.45M (RSGP) a day (not really my tut)
Download a image and set it as your Desktop Wallpaper in C#, How to make your first PHP file uploader
<Coh3n> Shuttleu, fuck I love you right now
For Memo:
Memo1.Text or Memo1.Lines.Text
For ComboBox:
ComboBox1.Text
hmmm...
PlayerFood is a TComboBox but when i do this
i get thisSCAR Code:writeln(PlayerFood.text);
:/Code:[Runtime Error] : Exception: Access violation at address 696C7053. Read of address 696C7053 in line 820 in script C:\Users\Thomas\Desktop\form.scar
~shut
EDIT: never mind i fixed it
but is it a TStringArray that is returned from a TMemo or a String?
Last edited by Shuttleu; 05-10-2009 at 12:30 AM.
All my scripts are held on Googlecode git, so if you ever see a problem, fork it and send me a pull request
If a script is grey, it doesn't work, if it's colour then it does!
My Tutorials:-
Everything you need to know about setting up Simba, SRL and Reflection!, How to sort out the MSVCR71.dll error
How to set up players for autoing with Simba, SRL/Simba Standards (with examples), Defines
Auto Updater and Git, Using a testing branch for git, Adding SRL Stats to your script
Creating your own font set for Simba, Guide to Cups, How to make 1.45M (RSGP) a day (not really my tut)
Download a image and set it as your Desktop Wallpaper in C#, How to make your first PHP file uploader
<Coh3n> Shuttleu, fuck I love you right now
Memo.Text or Lines.Text returns the entire text in a string. The problem with them is, that there aren't lines because they are showed as a character(#32). To get the lines I think it's Memo.Lines[0].
thank you for your help soo far
but one last thing
it doesnt work if i do
it saysSCAR Code:GetArrayLength(Memo.Lines)ugh...Code:Line 26: [Error] (16780:52): Variable Expected in script C:\Users\Thomas\Desktop\form.scar
this is the last thing i need to know
~shut
All my scripts are held on Googlecode git, so if you ever see a problem, fork it and send me a pull request
If a script is grey, it doesn't work, if it's colour then it does!
My Tutorials:-
Everything you need to know about setting up Simba, SRL and Reflection!, How to sort out the MSVCR71.dll error
How to set up players for autoing with Simba, SRL/Simba Standards (with examples), Defines
Auto Updater and Git, Using a testing branch for git, Adding SRL Stats to your script
Creating your own font set for Simba, Guide to Cups, How to make 1.45M (RSGP) a day (not really my tut)
Download a image and set it as your Desktop Wallpaper in C#, How to make your first PHP file uploader
<Coh3n> Shuttleu, fuck I love you right now
SCAR Code:Memo.Lines.Count;![]()
You could explode the result of Memo.Lines.Text using character #32 couldn't you?
~Sandstorm
SCAR Code:var
form: TForm;
memo: TMemo;
button: TButton;
procedure reportMemoLines(Sender: TObject);
var
i, miC: Integer;
begin
ClearDebug;
ClearReport;
miC:= memo.Lines.Count;
AddToReport('Total Lines: ' + IntToStr(miC));
if(miC > 0)then
for i:= 0 to (miC - 1) do
WriteLn('Line ' + IntToStr(i) + ': ' + memo.Lines.Strings[i])
else
WriteLn('Memo is empty.');
end;
function buildForm: Boolean;
begin
form:= CreateForm;
with form do
begin
SetBounds(0, 0, 500, 400);
Position:= poScreenCenter;
BorderStyle:= bsSingle;
BorderIcons:= [biSystemMenu, biMinimize];
end;
memo:= TMemo.Create(form);
with memo do
begin
Parent:= form;
SetBounds(5, 5, 484, 332);
end;
button:= TButton.Create(form);
with button do
begin
Parent:= form;
SetBounds(220, 342, 50, 21);
OnClick:= @reportMemoLines;
end;
Result:= (form.ShowModal = mrOK);
end;
function loadForm: Variant;
var
v: TVariantArray;
begin
Result:= ThreadSafeCall('buildForm', v);
end;
begin
loadForm;
FreeForm(form);
end.
Edit: Oh by the way, the type that is holding memo lines is actually TStrings, so if you want TStringArray of the lines, I have got a small workaround for doing that...
SCAR Code:var
form: TForm;
memo: TMemo;
button: TButton;
function TStringsToTStringArray(strings: TStrings): TStringArray;
var
i, h: Integer;
begin
h:= strings.Count;
SetArrayLength(Result, h);
for i:= 0 to (h - 1) do
Result[i]:= strings[i];
end;
procedure reportMemoLines(Sender: TObject);
var
i, miC: Integer;
TSA: TStringArray;
begin
ClearDebug;
miC:= memo.Lines.Count;
if(miC > 0)then
begin
TSA:= TStringsToTStringArray(memo.Lines);
for i:= 0 to (miC - 1) do
begin
WriteLn('memo.Lines.Strings[' + IntToStr(i) + ']: ' + memo.Lines.Strings[i])
WriteLn('TSA[' + IntToStr(i) + ']: ' + TSA[i]);
WriteLn('');
end;
end else
WriteLn('memo = Empty');
end;
function buildForm: Boolean;
begin
form:= CreateForm;
with form do
begin
SetBounds(0, 0, 500, 400);
Position:= poScreenCenter;
BorderStyle:= bsSingle;
BorderIcons:= [biSystemMenu, biMinimize];
end;
memo:= TMemo.Create(form);
with memo do
begin
Parent:= form;
SetBounds(5, 5, 484, 332);
end;
button:= TButton.Create(form);
with button do
begin
Parent:= form;
SetBounds(220, 342, 50, 21);
OnClick:= @reportMemoLines;
end;
Result:= (form.ShowModal = mrOK);
end;
function loadForm: Variant;
var
v: TVariantArray;
begin
Result:= ThreadSafeCall('buildForm', v);
end;
begin
loadForm;
FreeForm(form);
end.
=> function TStringsToTStringArray.
Last edited by Janilabo; 05-10-2009 at 02:57 AM.
All my scripts are held on Googlecode git, so if you ever see a problem, fork it and send me a pull request
If a script is grey, it doesn't work, if it's colour then it does!
My Tutorials:-
Everything you need to know about setting up Simba, SRL and Reflection!, How to sort out the MSVCR71.dll error
How to set up players for autoing with Simba, SRL/Simba Standards (with examples), Defines
Auto Updater and Git, Using a testing branch for git, Adding SRL Stats to your script
Creating your own font set for Simba, Guide to Cups, How to make 1.45M (RSGP) a day (not really my tut)
Download a image and set it as your Desktop Wallpaper in C#, How to make your first PHP file uploader
<Coh3n> Shuttleu, fuck I love you right now
No problem mate, just glad you got everything working!
-Jani
All my scripts are held on Googlecode git, so if you ever see a problem, fork it and send me a pull request
If a script is grey, it doesn't work, if it's colour then it does!
My Tutorials:-
Everything you need to know about setting up Simba, SRL and Reflection!, How to sort out the MSVCR71.dll error
How to set up players for autoing with Simba, SRL/Simba Standards (with examples), Defines
Auto Updater and Git, Using a testing branch for git, Adding SRL Stats to your script
Creating your own font set for Simba, Guide to Cups, How to make 1.45M (RSGP) a day (not really my tut)
Download a image and set it as your Desktop Wallpaper in C#, How to make your first PHP file uploader
<Coh3n> Shuttleu, fuck I love you right now
It would be something like that...SCAR Code:function TStringArrayToTStrings(TSA: TStringArray): TStrings;
var
i, h: Integer;
begin
Result:= TStringList.Create;
h:= High(TSA);
for i:= 0 to h do
Result.Append(TSA[i]);
end;
var
T: TStrings;
i, iC: Integer;
begin
T:= TStringArrayToTStrings(['Test1', 'Test2', 'Test3']);
iC:= T.Count;
for i:= 0 to (iC - 1) do
WriteLn(T.Strings[i]);
T.Free;
end.
That was a harder one, haha..![]()
ok thanks now lets see if it will work
~shut
EDIT:
Line 316: [Error] (17070:36): Unknown type 'TString' in script C:\Users\Thomas\Desktop\form.scar
Last edited by Shuttleu; 05-10-2009 at 05:21 AM.
All my scripts are held on Googlecode git, so if you ever see a problem, fork it and send me a pull request
If a script is grey, it doesn't work, if it's colour then it does!
My Tutorials:-
Everything you need to know about setting up Simba, SRL and Reflection!, How to sort out the MSVCR71.dll error
How to set up players for autoing with Simba, SRL/Simba Standards (with examples), Defines
Auto Updater and Git, Using a testing branch for git, Adding SRL Stats to your script
Creating your own font set for Simba, Guide to Cups, How to make 1.45M (RSGP) a day (not really my tut)
Download a image and set it as your Desktop Wallpaper in C#, How to make your first PHP file uploader
<Coh3n> Shuttleu, fuck I love you right now
Change the 'TString' to either 'TStrings' or 'TStringList', TStringList is a better choice, though.
I google'd a bit about TStrings, and it seems like it has some problems that has been fixed for TStringList.
-Jani
There are currently 1 users browsing this thread. (0 members and 1 guests)