PDA

View Full Version : Vb.net



DEATH
06-16-2008, 03:51 AM
Say someone wanted to make a program that would announce server information into the C4 Chat pane. What would be the best language to something like this in? Is it at all possible in VB.NET and if so are there any examples? :help:

Bluetiereign
06-16-2008, 11:12 PM
You should be able to do it with VB.net. Chancellor's Coding (http://chancellorscode.com/forum/index.php) is great place to ask coding questions. He also had a an Active X (.ocx) memory controller that would tap into Nova's games and give commands like the one you seem to be asking about.

DEATH
06-17-2008, 01:31 AM
Thanks, Im gunna check that out right now.:thumb:

Reaper
06-18-2008, 12:21 AM
The only way I was able to do this was with a macro program that created a stand alone macro file that when enabled would play computer key and mouse strokes.

I recorded the text message then would set the time to repeat the macro. Any time I ran a dedicated server I would start the server and once the maps started, then I would start the macro.

I worked very well.

DEATH
06-18-2008, 04:15 AM
The only way I was able to do this was with a macro program that created a stand alone macro file that when enabled would play computer key and mouse strokes.

I recorded the text message then would set the time to repeat the macro. Any time I ran a dedicated server I would start the server and once the maps started, then I would start the macro.

I worked very well.

Thats a really good idea. The only problem that stands in my way is actually finding a good macro program. The only ones I get are either trial versions and if not that they are junk.

This is something that was recomended to me. They said that it might work for C4. I've barely looked at it right now but I guess I have to look at mem addresses?



Option Explicit
Private Declare Function GetTickCount Lib "kernel32" () As Long 'Windows API that returns a unique time in millisecond resolution

Private Sub sendtexttogame(strResult As String)
Dim tType As Integer
Dim tmpByte As Byte
Dim tmpText As Long
Dim TimeoutLimit, StartTime, NowTime As Long

objMem.AttachProcess ' attaches to my opened process
If objMem.ReadDataBYTE(&H9D7B80) = 1 Then ' checks to see if map is running
If objMem.ReadDataBYTE(&H875E58) <> 1 Then ' makes sure the console is not open
Call objMem.SendKey(192) ' sends the ~ key
TimeoutLimit = 6000 ' sets the timeout to 6 seconds
StartTime = GetTickCount ' Sets the start time using the API call
Do Until tmpByte = 1 ' Loops untill the console opens
NowTime = GetTickCount ' sets the current time using the API call
If NowTime >= StartTime + TimeoutLimit Then Exit Do ' Exits the loop if current time is equal or greater than the start time plus the timeoutlimit
tmpByte = objMem.ReadDataBYTE(&H875E58) ' reads the byte that says whether the console is opened or closed
Loop ' Loops
tmpText = 0 ' sets the text lentgh to 0
Call objMem.WriteDataSTRING(&H875D2C, "talk", 4) ' write the word talk to the console
StartTime = GetTickCount ' Sets the start time using the API call
Do Until tmpText = 4 ' Loop until lentgh of text in console = 4
NowTime = GetTickCount ' sets the current time using the API call
If NowTime >= StartTime + TimeoutLimit Then Exit Do ' Exits the loop if current time is equal or greater than the start time plus the timeoutlimit
tmpText = Len(Left(objMem.ReadDataSTRING(&H875D2C, 60), InStr(1, objMem.ReadDataSTRING(&H875D2C, 60), Chr(0)) - 1)) ' Reads the lentgh of the text in console
Loop ' Loops
Call objMem.SendKey(13) ' sends return key
StartTime = GetTickCount ' Sets the start time using the API call
Do Until tmpText = 0 ' Loop until lentgh of text in console = 0, clear console
NowTime = GetTickCount ' sets the current time using the API call
If NowTime >= StartTime + TimeoutLimit Then Exit Do ' Exits the loop if current time is equal or greater than the start time plus the timeoutlimit
tmpText = Len(Left(objMem.ReadDataSTRING(&H875D2C, 60), InStr(1, objMem.ReadDataSTRING(&H875D2C, 60), Chr(0)) - 1)) ' Reads the lentgh of the text in console
Loop ' Loops
Call objMem.WriteDataSTRING(&H875D2C, strResult, Len(strResult)) ' Writes the string to the console
StartTime = GetTickCount ' Sets the start time using the API call
Do Until tmpText = Len(strResult) ' Loop until lentgh of text in console = length of our string
NowTime = GetTickCount ' sets the current time using the API call
If NowTime >= StartTime + TimeoutLimit Then Exit Do ' Exits the loop if current time is equal or greater than the start time plus the timeoutlimit
tmpText = Len(Left(objMem.ReadDataSTRING(&H875D2C, 60), InStr(1, objMem.ReadDataSTRING(&H875D2C, 60), Chr(0)) - 1)) ' Reads the lentgh of the text in console
Loop ' Loops
Call objMem.SendKey(13) ' sends return key
tmpText = 0 ' sets the text lentgh to 0
Else
Call objMem.SendKey(13) ' sends return key if we found the console open
End If
End If
objMem.DetachProcess ' detaches from the open process
End Sub