Sup... I need some help in making my bot activate commands through whispering. Aight, that prolly didint make sence so let me vbreak i tdown for you. When i whisper the bot .ver , the bot will whisper back Version 1.2. I tryed using this code:
If username = username Then
If Left((LCase(message)), 5) = (Form4.txtTrigger.Text & "test"Then
saymessage = (Len(message) - 5)
If whisper = True Then
Send "/w " & username& " ---- OuTLawZ BoT"
ElseIf whisper = False Then
Send " ---- OuTLawZ BoT "
End If
End If
End If
______________________________________________________
Where is sais " If Whisper = True Then" , that line fo code does not work. but where is sais " If Whisper = False Then" , that line of code works. I typed in .ver sand it send " ---- OuTLawZ BoT ".
Please let me no if you can help...
L8terZ
Quote from: OuTLawZGoSu on August 01, 2003, 08:19 PM
Sup... I need some help in making my bot activate commands through whispering. Aight, that prolly didint make sence so let me vbreak i tdown for you. When i whisper the bot .ver , the bot will whisper back Version 1.2. I tryed using this code:
If username = username Then
If Left((LCase(message)), 5) = (Form4.txtTrigger.Text & "test"Then
saymessage = (Len(message) - 5)
If whisper = True Then
Send "/w " & username& " ---- OuTLawZ BoT"
ElseIf whisper = False Then
Send " ---- OuTLawZ BoT "
End If
End If
End If
______________________________________________________
Where is sais " If Whisper = True Then" , that line fo code does not work. but where is sais " If Whisper = False Then" , that line of code works. I typed in .ver sand it send " ---- OuTLawZ BoT ".
Please let me no if you can help...
L8terZ
its looking for "trigger & test" not .ver
try lcase(username) for non case sensative
Why is there a saymessage when you dont even need it?
for your whisper you mean...
if chkwhisper.value = 1 then
whisper = true
else
whisper= false
endif
?
Quote from: OuTLawZGoSu on August 01, 2003, 08:19 PM
If username = username Then
Is it supposed to be like that? That seems a little redundant because it seems redundant.
I'm positive this has been posted before, quite indepth aswell.
OK... now the code looks like this:
Case ID_TALK
AddC vbYellow, "<" & username & ">", vbWhite, message
If chkwhisper.Value = 1 Then
whisper = True
Else
whisper = False
End If
If username = username Then
If Left((LCase(message)), 5) = (Form4.txtTrigger.Text & "test") Then
If whisper = True Then
Send "/w " & LCase(username) & " ---- OuTLawZ BoT"
ElseIf whisper = False Then
Send " ---- OuTLawZ BoT "
End If
End If
End If
With this code, everyting under the "If chkwhisper.Value = 1 Then" does not work. PLz let me no wat im doing wrong.
Try changing
If chkwhisper.Value = 1 Then
whisper = True
Else
whisper = False
End If
to
If chkwhisper.Value = 1 Then
whisper = True
Else if chkWhisper.Value != 1 Then
whisper = False
End If
Quote from: Raven on August 02, 2003, 11:10 AM
If chkwhisper.Value = 1 Then
whisper = True
ElseIf chkWhisper.Value != 1 Then
whisper = False
End If
!= isn't a VB operator, you'll need to use <>
so it's :
If chkwhisper.Value = 1 Then
whisper = True
ElseIf chkWhisper.Value <> = 1 Then
whisper = False
End If
?
Quote from: OuTLawZGoSu on August 02, 2003, 01:10 PM
so it's :
If chkwhisper.Value = 1 Then
whisper = True
ElseIf chkWhisper.Value <> = 1 Then
whisper = False
End If
?
You don't need ElseIf chkWhisper.Value <> = 1 Then,
just use
Else
whisper = False
End If
yay jay
nope ... still not working, all commands under that code dont work.
Help?
if you need the ID_Talk code i gan post it. jus tlet me no...
Try this...
If chkwhisper.Value = "0" Then
whisper = True
Else
whisper = False
End If
Quote from: Dr.JaY on August 04, 2003, 07:29 AM
Try this...
If chkwhisper.Value = "0" Then
whisper = True
Else
whisper = False
End If
why put quote's around the 0 ?
Could just do it in one line.
Whisper = chkWhisper.value
*Expects massive toasting for helping*
Quote from: ___/\___ on August 11, 2003, 09:31 PM
Quote from: Dr.JaY on August 04, 2003, 07:29 AM
Try this...
If chkwhisper.Value = "0" Then
whisper = True
Else
whisper = False
End If
why put quote's around the 0 ?
Because it does the same thing..
Normally if two alternatives do the same thing, I'd pick the shorter one. How come you're not using
If chkwhisper.Value = 0 Then
whisper = True
Else
whisper = False
End If
or
whisper = chkwhisper.Value = 0
or
whisper = Not chkwhisper.Value
?
yeah I would rather use a short string than a million If statements, but that is just me..
Quote from: Adron on August 12, 2003, 11:34 AMwhisper = Not chkwhisper.Value
Not that it matters in this case, but it would be prudent to use Not CBool(chkWhisper.Value) as the VB Not function is bitwise not, not boolean not. Additionally, if chkwhisper.value was set to 2 (grayed), whisper would be set to -3 (or True if it's boolean) which may be undesired, even though I cant think of any reason you would want to do that do said checkbox.
Anyways, it's just something to keep in mind while using boolean Not/And/Or/Xor.
?not 0; not 1; not 2
-1 -2 -3
?cbool(not 0); cbool(not 1); cbool(not 2)
TrueTrueTrue
?not cbool(0); not cbool(1); not cbool(2)
TrueFalseFalse
Good point, I didn't think of that. It shall be =0 then, and that's equally short, so it's a perfectly good choice!
Quote from: Adron on August 12, 2003, 11:34 AMwhisper = chkwhisper.Value = 0
Once again, not that it matters, but I prefer:
whisper = (chkwhisper.Value = 0)
as VB has no == operator. In c, the same code would set both the values of whisper and chkwhisper.Value to zero, but in VB the = operator is used for both value assignment and comparison.
Wow! How can so many people be so wrong in so short a time in so many different ways? My turn to be wrong.
A checkbox is tristate. It has values 0, 1, 2. Since 0 is unchecked, 1 is checked, and 2 is grayed, we presume 2-grayed to mean uncheckable, and thus not checked. So 0 and 2 both will mean we don't whisper. Only 1 means checked/whisper, so we have to check for that value.
whisper = (chkWhisper.Value = 1)
Send Iif(whisper,"/w " & username,"") & " ---- OuTLawZ BoT"
Quote from: Grok on August 12, 2003, 06:46 PMA checkbox is tristate. It has values 0, 1, 2. Since 0 is unchecked, 1 is checked, and 2 is grayed, we presume 2-grayed to mean uncheckable, and thus not checked. So 0 and 2 both will mean we don't whisper. Only 1 means checked/whisper, so we have to check for that value.
IIRC, 2 just means grayed. It doesn't specify checked or not -- it can be either grayed checked or grayed unchecked and either way the state will be 2, based on the last value before it was set to 2.
Quote from: Camel on August 12, 2003, 07:30 PM
Quote from: Grok on August 12, 2003, 06:46 PMA checkbox is tristate. It has values 0, 1, 2. Since 0 is unchecked, 1 is checked, and 2 is grayed, we presume 2-grayed to mean uncheckable, and thus not checked. So 0 and 2 both will mean we don't whisper. Only 1 means checked/whisper, so we have to check for that value.
IIRC, 2 just means grayed. It doesn't specify checked or not -- it can be either grayed checked or grayed unchecked and either way the state will be 2, based on the last value before it was set to 2.
If you can make it unchecked+grayed, you have a different checkbox than I do. Mine is always checked+grayed when the value is 2. The value cannot be "2, based on the last value before 2" because that doesn't even make sense. There are not multiple values of 2. It is a discrete value.
Tossing aside all that, the common-sense approach is this is a "Check me to lock whisper" box, most likely. This means the user will be checking and unchecking it when the bot is online, and the only time it will be grayed is when the user is offline, making whispers nonsensical.
chkWhisper.value = vbChecked works jsut aswell
Quote from: CrAz3D on August 12, 2003, 08:24 PM
chkWhisper.value = vbChecked works jsut aswell
But now you've inverted the sense from the post I replied to. That post set whisper to True if and only if the box was unchecked! You're doing the opposite.
Quote from: Adron on August 13, 2003, 03:41 AM
Quote from: CrAz3D on August 12, 2003, 08:24 PM
chkWhisper.value = vbChecked works jsut aswell
But now you've inverted the sense from the post I replied to. That post set whisper to True if and only if the box was unchecked! You're doing the opposite.
Yes I thought that was strange. If you follow the replies back to the original, it was only whispering when the box was checked. Someone messed it up along the way. Dr.Jay, I think.
Not that it really matters, but in REALbasic, you can set both the checked and the greyed properties of a checkbox, using .value and .enabled, respectively.
This is quite useful if you want to disable a checkbox, but still show what its value was to the user, or even save its value, so that it's automagically restored when the checkbox gets ungreyed.
Quote from: Grok on August 13, 2003, 06:18 AM
Yes I thought that was strange. If you follow the replies back to the original, it was only whispering when the box was checked. Someone messed it up along the way. Dr.Jay, I think.
Yes, that was another reason I picked his post to reply to. Much more interesting that way ;)
Quote from: tA-Kane on August 13, 2003, 07:34 AM
Not that it really matters, but in REALbasic, you can set both the checked and the greyed properties of a checkbox, using .value and .enabled, respectively.
This is quite useful if you want to disable a checkbox, but still show what its value was to the user, or even save its value, so that it's automagically restored when the checkbox gets ungreyed.
Same thing in vb. The .enabled property when set to false
disables the checkbox, meaning you cannot check it. The .value property when set to 2 just turns it gray, but it can still be checked. IIRC, both methods will show the previous state of the checkbox (checked or unchecked).
Ahh, my bad.
So if you set .value to 2, how do you know if it was checked or not?
Quote from: Camel on August 13, 2003, 12:54 PM
Same thing in vb. The .enabled property when set to false disables the checkbox, meaning you cannot check it. The .value property when set to 2 just turns it gray, but it can still be checked. IIRC, both methods will show the previous state of the checkbox (checked or unchecked).
Do you make this up as you go along, or do you open VB and test what you're saying?
Check1.Enabled = False
Check1.Value = 0
Check1.Value = 2
The checkbox is initially enabled, unchecked, and that code makes it disabled, THEN grayed and checked.
Check1.Value = 1
Check1.Value = 2
Despite it still being disabled, that code still shows grayed and checked.
As I said in my previous post, show me how you are displaying a box GRAYED and UNCHECKED at the same time?
To make a box gray and unchecked, the way these people have been saying, all you have to do is:
Check1.Enabled = False
Check1.Value = 0
Of course, the grayed state is a totally different state, since it usually means that some of the child checkboxes are checked and some aren't.
Differentiate between graying because it's disabled and graying because it's neither checked nor unchecked. The not checked, not unchecked state is called grayed, and happens to look a little similar to a disabled checked box. They are actually different shades of gray.
Quote from: Adron on August 13, 2003, 05:11 PM
To make a box gray and unchecked, the way these people have been saying, all you have to do is:
Check1.Enabled = False
Check1.Value = 0
Of course, the grayed state is a totally different state, since it usually means that some of the child checkboxes are checked and some aren't.
Differentiate between graying because it's disabled and graying because it's neither checked nor unchecked. The not checked, not unchecked state is called grayed, and happens to look a little similar to a disabled checked box. They are actually different shades of gray.
That is not what all these people were saying however. Read the posts and in each instance Camel was saying the 2-grayed state of a checkbox would reflect the 0-unchecked or 1-checked condition of the checkbox, matching the value it had just before being set to 2-grayed.
It is that to which I was responding, and you know it but love to argue!
Quote from: Grok on August 13, 2003, 04:48 PM
Quote from: Camel on August 13, 2003, 12:54 PM
Same thing in vb. The .enabled property when set to false disables the checkbox, meaning you cannot check it. The .value property when set to 2 just turns it gray, but it can still be checked. IIRC, both methods will show the previous state of the checkbox (checked or unchecked).
Do you make this up as you go along, or do you open VB and test what you're saying?
I said IIRC, which obviously I didn't. Everything else I said is correct.
Quote from: Grok on August 13, 2003, 07:39 PM
It is that to which I was responding, and you know it but love to argue!
Yes, of course, and I wasn't directly posting to argue with you. I just tried to explain why they were lost - what they were doing, compared to what you were doing. When I reply to someone in particular, I virtually always quote his post to make the reply clear.
How can a question about a value of a checkbox possibly last for THREE pages?!
Quote from: UserLoser on August 14, 2003, 05:03 PM
How can a question about a value of a checkbox possibly last for THREE pages?!
Want to make it
four!?!
No, four would be a bit too much. Better stop it now before it grows to that.