SRL Archive - Help and Support

Runtime error


Sp0rky

2007-10-05 18:11:40

A few people have tried to run my mage arena enchanter script, and get a runtime error when the form is called.

begin
SetArrayLength(V, 0);
ThreadSafeCall('ShowEnchanterFormShowModal', V);
end; <– runtime error here ( Out Of Range )

They're on the latest srl and scar, does anyone know what the problem could be?

Would really appreciate help.

Sorry if it's nubby.

Sumilion

2007-10-05 18:22:28

It errors there because the error is somewhere on the form, which is loaded on that line.

So I can't help you.. even if i have the script its hard to find out where exactly it errors since the error line is where it calls the form…

But post the script, i could look at it and perhaps see whats wrong.

Sp0rky

2007-10-05 18:29:17

Santa made the form, thats why I'm pretty clueless. The weird thing is the form compiles perfectly for me and hy and santa.

Really appreciate the help by the way, thank you.

Heres the thread: http://www.srl-forums.com/forum/sp0rkys-mage-arena-p233058.html

You need that plugin on the thread aswell. If you could help me out, I'd be extremely greatful. Or just try :p

ZephyrsFury

2007-10-05 23:00:31

Its because you haven't called NumberOfPlayers and set the player to active. I've fixed the runtime error by modifying your StartScript procedure a bit:


procedure StartScript(Senders : TObject);
begin
if (Combobox1.text <> 'Buy') and (Combobox1.text <> 'Arena') then
begin
ShowMessage('Please Pick Your Desired Mode!');
Exit;
end;

if not (GetNumbersBool(Edit3.Text)) or not (GetNumbersBool(Edit4.Text)) then
begin
ShowMessage('Please Specify Amount Of Cosmic Runes!');
Exit;
end;

Mode := Combobox1.Text;
NumberOfPlayers(1); //Need to set the Players array length.
Players[0].Name := Edit1.Text;
Players[0].Pass := Edit2.Text;
Players[0].Active := True; //Set player to active.
NumberOfCosmics := StrToInt(Edit3.Text);
CosmicsToBuy := StrToInt(Edit4.Text);
SantyForm.ModalResult := mrOk;
Started := True;
end;

Sumilion

2007-10-06 05:16:37

Haven't looked yet but i suppose trying Zephyrs' solution. Anyway, the access violation errors occure during runtime so it will compile anyway..

Santa_Clause

2007-10-06 08:15:58

It's not Access Violation…it's out of range :) And…how come it compiles for some and not others?

ZephyrsFury

2007-10-06 08:27:03

It compiles for everyone. Theres just an "out of range" error when you start the script. See my post above.

Sumilion

2007-10-06 08:46:34

From: Santa_Clause
It's not Access Violation…it's out of range :) And…how come it compiles for some and not others?


Sorry, but same thing applies.