Page 1 of 1
Dynamic Spawn Creator
Posted: Mon Feb 11, 2013 10:05 pm
by thefoof
I decided to try my hand at some coding because I got an idea for a tool I thought would be useful for me, so without knowing a language; and a ton of google use (don't expect this to be efficient!) Here is my Group Linker

(written in Visual Basic.NET 2010)
Features: takes up to 10 spawn group ID's and associates all of them to eachother.
Connection Test
Clear All button (zazzy!)
Add Spawn Chances
This is my first program but it is functional. Enjoy
If you feel something should be added/changed let me know. I may consider adding a checkbox to just add spawn chances or option to change output to a text file.
Re: Dynamic Spawn Creator
Posted: Tue Feb 12, 2013 6:58 am
by John Adams
Hah, that's awesome. Far better than me for your first try
Do yourself a favor tho, learn C#. VB is so 2003

sooo much easier to work with (imo) and looks sharp on a resume'.
btw, I just now realized I (again) whacked my authz file for SVN when I did my maintenance the other day, so let me know if any permissions are missing. You should be able to commit to eq2tools, should you choose to do so.
Re: Dynamic Spawn Creator
Posted: Tue Feb 12, 2013 4:57 pm
by thefoof
I think my write access got wiped, I can login but get an error when I try to add the folder. Finished it up fully though now so spawn chances work
Also a couple folders in the tools trunk are hidden if you are logged in anonymous fyi, not sure if it was like that before
Re: Dynamic Spawn Creator
Posted: Tue Feb 12, 2013 5:15 pm
by Jabantiz
For your first program that is really good work.
I also favor C# but the first language I learned was C++ wich made C# easy to pick up.
If you have any general programing questions I will do my best to help, sadly I haven't used VB in years so I'm affraid I won't be much help with VB specific questions.
Re: Dynamic Spawn Creator
Posted: Tue Feb 12, 2013 8:42 pm
by John Adams
thefoof wrote:Also a couple folders in the tools trunk are hidden if you are logged in anonymous fyi, not sure if it was like that before
Yeah, not all Tools were supposed to be released. They either aren't ready, or I didn't get approval to add them (just put them there so I wouldn't lose them).
You have read/write access. No idea why it's not letting you add a folder. Maybe wipe your local copy, re-checkout and move your folder back in, Add, Commit? cache could be corrupt from the redo.
Re: Dynamic Spawn Creator
Posted: Tue Feb 12, 2013 10:43 pm
by thefoof
Okay so, I checked out again to a new folder, same error. Updated tort svn same thing, not sure what else to do (i'm able to add but when I go to commit this happens). here is the error message:

Re: Dynamic Spawn Creator
Posted: Wed Feb 13, 2013 11:38 am
by John Adams
Oh ffs... sometimes I think I left my brain next to my teeth on the nightstand. Sorry... I added the SVN group to permissions, but forgot to add you to the group
Give it another try.

Re: Dynamic Spawn Creator
Posted: Wed Feb 13, 2013 11:57 am
by thefoof
Worked that time thanks

Re: Dynamic Spawn Creator
Posted: Tue Feb 19, 2013 6:33 am
by alfa
Great work, some points, if it can help you.
In Dynamic1 it is better to use select case unstead of if elseif it better cause your code dont have to check all if to go on the good thing. It point directly to good case
Code: Select all
Select Case Cint(ComboBox1.Text)
Case 2
TextBox1.Enabled = True
TextBox2.Enabled = True
TextBox3.Enabled = False
TextBox4.Enabled = False
TextBox5.Enabled = False
TextBox6.Enabled = False
TextBox7.Enabled = False
TextBox8.Enabled = False
TextBox9.Enabled = False
TextBox10.Enabled = False
SpawnBox1.Enabled = True
SpawnBox2.Enabled = True
SpawnBox3.Enabled = False
SpawnBox4.Enabled = False
SpawnBox5.Enabled = False
SpawnBox6.Enabled = False
SpawnBox7.Enabled = False
SpawnBox8.Enabled = False
SpawnBox9.Enabled = False
SpawnBox10.Enabled = False
Case 3
TextBox1.Enabled = True
TextBox2.Enabled = True
TextBox3.Enabled = True
TextBox4.Enabled = False
TextBox5.Enabled = False
TextBox6.Enabled = False
TextBox7.Enabled = False
TextBox8.Enabled = False
TextBox9.Enabled = False
TextBox10.Enabled = False
SpawnBox1.Enabled = True
SpawnBox2.Enabled = True
SpawnBox3.Enabled = True
SpawnBox4.Enabled = False
SpawnBox5.Enabled = False
SpawnBox6.Enabled = False
SpawnBox7.Enabled = False
SpawnBox8.Enabled = False
SpawnBox9.Enabled = False
SpawnBox10.Enabled = False
Case 4
TextBox1.Enabled = True
TextBox2.Enabled = True
TextBox3.Enabled = True
TextBox4.Enabled = True
TextBox5.Enabled = False
TextBox6.Enabled = False
TextBox7.Enabled = False
TextBox8.Enabled = False
TextBox9.Enabled = False
TextBox10.Enabled = False
SpawnBox1.Enabled = True
SpawnBox2.Enabled = True
SpawnBox3.Enabled = True
SpawnBox4.Enabled = True
SpawnBox5.Enabled = False
SpawnBox6.Enabled = False
SpawnBox7.Enabled = False
SpawnBox8.Enabled = False
SpawnBox9.Enabled = False
SpawnBox10.Enabled = False
Case 5
TextBox1.Enabled = True
TextBox2.Enabled = True
TextBox3.Enabled = True
TextBox4.Enabled = True
TextBox5.Enabled = True
TextBox6.Enabled = False
TextBox7.Enabled = False
TextBox8.Enabled = False
TextBox9.Enabled = False
TextBox10.Enabled = False
SpawnBox1.Enabled = True
SpawnBox2.Enabled = True
SpawnBox3.Enabled = True
SpawnBox4.Enabled = True
SpawnBox5.Enabled = True
SpawnBox6.Enabled = False
SpawnBox7.Enabled = False
SpawnBox8.Enabled = False
SpawnBox9.Enabled = False
SpawnBox10.Enabled = False
Case 6
TextBox1.Enabled = True
TextBox2.Enabled = True
TextBox3.Enabled = True
TextBox4.Enabled = True
TextBox5.Enabled = True
TextBox6.Enabled = True
TextBox7.Enabled = False
TextBox8.Enabled = False
TextBox9.Enabled = False
TextBox10.Enabled = False
SpawnBox1.Enabled = True
SpawnBox2.Enabled = True
SpawnBox3.Enabled = True
SpawnBox4.Enabled = True
SpawnBox5.Enabled = True
SpawnBox6.Enabled = True
SpawnBox7.Enabled = False
SpawnBox8.Enabled = False
SpawnBox9.Enabled = False
SpawnBox10.Enabled = False
Case 7
TextBox1.Enabled = True
TextBox2.Enabled = True
TextBox3.Enabled = True
TextBox4.Enabled = True
TextBox5.Enabled = True
TextBox6.Enabled = True
TextBox7.Enabled = True
TextBox8.Enabled = False
TextBox9.Enabled = False
TextBox10.Enabled = False
SpawnBox1.Enabled = True
SpawnBox2.Enabled = True
SpawnBox3.Enabled = True
SpawnBox4.Enabled = True
SpawnBox5.Enabled = True
SpawnBox6.Enabled = True
SpawnBox7.Enabled = True
SpawnBox8.Enabled = False
SpawnBox9.Enabled = False
SpawnBox10.Enabled = False
Case 8
TextBox1.Enabled = True
TextBox2.Enabled = True
TextBox3.Enabled = True
TextBox4.Enabled = True
TextBox5.Enabled = True
TextBox6.Enabled = True
TextBox7.Enabled = True
TextBox8.Enabled = True
TextBox9.Enabled = False
TextBox10.Enabled = False
SpawnBox1.Enabled = True
SpawnBox2.Enabled = True
SpawnBox3.Enabled = True
SpawnBox4.Enabled = True
SpawnBox5.Enabled = True
SpawnBox6.Enabled = True
SpawnBox7.Enabled = True
SpawnBox8.Enabled = True
SpawnBox9.Enabled = False
SpawnBox10.Enabled = False
Case 9
TextBox1.Enabled = True
TextBox2.Enabled = True
TextBox3.Enabled = True
TextBox4.Enabled = True
TextBox5.Enabled = True
TextBox6.Enabled = True
TextBox7.Enabled = True
TextBox8.Enabled = True
TextBox9.Enabled = True
TextBox10.Enabled = False
SpawnBox1.Enabled = True
SpawnBox2.Enabled = True
SpawnBox3.Enabled = True
SpawnBox4.Enabled = True
SpawnBox5.Enabled = True
SpawnBox6.Enabled = True
SpawnBox7.Enabled = True
SpawnBox8.Enabled = True
SpawnBox9.Enabled = True
SpawnBox10.Enabled = False
Case 10
TextBox1.Enabled = True
TextBox2.Enabled = True
TextBox3.Enabled = True
TextBox4.Enabled = True
TextBox5.Enabled = True
TextBox6.Enabled = True
TextBox7.Enabled = True
TextBox8.Enabled = True
TextBox9.Enabled = True
TextBox10.Enabled = True
SpawnBox1.Enabled = True
SpawnBox2.Enabled = True
SpawnBox3.Enabled = True
SpawnBox4.Enabled = True
SpawnBox5.Enabled = True
SpawnBox6.Enabled = True
SpawnBox7.Enabled = True
SpawnBox8.Enabled = True
SpawnBox9.Enabled = True
SpawnBox10.Enabled = True
Case Else
TextBox1.Enabled = False
TextBox2.Enabled = False
TextBox3.Enabled = False
TextBox4.Enabled = False
TextBox5.Enabled = False
TextBox6.Enabled = False
TextBox7.Enabled = False
TextBox8.Enabled = False
TextBox9.Enabled = False
TextBox10.Enabled = False
SpawnBox1.Enabled = False
SpawnBox2.Enabled = False
SpawnBox3.Enabled = False
SpawnBox4.Enabled = False
SpawnBox5.Enabled = False
SpawnBox6.Enabled = False
SpawnBox7.Enabled = False
SpawnBox8.Enabled = False
SpawnBox9.Enabled = False
SpawnBox10.Enabled = False
End Select
For your MySQL connexion use ConnectionStringBuilder (if some server are different MySQL Connector fix it)
Code: Select all
Dim conncStringBuild As New MySql.Data.MySqlClient.MySqlConnectionStringBuilder
Dim conncString As String
conncStringBuild.Server = TextBox3.Text 'Define Server Host
conncStringBuild.UserID = TextBox4.Text 'Define User
conncStringBuild.Password = TextBox2.Text 'Define Pass
conncStringBuild.Database = TextBox1.Text 'Define Database
conncString = conncStringBuild.GetConnectionString(True)
Use parameters for your query it automaticly fix some cool things like decimal separator, date, string ' char...
Code: Select all
spwn.Connection = Conn
spwn.Parameters.AddWithValue("@group_id", TextBox1.Text)
spwn.Parameters.AddWithValue("@percentage", SpawnBox1.Text)
spwn.CommandText = "INSERT INTO spawn_location_group_chances (group_id,percentage) VALUES (@group_id, @percentage);"
And last, prevent user to type char in your textboxs (add this event on TextBox KeyPress)
Code: Select all
Private Sub TextBoxKeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs)
'If not digit Handled event
If Char.IsDigit(e.KeyChar) = False And Asc(e.KeyChar) <> System.Windows.Forms.Keys.Back Then e.Handled = True
End Sub
You can also do it with decimal
Code: Select all
Private Sub TextBoxKeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs)
If Asc(e.KeyChar) = 46 Then e.KeyChar = "," 'Check we have good separator
If Asc(e.KeyChar) = 44 And (CType(sender, TextBox).Text.IndexOf(",") > 0 Or CType(sender, TextBox).Text = "") Then e.Handled = True
If Char.IsDigit(e.KeyChar) = False And Asc(e.KeyChar) <> System.Windows.Forms.Keys.Back And Asc(e.KeyChar) <> 44 Then e.Handled = True
End Sub
Hope it can help you

Re: Dynamic Spawn Creator
Posted: Tue Feb 19, 2013 9:10 pm
by thefoof
Thanks for the advice alfa, any info is useful to me really heh, I just built this on a whim so I didn't really have any knowledge of the language I just figured that I knew enough about computer theory to get it done with a lot of research =p
Re: Dynamic Spawn Creator
Posted: Wed Feb 20, 2013 11:57 am
by alfa
Anyone have to learn, that's why I post it for you
