Author Topic: Having trouble with WriteFile (2.6.0)  (Read 2868 times)

0 Members and 1 Guest are viewing this topic.

Offline DeMo

  • Soldier
  • **
  • Posts: 127
  • Stay Metal! \m/
    • Encoder 2002
Having trouble with WriteFile (2.6.0)
« on: April 29, 2007, 07:03:45 pm »
When I try to use WriteFile or WriteLnFile I get:
  • Run-time error (OnCommand): Access violation at address 00403EC2 in module 'soldatserver.exe'


I'm using WriteFile on a script I'm working on.
I tried it in a simple procedure (that is called through OnCommand) just to make sure and it stills crashes.

Code: [Select]
procedure test(Text: string);
begin
  WriteLnFile('test.txt', Text);
end;

function OnCommand(ID: Byte; Text: string): boolean;
begin
  if (Text = '/test') then test('just testing!');
  Return := false
end;

It works, "just testing" is written to test.txt, but after that I get the Run-time error.
I had a lot of trouble with GetPiece in this version too. In 2.5.4 the index started at 1, in the new version it seems to start at zero. I was in a hurry so I didn't test it very much, but it was giving me a headache so I used the split function instead.

Can anyone test the WriteFile and WriteLnFile functions and report if it works for you?
Thanks.

<@Evil-Ville> Expect a picture of Chakra` holding his fleshlight soon!


Offline DeMo

  • Soldier
  • **
  • Posts: 127
  • Stay Metal! \m/
    • Encoder 2002
Re: Having trouble with WriteFile (2.6.0)
« Reply #2 on: April 29, 2007, 08:48:42 pm »
Here's the output:

Code: [Select]
/log
|| ScriptFunc(OnAdminMessage);
|| ScriptCore.SetVariables();
Command
|| ScriptFunc(OnCommand);
|| ScriptCore.SetVariables();
|| ScriptCore.AppendFile(test.txt);
 [*] Run-time error (OnCommand): Access violation.......

Hope it helps.

<@Evil-Ville> Expect a picture of Chakra` holding his fleshlight soon!

Offline EnEsCe

  • Retired Soldat Developer
  • Flamebow Warrior
  • ******
  • Posts: 3101
  • http://enesce.com/
    • [eC] Official Website
Re: Having trouble with WriteFile (2.6.0)
« Reply #3 on: April 29, 2007, 08:59:34 pm »
You will find the file is still created.

Fixed it now anyway

Offline DeMo

  • Soldier
  • **
  • Posts: 127
  • Stay Metal! \m/
    • Encoder 2002
Re: Having trouble with WriteFile (2.6.0)
« Reply #4 on: April 29, 2007, 09:36:56 pm »
Yep, it creates (if needed) and writes to the file.
But after that it crashes.

Should I wait for a new version of the Dedicated?

<@Evil-Ville> Expect a picture of Chakra` holding his fleshlight soon!

Offline Avarax

  • Veteran
  • *****
  • Posts: 1529
    • Official Hexer & MMod site
Re: Having trouble with WriteFile (2.6.0)
« Reply #5 on: April 30, 2007, 07:19:35 am »
ye, i already noticed this yesterday, WriteLnFile has the same bug.
I like to have one Martini
Two at the very most
Three I'm under the table
Four I'm under the host

Offline EnEsCe

  • Retired Soldat Developer
  • Flamebow Warrior
  • ******
  • Posts: 3101
  • http://enesce.com/
    • [eC] Official Website
Re: Having trouble with WriteFile (2.6.0)
« Reply #6 on: April 30, 2007, 07:30:38 am »
In the future, for small bugs like this I am going to put "pre-release" soldatserver binaries on my website for download. Only for small fixes relating to the script core.

Offline Avarax

  • Veteran
  • *****
  • Posts: 1529
    • Official Hexer & MMod site
Re: Having trouble with WriteFile (2.6.0)
« Reply #7 on: April 30, 2007, 07:31:24 am »
great... so where is the fix? ;P
I like to have one Martini
Two at the very most
Three I'm under the table
Four I'm under the host


Offline urraka

  • Soldat Developer
  • Flagrunner
  • ******
  • Posts: 703
Re: Having trouble with WriteFile (2.6.0)
« Reply #9 on: May 04, 2007, 08:57:07 am »
i wanna use that function too, and i get the same error
how far is that future? :P
urraka

Offline EnEsCe

  • Retired Soldat Developer
  • Flamebow Warrior
  • ******
  • Posts: 3101
  • http://enesce.com/
    • [eC] Official Website
Re: Having trouble with WriteFile (2.6.0)
« Reply #10 on: May 04, 2007, 09:19:18 am »
The future arrived like 3 days ago, sheesh

Offline urraka

  • Soldat Developer
  • Flagrunner
  • ******
  • Posts: 703
Re: Having trouble with WriteFile (2.6.0)
« Reply #11 on: May 04, 2007, 08:45:46 pm »
aff u should smite me for that... i guess i can find that fix in your website? (which i discovered yesterday)
urraka

Offline DeMo

  • Soldier
  • **
  • Posts: 127
  • Stay Metal! \m/
    • Encoder 2002
Re: Having trouble with WriteFile (2.6.0)
« Reply #12 on: May 04, 2007, 10:18:43 pm »
Dedicated Server Pre-Release 2.6.1
"You need to be a registered member to download this file..."
Ok.. registered myself.
"You need 15+ posts before you can dowload this file"

OMG why is it so hard to just grab an update? :(
I haven't updated my clan's server to 2.6.0 until now because WriteFile didn't work and I need it for my scripts. And now there's all this complications to just download the update.
« Last Edit: May 05, 2007, 01:02:30 am by DeMo »

<@Evil-Ville> Expect a picture of Chakra` holding his fleshlight soon!

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Having trouble with WriteFile (2.6.0)
« Reply #13 on: May 12, 2007, 06:46:55 pm »
i got the 2.6.1 thing and didn't realise the split(...) didn't work

Offline urraka

  • Soldat Developer
  • Flagrunner
  • ******
  • Posts: 703
Re: Having trouble with WriteFile (2.6.0)
« Reply #14 on: May 12, 2007, 07:07:44 pm »
You should download the xsplit code snippet, then you can rename its function to split. And it will work for Linux too.
urraka

Offline EnEsCe

  • Retired Soldat Developer
  • Flamebow Warrior
  • ******
  • Posts: 3101
  • http://enesce.com/
    • [eC] Official Website
Re: Having trouble with WriteFile (2.6.0)
« Reply #15 on: May 12, 2007, 07:11:14 pm »
People are gonna have to use xsplit, I can not include Split as built-in now because the TStringArray variable causes access violations when being used between soldatserver<->script.