IMG

 
IMG
IMG   IMG
  Welcome to GTAForums! Be sure to check out the Grand Theft Auto V Forum.

You are not registered! (If you are, click here to login) Registering is fast, free and easy and allows you to instantly reply to any topic on GTAForums.
Why wait? Click here to register your own unique username and become part of the ever-growing community!


( Log In | Register | Revalidate Validation E-mail )
Quick Log-In:
  IMG
       
>
Pages: (2) [1] 2   ( Go to first unread post ) Reply to this topicStart new topicStart Poll

 Coding a launcher.

 
hristobg  
Posted: Thursday, Sep 15 2011, 13:26
Quote Post


IV Map Modder, Scholarship Edition Project Leader
Group Icon
Group: Members
Joined: Aug 1, 2009

bu.gif

XXXXX



Hi, fellas! smile.gif

I need your help. Okay, first of all, I have absolutely none knowledge of coding in Delphi, Visual Basic or whatever software it is.

I'm still a
beginner and I need help. I want to create a simple launcher for my GTA San Andreas game (mod). Just, maybe, a few
features - a button that leads to the official site of the mod, list chooser (I have to explain it more detailed) that loads two different files.

Okay, you didn't get what I said, right? I love to explain myself with examples. Okay, this launcher is planned for
ENB Series. I have
enbseries_low.ini and enbseries_high.ini. In the launcher I want a list that chooses which file to load, before starting the game, '_low'
is for users that uses weak computers and '_high' - for the powerful one.

I don't want the final users to manual rename enbseries_high to enbseries, just game to work, I want that launcher to automaticaly do it for them.

Hope you understood me well, because my English
isn't very good, as you see...

Thank you in advance!

Regards,
Christo
Users WebsitePMMSN
  Top
 

 
Andrew  
Posted: Thursday, Sep 15 2011, 18:14
Quote Post



Group Icon
Group: Forum Admins
Joined: Jul 21, 2003

Member Award




So you basically want an application that renames some files and then loads the game?

CODE

Using System.IO;

File.Move("oldfilename.ext", "newfilename.ext");


CODE

System.Diagnostics.Process.Start("gtaiv.exe");


The two snippets of code to rename and launch the game.
PM
  Top
 

 
hristobg  
Posted: Thursday, Sep 15 2011, 18:35
Quote Post


IV Map Modder, Scholarship Edition Project Leader
Group Icon
Group: Members
Joined: Aug 1, 2009

bu.gif

XXXXX



Using Virtual Basic, right? I have no idea where to put that code, but I'll experiment. biggrin.gif Thank you.

EDIT: After the game is closed, I guess the file will remain with it's new name. Maybe there should be something like checking before renaming.

Regards,
Christo


This post has been edited by hristobg on Thursday, Sep 15 2011, 18:38
Users WebsitePMMSN
  Top
 

 
Andrew  
Posted: Thursday, Sep 15 2011, 18:44
Quote Post



Group Icon
Group: Forum Admins
Joined: Jul 21, 2003

Member Award




That's Visual C# code, not visual basic.

You can make the launcher wait until the game exits and then perform clean up back to normal
PM
  Top
 

 
hristobg  
Posted: Thursday, Sep 15 2011, 18:45
Quote Post


IV Map Modder, Scholarship Edition Project Leader
Group Icon
Group: Members
Joined: Aug 1, 2009

bu.gif

XXXXX



Which program can I use for that program language? smile.gif
Users WebsitePMMSN
  Top
 

 
Andrew  
Posted: Thursday, Sep 15 2011, 18:46
Quote Post



Group Icon
Group: Forum Admins
Joined: Jul 21, 2003

Member Award




You can download Visual C# Express 2010 from Microsoft for free. -> http://www.microsoft.com/visualstudio/en-u...ditions/express
PM
  Top
 

 
hristobg  
Posted: Thursday, Sep 15 2011, 18:48
Quote Post


IV Map Modder, Scholarship Edition Project Leader
Group Icon
Group: Members
Joined: Aug 1, 2009

bu.gif

XXXXX



Thank you, Andrew! I'll try it out and write if I have a question.

Regards,
Christo
Users WebsitePMMSN
  Top
 

 
Andrew  
Posted: Thursday, Sep 15 2011, 18:50
Quote Post



Group Icon
Group: Forum Admins
Joined: Jul 21, 2003

Member Award




Not a problem, you'll probably want two command buttons on a form and a textfield to allow them to set the path to GTAIV, however you can pre-set this by checking if the file exists first. I'll be happy to help as much as I can.
PM
  Top
 

 
hristobg  
Posted: Thursday, Sep 15 2011, 18:53
Quote Post


IV Map Modder, Scholarship Edition Project Leader
Group Icon
Group: Members
Joined: Aug 1, 2009

bu.gif

XXXXX



Thank you very much for offering your help! smile.gif I was wondering is there a way to read from the registry and search where the game (actually is San Andreas, but doesn't matter) is installed, so there will be no need to add the launcher into game folder. But, I guess, I should test my skills first, gain some experience with this software, then asking about that. smile.gif

This post has been edited by hristobg on Thursday, Sep 15 2011, 18:58
Users WebsitePMMSN
  Top
 

 
Andrew  
Posted: Thursday, Sep 15 2011, 19:00
Quote Post



Group Icon
Group: Forum Admins
Joined: Jul 21, 2003

Member Award




it is entirely possible to read from the Registry, if the register for SA does store the path to the game then this would be even easier than checking the files.

CODE

RegistryKey saKey = Registry.LocalMachine.CreateSubKey ("SOFTWARE\\Rockstargames\\saetc");

if (saKey != null)
{
  //key found get value
String sPath = saKey.GetValue ("path"));
}

PM
  Top
 

 
hristobg  
Posted: Thursday, Sep 15 2011, 19:49
Quote Post


IV Map Modder, Scholarship Edition Project Leader
Group Icon
Group: Members
Joined: Aug 1, 2009

bu.gif

XXXXX



As I said earilier, I have none knowledge and I'm completely new to this kind of stuff ( biggrin.gif ), so I want to ask you another question. I have button 'Start' and I pasted the code you gave me. The path is SOFTWARE\Rockstar Games\GTA San Andreas\Installation and the key in which is writen the installation path is 'ExePath'. I pasted all that in the code box which appeared after double clicking on the button 'Start' that I've created. And then... I failed. It says there is some error when I try to start the application, maybe I just need to watch more tutorials. And I have some radio buttons (high settings, medium settings, low settings), but they're just useless, they have no operations. I don't know how to check which radiobutton is choosed. I know, I sound as a total retard now to you... biggrin.gif

EDIT: Looks like the program thinks the RegistryKey is unknown, also, I simply tried that code:

CODE
System.Diagnostics.Process.Start("gtaiv.exe");


^ I changed the .exe path, builded the project, pressed the button that this code was relative to and nothing happened. sarcasm.gif

Regards,
Christo

This post has been edited by hristobg on Thursday, Sep 15 2011, 20:21
Users WebsitePMMSN
  Top
 

 
Andrew  
Posted: Thursday, Sep 15 2011, 21:26
Quote Post



Group Icon
Group: Forum Admins
Joined: Jul 21, 2003

Member Award




Radio buttons are fairly simple to do each button has a checked property, so if you're setting some value to say what its loaded IE a path.

CODE

String path = "some path here";

if(radiohigh.Checked)
{
path = "highpath";
} else if (radioMed.checked)
{
path = "medpath";
}



The error messages are normally pretty good about what's going wrong, post the error message and I'll be able to help you.
PM
  Top
 

 
hristobg  
Posted: Sunday, Sep 18 2011, 10:04
Quote Post


IV Map Modder, Scholarship Edition Project Leader
Group Icon
Group: Members
Joined: Aug 1, 2009

bu.gif

XXXXX



Okay, one guy helped me a lot with coding, he choosed to paste the needed files into \debug\ folder and from there to copy them into San Andreas folder. Everything was fine in Debug mode, but now I want to build it into application. How can I do that? I selected - Publish -> Publish "xxx" and the wizard created an installer. I don't want installer, also the included files for San Andreas in debug folder were missing. How can I build stand-alone application without installer, but with included files for SA in it. biggrin.gif
Users WebsitePMMSN
  Top
 

 
Swoorup  
Posted: Sunday, Sep 18 2011, 10:09
Quote Post


innovator
Group Icon
Group: Members
Joined: Oct 28, 2008

au.gif

XXXXX



You can set in the release mode and then the exe will be in the release folder.
PMMSNYahoo
  Top
 

 
hristobg  
Posted: Sunday, Sep 18 2011, 10:51
Quote Post


IV Map Modder, Scholarship Edition Project Leader
Group Icon
Group: Members
Joined: Aug 1, 2009

bu.gif

XXXXX



I don't understand what you mean...
Users WebsitePMMSN
  Top
 

 
K^2  
Posted: Sunday, Sep 18 2011, 20:04
Quote Post


Vidi Vici Veni
Group Icon
Group: Zaibatsu
Joined: Apr 14, 2004

us.gif

Member Award




The compiler works in two modes. Debug mode and Release mode. In Debug mode, a lot of additional error-checking code is added to the output. It's helpful if you know how to use it, but it will be generally useless in final program.

This is all part of the project settings.
PMMSN
  Top
 

 
nightwalker83  
Posted: Monday, Sep 19 2011, 10:50
Quote Post


Don't mind me
Group Icon
Group: Members
Joined: Oct 10, 2004

au.gif

XXXXX



Hi,

I recently rewrote my program Xassist in VB.NET (was originally written in VB6). Anyway, most of the code is the same as to what is written above. PM me if you would like the code. Last time I posted the code here I was yelled at.
Users WebsitePMMSN
  Top
 

 
K^2  
Posted: Monday, Sep 19 2011, 11:09
Quote Post


Vidi Vici Veni
Group Icon
Group: Zaibatsu
Joined: Apr 14, 2004

us.gif

Member Award




You got "yelled at" for posting a source to something that would have been more useful as a binary download. There is nothing wrong with posting source code if that's what the discussion is about. But yeah, in this case, it's probably better kept to PM. It looks like hristobg has the coding portion covered anyways.
PMMSN
  Top
 

 
nightwalker83  
Posted: Monday, Sep 19 2011, 11:22
Quote Post


Don't mind me
Group Icon
Group: Members
Joined: Oct 10, 2004

au.gif

XXXXX



QUOTE (K^2 @ Monday, Sep 19 2011, 21:39)
You got "yelled at" for posting a source to something that would have been more useful as a binary download. There is nothing wrong with posting source code if that's what the discussion is about. But yeah, in this case, it's probably better kept to PM. It looks like hristobg has the coding portion covered anyways.

No, that is not why I was yelled at, it was a thread I started! The reason I was yeleld at was because I didn't realize the not everyone on here would have access to VB6.
On the other forum I frequent they only allow posting source code to protect the user from dangers that might be in the compiled files. Yeah, although, I personally think Andrew would have been better teaching hristobg VB rather than C# since it is a bit easier to understand if you are new to programming but whatever. I know how to code in C# I have a bad habit of going back to VB6.

This post has been edited by nightwalker83 on Monday, Sep 19 2011, 11:26
Users WebsitePMMSN
  Top
 

 
K^2  
Posted: Monday, Sep 19 2011, 12:27
Quote Post


Vidi Vici Veni
Group Icon
Group: Zaibatsu
Joined: Apr 14, 2004

us.gif

Member Award




Back in the days, when C# didn't even exist and Visual Basic was up to something like 4.0, I remember something a university professor was telling to his introduction to programming students.

"It is ok if you know nothing about programming. It's much worse if you know BASIC."

Back then I programmed in QBasic and played a bit with VB. I knew enough C to get by, but haven't really gotten into it yet. I did not really understand what the hate was all about. Nor did I understand it after switching completely to C++. The phrase really gained clarity over time, as I learned processor architecture, wrote machine code on different platforms, some audio drivers, got proficient with C and C++, picked up a few more languages. It's true. Visual Basic is completely fine if that's all you are ever planning to do, but if you ever want to program something serious, any variation of BASIC is absolutely the worst choice for your first language. Yes it's easy. Yes, you can teach it to someone who've never programmed in less time than any other language. But damn, does it mess you up! I'm not even sure I can point to a specific problem with it. It just makes you used to doing things the wrong way. The messy inefficient way. The kind of way that will make you want to cry every time you see a Dr. Watson window pop up. I remember that feeling when I was first learning linked lists and binary trees.

I honestly couldn't tell you if C# is any better in that regard. I suspect it is, but having grown up on BASIC, I can only make claims about pitfalls of that particular language.
PMMSN
  Top
 

 

0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)

0 Members:

Pages: (2) [1] 2 

Topic Options Reply to this topicStart new topicStart Poll
Search topic for posted by (exact match)



 
IMG IMG