Newbie Spellweaver
- Joined
- May 3, 2008
- Messages
- 35
- Reaction score
- 5
Brief Introduction:
Hey everyone, I have floated around for awhile and have never really contributed anything. Well here today I have decided I would try my best to take what I know into helping you create a launcher for your Maplestory server! Progressively through this tutorial you will get from the simple start up, to a little more flashy, and advanced launcher. So hopefully some of you will enjoy this tutorial! Thank you!
Keep in mind it is a good idea to have a default directory for the private server client! It will be hard-coded and if the launcher cannot find the program it is looking for, it will not work! (ie. C:\Nexon\Maplestory\localhost.exe)
Little Info on VB .NET 2010
As most everyone here knows, Visual Basic is a language that allows you to visually construct a user interface by simply dragging and dropping controls onto a form. (The window that comes up when a program is run.)
Barebones:
So let's start simple. In Visual Studio .NET 2010 go ahead and open up a new Windows Forms Application.
Now you'll see something like this. I've already resized my form. You can do that by dragging the little white handles on the side of the form. I also went ahead and renamed my form. Inside the properties window, located to the right near the bottom, there is a property called "Text". Click that and type in what ever you want. Also, look for the property called "MaximizeBox" set this value to "False", we do not want people resizing this.
So now that our form is named and at a size we like, let's go ahead and add our shiny "Start" button. In order to add the button, we need our toolbox open, if it isn't up at the moment, go ahead and click the "View" drop-down window at the top of the Visual Studio Interface. Or if you're not a fan of clicking, go ahead and press CTRL + ALT + X.
The toolbox is now open. Don't be startled by what's there! It's actually pretty simple. Look carefully, the toolbox has been divided into categories. Now the button we are looking for is under the category "Common Controls."
Now simply by clicking on the text, the category will expand, revealing a numerous amount of controls available for your pleasure. Now all we need right now is the "Button" control. Go ahead and drag and drop the "Button" control from the toolbox onto your form.
When you click the button on your form, it becomes selected. The handles appear around it, allowing you to resize it. Go ahead and resize it to your liking. You may also drag the button around your form, so place it where you'd like as well.
Now since I assume the ones following this tutorial are not avid coders and may just be getting started, I am going to help you keep things organized.
When your button is selected, the properties of the button are now displayed in the properties window to the right. Look for the "(Name)" property, currently this control is named "Button1". To practice good organization in our code, let's go ahead and change that to something like "btnStart". Controls in Visual Basic can be better identified by renaming them, since the name is what we use in the code.
Scroll down to the "Text" property in the properties window for the button and change it to something like "Start Game".
Now our form is clean and easily accessible to any player that utilizes it!
Coding the Start Button:
Now we will be adding code to "btnStart", so to access the coding window, simply double click the button we created earlier. A new window will appear with the code:
This simply shows where the code is running. Your cursor will be underneath the Private Sub and above the End Sub. This is where we will tell the program what to do when the button is clicked.
First we need to create a String Variable. This string will tell the program where the client is when the button is pressed. To declare a variable we must type in:
Now that the variable is declared we must let the program know what Directory is. To do this, type this:
NOTE: If you plan to have players install Maplestory elsewhere, place that directory in, instead of the one I provided!
The program now knows what it will be executing, but we must now tell it how to get there. This code may seem a little bit weird, but it is basically the equivalent of double-clicking the localhost to make it run. The code required is as follows:
Now press F5 to test out your simple launcher. When the button is pressed, the localhost client should run.
To finish up, let's have the launcher close after the localhost starts up. To do this we must simply add this:
Simple enough? So what does it all look like?
Full Code So Far:
Thank you for reading my tutorial, this was the first part, I will be back to add more features to make your launcher both pretty and informative!
---------- Post added at 02:41 AM ---------- Previous post was at 02:40 AM ----------
Part Two!
Obviously this just won't make the cut for the big league servers, am I right?
So why don't we kick it into a higher gear. In this second part of the tutorial, we are going to add some tabs to the form that will allow you to view some news and even register straight from the launcher itself! So let's get started, shall we?
Little Introduction:
I won't take as much time on this part of the tutorial to explain every little detail. I taught you how to reach the toolbox, and how to rename and change the text properties of different controls. So if you have questions, feel free to ask below.
Add the tab system:
Assuming you have your launcher program opened up, go over to your toolbox. Look for the "Containers" category, and select the "TabControl" control. Drag that over to your form, and position it to your liking using the handles.
Now in the properties window, go ahead and rename the control using the "(Name)" property. Also, don't forget to change your tab names. You can do this by going to the "TabPages" property in the properties window. It will open this window:
Change the "Text" properties to "Server News" and "Registration". After that, click the "Registration" Tab on your form, when it is selected, we are going to add a "WebBrowser" control.
If this control is not currently under the category "All Windows Forms", we will have to add it. To do this right click inside the ToolBox, then select "Choose Items..." In the "Filter" text box, type in "WebBrowser" check the box, and press "Okay". Now the control should be added to your toolbox.
Drag and drop the newly added "WebBrowser" control to the "Registration" tab. There should now be a white box, with a grayed out scroll bar in the tab window. If it is not already selected, select it. Go to properties and find the property for "URL". Add the URL of your server's registration page. This will allow players access to your server's registration page, from the launcher. Allowing them to easily register, and begin playing.
Next will be adding information to the "Server News" tab. Here I am giving you two options. You may either do what we had previously done for the "Registration" tab, adding a "WebBrowser" control, and giving it the URL of a news page on your website, or we can add a text window, that you can update in each new Launcher update. My preferred choice would be to redirect to a news page. In my case, a twitter feed.
So let's just say we chose to just add a text window. Here's how to do it.
Select your "Server News" tab, this tab should be empty, completely gray. Now go to your toolbox and locate the "TextBox" control under the "Common Controls" category. Drag this to the "Server News" tab, and resize it to fill to the dotted-line. In order to keep people from tinkering with the news you've added, go to the properties of the TextBox. Locate the "ReadOnly" property, and change its value from "False" to "True". Now let's add a scrollbar for good measure. Locate the "ScrollBars" property in the TextBox property menu. Change its value from "None" to "Vertical".
The textbox is now correctly set up, now we just need to add some news to it! To do this once again go to the properties window of the TextBox. Locate the "Text" property, and enter some news. To be formal, it makes sense to include a date, and a topic.
That's all for now, here is a finished picture of the code so far, and the appearance of the WebBrowser in action.
There is no code involved in this update, just a brief little tutorial on how to make the launcher more useful to its users. I plan to work out a new tutorial on how to get your launcher to display the server status next. Hang in there! This is still my first tutorial, I am trying to be helpful!
Hey everyone, I have floated around for awhile and have never really contributed anything. Well here today I have decided I would try my best to take what I know into helping you create a launcher for your Maplestory server! Progressively through this tutorial you will get from the simple start up, to a little more flashy, and advanced launcher. So hopefully some of you will enjoy this tutorial! Thank you!
Keep in mind it is a good idea to have a default directory for the private server client! It will be hard-coded and if the launcher cannot find the program it is looking for, it will not work! (ie. C:\Nexon\Maplestory\localhost.exe)
Little Info on VB .NET 2010
As most everyone here knows, Visual Basic is a language that allows you to visually construct a user interface by simply dragging and dropping controls onto a form. (The window that comes up when a program is run.)
Barebones:
So let's start simple. In Visual Studio .NET 2010 go ahead and open up a new Windows Forms Application.
Now you'll see something like this. I've already resized my form. You can do that by dragging the little white handles on the side of the form. I also went ahead and renamed my form. Inside the properties window, located to the right near the bottom, there is a property called "Text". Click that and type in what ever you want. Also, look for the property called "MaximizeBox" set this value to "False", we do not want people resizing this.
So now that our form is named and at a size we like, let's go ahead and add our shiny "Start" button. In order to add the button, we need our toolbox open, if it isn't up at the moment, go ahead and click the "View" drop-down window at the top of the Visual Studio Interface. Or if you're not a fan of clicking, go ahead and press CTRL + ALT + X.
The toolbox is now open. Don't be startled by what's there! It's actually pretty simple. Look carefully, the toolbox has been divided into categories. Now the button we are looking for is under the category "Common Controls."
Now simply by clicking on the text, the category will expand, revealing a numerous amount of controls available for your pleasure. Now all we need right now is the "Button" control. Go ahead and drag and drop the "Button" control from the toolbox onto your form.
When you click the button on your form, it becomes selected. The handles appear around it, allowing you to resize it. Go ahead and resize it to your liking. You may also drag the button around your form, so place it where you'd like as well.
Now since I assume the ones following this tutorial are not avid coders and may just be getting started, I am going to help you keep things organized.
When your button is selected, the properties of the button are now displayed in the properties window to the right. Look for the "(Name)" property, currently this control is named "Button1". To practice good organization in our code, let's go ahead and change that to something like "btnStart". Controls in Visual Basic can be better identified by renaming them, since the name is what we use in the code.
Scroll down to the "Text" property in the properties window for the button and change it to something like "Start Game".
Now our form is clean and easily accessible to any player that utilizes it!
Coding the Start Button:
Now we will be adding code to "btnStart", so to access the coding window, simply double click the button we created earlier. A new window will appear with the code:
Code:
Public Class Form1
Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click
End Sub
End Class
This simply shows where the code is running. Your cursor will be underneath the Private Sub and above the End Sub. This is where we will tell the program what to do when the button is clicked.
First we need to create a String Variable. This string will tell the program where the client is when the button is pressed. To declare a variable we must type in:
Code:
Dim directory As String
Now that the variable is declared we must let the program know what Directory is. To do this, type this:
Code:
directory = "C:\Nexon\Maplestory\localhost.exe\"
NOTE: If you plan to have players install Maplestory elsewhere, place that directory in, instead of the one I provided!
The program now knows what it will be executing, but we must now tell it how to get there. This code may seem a little bit weird, but it is basically the equivalent of double-clicking the localhost to make it run. The code required is as follows:
Code:
System.Diagnostics.Process.Start(directory)
Now press F5 to test out your simple launcher. When the button is pressed, the localhost client should run.
To finish up, let's have the launcher close after the localhost starts up. To do this we must simply add this:
Code:
End
Simple enough? So what does it all look like?
Full Code So Far:
Code:
Public Class Form1
Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click
Dim directory As String
directory = "C:\Nexon\Maplestory\localhost.exe"
System.Diagnostics.Process.Start(directory)
End
End Sub
End Class
Thank you for reading my tutorial, this was the first part, I will be back to add more features to make your launcher both pretty and informative!
---------- Post added at 02:41 AM ---------- Previous post was at 02:40 AM ----------
Part Two!
Obviously this just won't make the cut for the big league servers, am I right?
So why don't we kick it into a higher gear. In this second part of the tutorial, we are going to add some tabs to the form that will allow you to view some news and even register straight from the launcher itself! So let's get started, shall we?
Little Introduction:
I won't take as much time on this part of the tutorial to explain every little detail. I taught you how to reach the toolbox, and how to rename and change the text properties of different controls. So if you have questions, feel free to ask below.
Add the tab system:
Assuming you have your launcher program opened up, go over to your toolbox. Look for the "Containers" category, and select the "TabControl" control. Drag that over to your form, and position it to your liking using the handles.
Now in the properties window, go ahead and rename the control using the "(Name)" property. Also, don't forget to change your tab names. You can do this by going to the "TabPages" property in the properties window. It will open this window:
Change the "Text" properties to "Server News" and "Registration". After that, click the "Registration" Tab on your form, when it is selected, we are going to add a "WebBrowser" control.
If this control is not currently under the category "All Windows Forms", we will have to add it. To do this right click inside the ToolBox, then select "Choose Items..." In the "Filter" text box, type in "WebBrowser" check the box, and press "Okay". Now the control should be added to your toolbox.
Drag and drop the newly added "WebBrowser" control to the "Registration" tab. There should now be a white box, with a grayed out scroll bar in the tab window. If it is not already selected, select it. Go to properties and find the property for "URL". Add the URL of your server's registration page. This will allow players access to your server's registration page, from the launcher. Allowing them to easily register, and begin playing.
Next will be adding information to the "Server News" tab. Here I am giving you two options. You may either do what we had previously done for the "Registration" tab, adding a "WebBrowser" control, and giving it the URL of a news page on your website, or we can add a text window, that you can update in each new Launcher update. My preferred choice would be to redirect to a news page. In my case, a twitter feed.
So let's just say we chose to just add a text window. Here's how to do it.
Select your "Server News" tab, this tab should be empty, completely gray. Now go to your toolbox and locate the "TextBox" control under the "Common Controls" category. Drag this to the "Server News" tab, and resize it to fill to the dotted-line. In order to keep people from tinkering with the news you've added, go to the properties of the TextBox. Locate the "ReadOnly" property, and change its value from "False" to "True". Now let's add a scrollbar for good measure. Locate the "ScrollBars" property in the TextBox property menu. Change its value from "None" to "Vertical".
The textbox is now correctly set up, now we just need to add some news to it! To do this once again go to the properties window of the TextBox. Locate the "Text" property, and enter some news. To be formal, it makes sense to include a date, and a topic.
That's all for now, here is a finished picture of the code so far, and the appearance of the WebBrowser in action.
There is no code involved in this update, just a brief little tutorial on how to make the launcher more useful to its users. I plan to work out a new tutorial on how to get your launcher to display the server status next. Hang in there! This is still my first tutorial, I am trying to be helpful!
Last edited by a moderator: