Jump to content
Sign in to follow this  
jorgev

Game crashing when started with Autoit

Recommended Posts

jorgev

Hello ,

I have the following code:

$exepat = (IniRead ( "Rfini.ini", "Executable", "Path", "default"))

Run (($exepat&" +fullproc") , "e:\games\rfactor")

I also tried this:

Run ($exepat&" +fullproc" , "e:\games\rfactor")

I have this command executed when i push a button, the game start just fine, but ingame, once i want to start racing the game just crashes, If i start the game with the normal start menu shortcuts then it doesnt crash.

this is the ini part:

[Executable]

Path=E:\Games\rFactor\rfactor.exe

So the command just starts the game rfactor with the +fullproc parameter added to make sure the game uses my 2 cpu's. Removing the +fullproc parameter doesnt change something, game still crashes

Im trying to find the reason why it crashes but cant think of something. The working dir path is what it should be.

Anyone has got a suggestion?

Share this post


Link to post
Share on other sites
oMBRa

does the game crashes when you run it manually without the "+fullproc" parameter?

anyway try "fullproc" parameter without the leading plus

Share this post


Link to post
Share on other sites
Jos

does the game crashes when you run it manually without the "+fullproc" parameter?

anyway try "fullproc" parameter without the leading plus

So the command just starts the game rfactor with the +fullproc parameter added to make sure the game uses my 2 cpu's. Removing the +fullproc parameter doesnt change something, game still crashes

Im trying to find the reason why it crashes but cant think of something. The working dir path is what it should be.

Anyone has got a suggestion?


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
KaFu
jorgev

Hmm i've read true those posts but can't find a solution to this problem,

Case $Button5

EnvSet("rfenv", "e:\games\rfactor")

$runner = "e:\games\rfactor\rfactor.exe"

Run ($runner, EnvGet("rfenv"))

this starts the game also but it crashes on the same point, really strange actually, the game starts fine, but then ingame when i click something it crashes.

With the normal shortcut the game runs fine

Anyone has got another suggestion i could try?

Share this post


Link to post
Share on other sites
jorgev

Now i checked with Process Explorer, the envirement isn't the problem i'm guessing.

I did run the game rfactor with the normal shortcut, and also from within my autoitscript and the working dir is "e:\games\rfactor" in both cases.

So what i'm thinking is that something else is the problem. I did run the game from the command line without any problem.

I'm clueless.

Share this post


Link to post
Share on other sites
KaFu
jorgev

Have you set the workingdir in the Run() func corresponding to the one in the shortcut?

Yes i did, and when i checked in process explorer the working dir is correct,

so there must be another reason why the application/game crashes when launched from the run command

sorry if i say this again, but its only once i'm ingame and click "load track" then the game crashes.

i'm wondering what could be the reason knowing that the crash doesnt happen with the shortcut

Share this post


Link to post
Share on other sites
jorgev

I now did another test

i created a .bat file that would start the game rfactor.exe

then in my autoitscript i executed the .bat file from the run command, and yes the game didnt crash anymore

Maybe i can then set that cmd window that opens from the .bat on hidden, i could do that, but i don't think it's the proper way to do things.

i would prefer if there was another way to start the game from within the script, not with an extra cmd window.

Share this post


Link to post
Share on other sites
KaFu
jorgev

Actually i already did that. When i run the game from the shellexecute() command, the crash also happens.

Share this post


Link to post
Share on other sites
Inverted

What happens if you copy your COMPILED script in the same folder as the game executable and run it there ?

Share this post


Link to post
Share on other sites
jorgev

What happens if you copy your COMPILED script in the same folder as the game executable and run it there ?

I tried that also, the game crashes.

Share this post


Link to post
Share on other sites
jorgev

I have now found a solution to my problem. This is the command i'm using right now and the game doesnt crash:

Run("cmd /c start " & $exepat, "e:\games\rfactor", @SW_HIDE)

Can someone explain what exactly is happening here, what is the difference with running a program trough the cmd or directly from the run command.

we wouldn't learn a thing if we don't know why the game would crash if launched in another way

Share this post


Link to post
Share on other sites
KaFu

If I take a look at the helptext of 'start /?' then I see a parameter 'I' which you have to set to start the .exe with the same env-parameters as set in cmd.exe... so I just assume, that if you DON'T set that parameter, the .exe is started with the standard win-env parameters... I still think it has somehow to do with the parameters...

Edited by KaFu

Share this post


Link to post
Share on other sites
jorgev

If I take a look at the helptext of 'start /?' then I see a parameter 'I' which you have to set to start the .exe with the same env-parameters as set in cmd.exe... so I just assume, that if you DON'T set that parameter, the .exe is started with the standard win-env parameters... I still think it has somehow to do with the parameters...

Strange enough i did not set the I parameter for the start command, the working dir is set from the run command.

INI Part: [Executable]

Path=E:\Games\rFactor\rfactor.exe

$exepat = (IniRead ( "Rfini.ini", "Executable", "Path", "default"))

Run("cmd /c start " & $exepat&" +fullproc", "e:\games\rfactor", @SW_HIDE)

I added the +fullproc parameter for dual core support, and it works.

Share this post


Link to post
Share on other sites
Inverted

What happens IF you set the I parameter ?

Let's get to the bottom of this !

Share this post


Link to post
Share on other sites
KaFu

What happens IF you set the I parameter ? Let's get to the bottom of this !

:D , that's what I thought afterwards and was to lazy to edit...

Share this post


Link to post
Share on other sites
jorgev

What happens IF you set the I parameter ?

Let's get to the bottom of this !

Well, i did try this:

Run("cmd /c start /I " & $exepat&" +fullproc", "e:\games\rfactor", @SW_HIDE)

This way the game runs just fine, with the /I parameter set, but dont forget that:

Run("cmd /c start " & $exepat&" +fullproc", "e:\games\rfactor", @SW_HIDE)

also works fine.

So basicly its about the difference between

Run("e:\games\rfactor\rfactor.exe", "e:\games\rfactor")

and

Run("cmd /c start e:\games\rfactor\rfactor.exe", "e:\games\rfactor", @SW_HIDE)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×