| View previous topic :: View next topic |
| Author |
Message |
KrazyFK Newbie cheater
Reputation: 0
Joined: 02 Sep 2007 Posts: 14 Location: Earth
|
Posted: Thu Sep 13, 2007 2:00 pm Post subject: Help VB6 |
|
|
For all you who downloaded my CodeCracker program (link below and scroll down) i have a question.
http://forum.cheatengine.org/viewtopic.php?t=129197
How could i change it so for example if sum1 had 3 squares the right colour then 3 squares at the top of the screen would light up green but they wouldnt know which ones were correct (similar to mastermind).
|
|
| Back to top |
|
 |
Stalkeer Cheater
Reputation: 0
Joined: 24 Aug 2007 Posts: 26
|
Posted: Thu Sep 13, 2007 2:27 pm Post subject: |
|
|
I didnt understand all you said
but something like this?
[edit] This is the Try Code Button.
| Code: |
Private Sub Command5_Click()
If Shape1.FillColor = &HFFFF& Then
Shape8.FillColor = &H8000&
Else
Shape8.FillColor = &HFF&
End If
If Shape2.FillColor = &H8000& Then
Shape7.FillColor = &H8000&
Else
Shape7.FillColor = &HFF&
End If
If Shape3.FillColor = &H8000& Then
Shape6.FillColor = &H8000&
Else
Shape6.FillColor = &HFF&
End If
If Shape4.FillColor = &HFF0000 Then
Shape5.FillColor = &H8000&
Else
Shape5.FillColor = &HFF&
End If
End Sub
|
|
|
| Back to top |
|
 |
KrazyFK Newbie cheater
Reputation: 0
Joined: 02 Sep 2007 Posts: 14 Location: Earth
|
Posted: Thu Sep 13, 2007 2:46 pm Post subject: |
|
|
no i meant if any 3 were correct then 3 lights would be lit up like this
000XX
If they had any 1 correct it would be
0XXXX
Your way they know which one is correct and i dont want them to which one is correct but only that they have one correct. but thx anyway.
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Thu Sep 13, 2007 4:01 pm Post subject: |
|
|
| KrazyFK wrote: | no i meant if any 3 were correct then 3 lights would be lit up like this
000XX
If they had any 1 correct it would be
0XXXX
Your way they know which one is correct and i dont want them to which one is correct but only that they have one correct. but thx anyway. |
You could use split and/or mid functions to check each letter of the word that is entered. You would need to put your code in the textboxes change function or code a timer to do it. I suggest doing it in the textboxes change function though.
|
|
| Back to top |
|
 |
KrazyFK Newbie cheater
Reputation: 0
Joined: 02 Sep 2007 Posts: 14 Location: Earth
|
Posted: Thu Sep 13, 2007 11:57 pm Post subject: |
|
|
| im new to VB6 so is it possible for you to be a bit more in-depth?
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Fri Sep 14, 2007 12:08 am Post subject: |
|
|
| KrazyFK wrote: | | im new to VB6 so is it possible for you to be a bit more in-depth? |
Sure, make a new project as a standard exe. On the form add 1 text box for input. Add another textbox and set the property of multiline to true. And the code:
| Code: |
Private Sub Text1_Change()
On Error Resume Next
'// Clear The Debug Text
Text2.Text = ""
'// Store The Length Of The String
Dim iLength As Long
iLength = Len(Text1.Text)
'// Split The String Into Single Character Bytes
Dim szCharacters() As String
ReDim szCharacters(iLength)
'// Fill szCharacters With Data
Dim x As Long
For x = 0 To iLength
szCharacters(x) = Mid(Text1.Text, x, 1)
Next x
'// Show The Info For Debugging
Dim y As Long
For y = 1 To UBound(szCharacters)
Text2.Text = Text2.Text & "Char " & y & ": " & szCharacters(y) & vbCrLf
Next y
End Sub
|
|
|
| Back to top |
|
 |
KrazyFK Newbie cheater
Reputation: 0
Joined: 02 Sep 2007 Posts: 14 Location: Earth
|
Posted: Fri Sep 14, 2007 5:35 am Post subject: |
|
|
| I dont really understand what this does because my CodeCracker is colours.
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Fri Sep 14, 2007 10:26 am Post subject: |
|
|
| KrazyFK wrote: | | I dont really understand what this does because my CodeCracker is colours. |
You asked for code that checks each character they enter to see if it is the correct one for that spot in the string. The code I posted above breaks the string into single characters that allows you to check each letter by itself after that code is ran.
The spot in that code:
| Code: | '// Fill szCharacters With Data
Dim x As Long
For x = 0 To iLength
szCharacters(x) = Mid(Text1.Text, x, 1)
Next x |
Is when the string is cut into single characters and placed into the szCharacters Array, szCharacters(0) is the first character. szCharacters(1) would be the next.
You could do simple comparisons then with that doing something like:
| Code: | If szCharacters(0) = "A" Then
Shape1.FillColor = &H00FF00&
Else
Shape1.FillColor = &HFF0000&
End If |
|
|
| Back to top |
|
 |
KrazyFK Newbie cheater
Reputation: 0
Joined: 02 Sep 2007 Posts: 14 Location: Earth
|
Posted: Fri Sep 14, 2007 12:26 pm Post subject: |
|
|
Thx i found another way of doing it that i find easier but thx 4 ur hrlp anyway
I do basically the same thing (compare each colour with the real code) but i do it differently.
| Code: | For x = (0-4)
If userCode(x).Fill Color = realCode(x).FillColor Then
numCorrect = numCorrect + 1
End If
Next x |
etc.
Obviously i set the variables in declarations.
|
|
| Back to top |
|
 |
|