Visual Studio VB.Net tutorial.
I will be Visual Studio .Net thought this tutorial. You can download the Express version for free from Microsoft’s website.
http://www.microsoft.com/express/Downloads/
Alright Lets dive into the tutorial. Assuming you already have visual studio installed. Keeping in mind I am using Visual Studio 2008 Professional.
Goto:
/File/New Project…
From the new project window, we are going to start a Windows Forms Application. Name your Application; I will refer to my application as SC2Tutorial1.
You have now created your first Application. It has everything it needs to compile. The downfall being its an empty Windows Form.
When our project if first started, it is saved to a temp file location. I would suggest following these steps.
Select the name “SC2Tutorial” at the top of the Solution Explorer window. Then From the “File” menu Drop-Down select Save “SC2Tutorial As”. I locate all my programs sub folder from C:\Programming\
You can pick appropriate names, and I would suggest keeping the check box checked. It keeps the project neat, and allows space for things associated but should not be inside the Solution folders.
From the Tool Menu on the Left, we will need a couple things added to our Form.
Button1Textbox1Textbox2Textbox3Label1Label2Label3
With the Form selected, the “Properties” window shows all customizable setting for our windows form. The same can be said if we selected a Textbox Label or Button. I will refer to the properties window throughout the tutorial for changing settings. Let’s start off by changing the Text Property of the form from “Form1” to “SC2Tutorial”.
We will continue to make changes to the properties of our form to match the following.
We also need to rearrange our form, and controls. By moving and resizing the items. Our form should look like the following when finished.
For this tutorial we need Data. The type of Data is up to you, I am going to be using all the “World of Warcraft” Instances, and Level Requirements.
The first step before we start writing our program. I would like to take us to the SC2 Map Editor. We need to understand how to read the required Values for our custom Script.
From our list of Values, we will be entering 2 types of data. String for the instance Name, and Integer for the Level Required. We will also need a Test Trigger to hold what will later be our custom script.
After Creating the variables, trigger, and setting the first instance of the variable arrays. We goto the “DATA” drop down menu, and select “View Script”. Scroll down to where our arrays index 0 is set to a value.
We are only interested in these two lines of script.
We will be generating the custom script to fill these values for us.
Back to visual studio.
We are going to need the run button to start our program. So by double clicking on the Run button (Button1). Visual studio will give us the event on button click event. All of our code will lie between Private Sub, and End Sub. To be simple in the tutorial, all variables will be created with the Sub.
Without explaining all restrictions in strings, we come to a problem where Double Quotes(“) are not allowed in our code. In order to represent Double Quotes in our custom script as text, we need to use character codes instead. So I have replaced the Double Quotes with Character Code 34, and rejoined the string at the character code break.
And that’s it, now we can run our program, and start generating Custom Script code for Galaxy. From the debugging drop down in visual studio, click (Start Debugging)
Name our variable; I am using the name “WOWInstances”.
Paste in our Values.
Click the run button.
From here we can go back to SC2 Map Editor, and create our trigger with custom script.
We use the action “customscriptaction” in order to write our custom script code into the editor.
You could place the custom script anywhere, but for this example I will fire it in a test trigger with TriggerExecute action.
Now when the map starts up, our variables WOWInstances, and Level are filled with their respective values.
Technically is 'something' but in reality no one will use this.
Why: Because it's take additional effort up front.
This have no real connection to Galaxy as those are simple text operations.
You can achieve same using for example my Incremental Replacer (no self promotion intended) or Notepad++ if you spend a while to learn syntax.
Further explanation: Unless you expand application further (which mean's you already have programming knowledge so you don't really need tutorial) it will remain as single task based where you after all need to type, like in example, list of values and only easy party is to not copy paste variable name?
Above leads to easier method of copy-paste (using example) 'gv_WOWInstances[0] = "something" ' where "something" have to be typed anyway and just replacing [0] with [n] all using mentioned apps for example.
I'm sorry if this looks like criticism but i felt like i really need to point this out.
Visual Studio VB.Net tutorial. I will be Visual Studio .Net thought this tutorial. You can download the Express version for free from Microsoft’s website. http://www.microsoft.com/express/Downloads/
For those wanting to use C# or wanting to convert between VB.net and C#. Developer Fusion is an automated website for doing this. http://www.developerfusion.com/tools/convert/csharp-to-vb/
Alright Lets dive into the tutorial. Assuming you already have visual studio installed. Keeping in mind I am using Visual Studio 2008 Professional.
Goto:
/File/New Project…
From the new project window, we are going to start a Windows Forms Application. Name your Application; I will refer to my application as SC2Tutorial1.
You have now created your first Application. It has everything it needs to compile. The downfall being its an empty Windows Form.
When our project if first started, it is saved to a temp file location. I would suggest following these steps.
Select the name “SC2Tutorial” at the top of the Solution Explorer window. Then From the “File” menu Drop-Down select Save “SC2Tutorial As”. I locate all my programs sub folder from C:\Programming\
You can pick appropriate names, and I would suggest keeping the check box checked. It keeps the project neat, and allows space for things associated but should not be inside the Solution folders.
From the Tool Menu on the Left, we will need a couple things added to our Form.
With the Form selected, the “Properties” window shows all customizable setting for our windows form. The same can be said if we selected a Textbox Label or Button. I will refer to the properties window throughout the tutorial for changing settings. Let’s start off by changing the Text Property of the form from “Form1” to “SC2Tutorial”.
We will continue to make changes to the properties of our form to match the following.
Now from the properties window, we are going to make some settings changes to the behavior of out textbox’s
We also need to rearrange our form, and controls. By moving and resizing the items. Our form should look like the following when finished.
For this tutorial we need Data. The type of Data is up to you, I am going to be using all the “World of Warcraft” Instances, and Level Requirements.
The first step before we start writing our program. I would like to take us to the SC2 Map Editor. We need to understand how to read the required Values for our custom Script.
From our list of Values, we will be entering 2 types of data. String for the instance Name, and Integer for the Level Required. We will also need a Test Trigger to hold what will later be our custom script.
After Creating the variables, trigger, and setting the first instance of the variable arrays. We goto the “DATA” drop down menu, and select “View Script”. Scroll down to where our arrays index 0 is set to a value.
We are only interested in these two lines of script.
We will be generating the custom script to fill these values for us.
Back to visual studio. We are going to need the run button to start our program. So by double clicking on the Run button (Button1). Visual studio will give us the event on button click event. All of our code will lie between Private Sub, and End Sub. To be simple in the tutorial, all variables will be created with the Sub.
Without explaining all restrictions in strings, we come to a problem where Double Quotes(“) are not allowed in our code. In order to represent Double Quotes in our custom script as text, we need to use character codes instead. So I have replaced the Double Quotes with Character Code 34, and rejoined the string at the character code break.
I need to also note that in order to add line feeds (New Text Line) we need to use 2 character codes at the end of our string. Chr(13) & chr(10)
After enter in all the code. The form code should look like this.
When the button is clicked the code is executed in this order.
And that’s it, now we can run our program, and start generating Custom Script code for Galaxy. From the debugging drop down in visual studio, click (Start Debugging)
Name our variable; I am using the name “WOWInstances”.
Paste in our Values.
Click the run button.
From here we can go back to SC2 Map Editor, and create our trigger with custom script.
We use the action “customscriptaction” in order to write our custom script code into the editor.
You could place the custom script anywhere, but for this example I will fire it in a test trigger with TriggerExecute action.
Now when the map starts up, our variables WOWInstances, and Level are filled with their respective values.
Here is a link to the Asset when its approved.
http://www.sc2mapster.com/assets/sc2-galaxy-code-generator-tutori/
Thanks you for reading my quick and dirty Visual Studio Galaxy Code example.
Happy Coding,
Sldprt (ItsAboutTime)
Very helpful
You wrote that up pretty swiftly, and it looks pretty good too.
I hope you'll do a couple more of these :)
I have no idea what to say :o
@slaydon: Go
You could post something in my new thread.
A Galaxy Rumble was [Felt]
http://forums.sc2mapster.com/development/galaxy-scripting-and-trigger-lib/14618-a-galaxy-rumble-was-felt/
EDIT: Wow so necro, Forgive!!
Technically is 'something' but in reality no one will use this.
Why: Because it's take additional effort up front.
You can achieve same using for example my Incremental Replacer (no self promotion intended) or Notepad
++
if you spend a while to learn syntax.I'm sorry if this looks like criticism but i felt like i really need to point this out.