| Mirage Source http://miragesource.net/forums/ |
|
| IPconfig http://miragesource.net/forums/viewtopic.php?f=210&t=1509 |
Page 1 of 1 |
| Author: | Braydok [ Tue Mar 13, 2007 11:29 pm ] |
| Post subject: | IPconfig |
There is a tutorial that grimsk8er posted a long time ago, but it does not work. Could someone please post a cut & paste tut? ~elec |
|
| Author: | Xlithan [ Wed Mar 14, 2007 2:44 pm ] |
| Post subject: | |
I thought you could code? If nobody posts a solution within the next hour, i'll write it for you. |
|
| Author: | Braydok [ Wed Mar 14, 2007 6:02 pm ] |
| Post subject: | |
I can, and I tried to make it work, but when reading from a file, it only read 127 and stopped at the period. I am very confuzled. |
|
| Author: | Reece [ Wed Mar 14, 2007 7:06 pm ] |
| Post subject: | |
post the code =/ |
|
| Author: | Xlithan [ Wed Mar 14, 2007 11:20 pm ] |
| Post subject: | |
put this in an ini file somewhere: Code: [IPCONFIG] IP=127.0.0.1 PORT=4000 load up the client project. Somewhere in modDatabase, add this: Code: Public Function GetVar(File As String, _ Header As String, _ Var As String) As String Dim sSpaces As String ' Max string length Dim szReturn As String ' Return default value if not found szReturn = vbNullString sSpaces = Space$(5000) GetPrivateProfileString Header, Var, szReturn, sSpaces, Len(sSpaces), File GetVar = RTrim$(sSpaces) GetVar = Left$(GetVar, Len(GetVar) - 1) End Function Code: Public Sub PutVar(File As String, _ Header As String, _ Var As String, _ Value As String) WritePrivateProfileString Header, Var, Value, File End Sub That will allow you to read and write to ini files. In Sub TCPInit, replace this: Code: frmMirage.Socket.RemoteHost = GAME_IP frmMirage.Socket.RemotePort = GAME_PORT With this: Code: Dim filename As String
filename = App.Path & "\config.ini" frmMirage.Socket.RemoteHost = GetVar(filename, "IPCONFIG", "IP") frmMirage.Socket.RemotePort = Val(GetVar(filename, "IPCONFIG", "PORT")) Not tested, so tell me if you get any errors. When you make your IP Config form (If you make one), use the PutVar call to write to the ini file. |
|
| Author: | Braydok [ Thu Mar 15, 2007 12:40 am ] |
| Post subject: | |
Thanks. |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|