Jump to content

One Click To Combat for CMBB


Recommended Posts

Originally posted by hardcampa:

The reason to why the CDV version is causing trouble is probably because it wants to play some intro movie am I right on this?

If someone with the CDV version feels like a labrat. Let me know and I'll send you an updated version.

CDV version opens some other copy protection window first. It will take a while until it disappears. Things got even worse with 1.01, the delay must be much longer. I include the VBScript code here, it is converted from the original CMBO One Click C++ code, some things have changed, and it works quite well with the CDV version. I have some ideas how to make it even more reliable, though.

</font><blockquote>code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">' CMBB.VBS

Dim Width, Height

Dim m_PtJoin_x, m_PtJoin_y

Dim m_PtExit_x, m_PtExit_y

Dim m_PtLoad_x, m_PtLoad_y

Sub Main

ExeName = Program.GetDirectory + "\" + Program.GetExeName

pCMWnd = PBEM.PBEM_FindWindow(Program.GetLongName, vbNullString)

IF pCMWnd = 0 THEN

Program.Run 0

PBEM.PBEM_WaitForInputIdle 20000

i = 0

DO

pCMWnd = PBEM.PBEM_FindWindow(Program.GetLongName, vbNullString)

IF pCMWnd THEN

EXIT DO

END IF

i = i + 1

IF i > 2000 THEN

msgbox "Window '" + Program.GetLongName + "' not found"

Exit Sub

END IF

PBEM.PBEM_Sleep 10

LOOP

END IF

Dim i

For i = 0 to 10

PBEM.PBEM_PressButton pCMWnd, 1, 1 ' skip intro screen

PBEM.PBEM_Sleep 100

PBEM.PBEM_SendMessage pCMWnd, &H112, &HF120&, 0 ' WM_SYSCOMMAND, SC_RESTORE, 0

PBEM.PBEM_WaitForInputIdle 10000

Next

DetermineButtons pCMWnd

PBEM.PBEM_PressButton pCMWnd, m_PtJoin_x, m_PtJoin_y

PBEM.PBEM_PressButton pCMWnd, m_PtLoad_x, m_PtLoad_y

Dim pOpenWnd

For i = 0 To 200

pOpenWnd = PBEM.PBEM_FindWindow("#32770", vbNullString)

If pOpenWnd Then

Dim pTmpWnd

pTmpWnd = PBEM.PBEM_GetOwner(pOpenWnd)

If pTmpWnd Then

If pTmpWnd = pCMWnd Then

Exit For

End If

End If

pOpenWnd = 0

End If

PBEM.PBEM_Sleep 100

Next

IF pOpenWnd = 0 THEN

MsgBox Program.GetShortName & ": Error finding file open window!"

Exit Sub

END IF

'PBEM.PBEM_Sleep 1000 ' 400

PBEM.PBEM_WaitForInputIdle 10000

Dim hwnd

i = 0

Do

hwnd = PBEM.FindEditWindow(pOpenWnd)

If hwnd = 0 Then

MsgBox Program.GetShortName & ": Error finding file open window Edit control! (dialog=" & pOpenWnd & ")"

Exit Sub

End If

If PBEM.SetWindowText(hwnd, Game.GetRealName) Then

If PBEM.GetWindowText(hwnd) = Game.GetRealName Then

If PBEM.PBEM_PostMessage(hwnd, &H100, &HD, &H81C0001) Then ' WM_KEYDOWN, VK_RETURN, &H81C0001

Exit Do

End If

End If

End If

i = i + 1

If i > 100 Then

MsgBox Program.GetShortName & ": Error entering filename in dialog box! (dialog=" & pOpenWnd & ",hwnd=" & hwnd & ")"

Exit Sub

End If

PBEM.PBEM_Sleep 100

Loop

If PBEM.PBEM_ReadSetting(Program.GetShortName, "SendExtra") = "1" Then

PBEM.PBEM_PostMessage pCMWnd, &H102, 120, &H8000001' WM_CHAR, Asc("x"), &H8000001

Else

PBEM.PBEM_Sleep 2000

End If

PBEM.PBEM_PostString pCMWnd, Game.GetPassword

PBEM.PBEM_PostMessage pCMWnd, &H102, &HD, &H8000001 ' WM_CHAR, &HD, &H8000001

End Sub

Sub DetermineButtons(pCMWnd)

Dim L, R, T, B

PBEM.PBEM_GetWindowRect pCMWnd, L, R, T, B

Width = R - L

Height = B - T

If Width = 640 And Height = 480 Then

m_PtJoin_x = 160: m_PtJoin_y = 400

m_PtExit_x = 460: m_PtExit_y = 400

m_PtLoad_x = 320: m_PtLoad_y = 240

ElseIf Width = 720 And Height = 576 Then

m_PtJoin_x = 190: m_PtJoin_y = 450

m_PtExit_x = 520: m_PtExit_y = 450

m_PtLoad_x = 360: m_PtLoad_y = 285

ElseIf Width = 800 And Height = 600 Then

m_PtJoin_x = 210: m_PtJoin_y = 500

m_PtExit_x = 586: m_PtExit_y = 500

m_PtLoad_x = 400: m_PtLoad_y = 348

ElseIf Width = 960 And Height = 720 Then

m_PtJoin_x = 290: m_PtJoin_y = 560

m_PtExit_x = 666: m_PtExit_y = 560

m_PtLoad_x = 475: m_PtLoad_y = 400

ElseIf Width = 1024 And Height = 768 Then

m_PtJoin_x = 313: m_PtJoin_y = 670

m_PtExit_x = 700: m_PtExit_y = 670

m_PtLoad_x = 512: m_PtLoad_y = 460

ElseIf Width = 1152 And Height = 864 Then

m_PtJoin_x = 380: m_PtJoin_y = 716

m_PtExit_x = 766: m_PtExit_y = 716

m_PtLoad_x = 564: m_PtLoad_y = 506

ElseIf Width = 1280 And Height = 960 Then

m_PtJoin_x = 450: m_PtJoin_y = 760

m_PtExit_x = 830: m_PtExit_y = 760

m_PtLoad_x = 630: m_PtLoad_y = 550

ElseIf Width = 1280 And Height = 1024 Then

m_PtJoin_x = 450: m_PtJoin_y = 800

m_PtExit_x = 830: m_PtExit_y = 800

m_PtLoad_x = 630: m_PtLoad_y = 580

ElseIf Width = 1400 And Height = 1050 Then

m_PtJoin_x = 510: m_PtJoin_y = 810

m_PtExit_x = 900: m_PtExit_y = 810

m_PtLoad_x = 700: m_PtLoad_y = 605

ElseIf Width = 1600 And Height = 1200 Then

m_PtJoin_x = 620: m_PtJoin_y = 885

m_PtExit_x = 980: m_PtExit_y = 885

m_PtLoad_x = 800: m_PtLoad_y = 675

ElseIf Width = 1920 And Height = 1440 Then

m_PtJoin_x = 680: m_PtJoin_y = 1035

m_PtExit_x = 1240: m_PtExit_y = 1035

m_PtLoad_x = 960: m_PtLoad_y = 810

ElseIf Width = 2048 And Height = 1536 Then

m_PtJoin_x = 744: m_PtJoin_y = 1041

m_PtExit_x = 1304: m_PtExit_y = 1041

m_PtLoad_x = 1024: m_PtLoad_y = 630

Else

MsgBox "The resolution you are running " & Program.GetShortName & " at (" & Width & "x" & Height & ") is not supported."

End If

End Sub

Main</pre>

Link to comment
Share on other sites

Originally posted by Fuerte:

</font><blockquote>quote:</font><hr />Originally posted by Biltong:

</font><blockquote>quote:</font><hr />Originally posted by Fuerte:

Why bother? PBEM Helper probably already has those features.

Just curious - what position do you occupy at MicroSoft? </font>
Link to comment
Share on other sites

Originally posted by hardcampa:

Nice Fuerte thanx. Hope you understand my view better now.

A question. The CDV screens it opens, won't those dissappear if you send an escape (or 2) on the queue?

Just wondering if you've tried it?

The CDV screen disappears immediately after it has checked the copy protection, but it takes a while. Sending mouse clicks has the same effect as escape, it gets rid of the intro screen etc.
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...