Results 1 to 5 of 5

Thread: Vb.net

  1. #1
    CPD Member
    Join Date
    May 2008
    Posts
    5
    Downloads
    0
    Uploads
    0

    Vb.net

    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?

  2. #2
    Admin Bluetiereign's Avatar
    Join Date
    Aug 2002
    Posts
    2,555
    Downloads
    59
    Uploads
    3

    Re: Vb.net

    You should be able to do it with VB.net. Chancellor's Coding 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.

  3. #3
    CPD Member
    Join Date
    May 2008
    Posts
    5
    Downloads
    0
    Uploads
    0

    Re: Vb.net

    Thanks, Im gunna check that out right now.

  4. #4
    Admin Reaper's Avatar
    Join Date
    Oct 2002
    Location
    Nevada,USA
    Posts
    569
    Downloads
    3
    Uploads
    1

    Re: Vb.net

    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.

  5. #5
    CPD Member
    Join Date
    May 2008
    Posts
    5
    Downloads
    0
    Uploads
    0

    Re: Vb.net

    Quote Originally Posted by Reaper View Post
    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
    Last edited by DEATH; 06-18-2008 at 04:29 AM. Reason: Code

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •