Valhalla Legends Forums Archive | Battle.net Bot Development | Need Help

AuthorMessageTime
OuTLawZGoSu
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
August 2, 2003, 1:19 AM
______
[quote author=OuTLawZGoSu link=board=17;threadid=2169;start=0#msg16744 date=1059787190]
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]


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...
[code]
if chkwhisper.value = 1 then
whisper = true
else
whisper= false
endif
[/code]
?
August 2, 2003, 1:35 AM
iago
[quote author=OuTLawZGoSu link=board=17;threadid=2169;start=0#msg16744 date=1059787190]
If username = username Then
[/quote]

Is it supposed to be like that? That seems a little redundant because it seems redundant.
August 2, 2003, 3:28 AM
CrAz3D
I'm positive this has been posted before, quite indepth aswell.
August 2, 2003, 4:36 AM
OuTLawZGoSu
OK... now the code looks like this:

[code]

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 [/code]

With this code, everyting under the "If chkwhisper.Value = 1 Then" does not work. PLz let me no wat im doing wrong.
August 2, 2003, 12:05 PM
Raven
Try changing
[code]
If chkwhisper.Value = 1 Then
whisper = True
Else
whisper = False
End If
[/code]

to

[code]
If chkwhisper.Value = 1 Then
whisper = True
Else if chkWhisper.Value != 1 Then
whisper = False
End If
[/code]
August 2, 2003, 4:10 PM
drivehappy
[quote author=Raven link=board=17;threadid=2169;start=0#msg16835 date=1059840613]
[code]
If chkwhisper.Value = 1 Then
whisper = True
ElseIf chkWhisper.Value != 1 Then
whisper = False
End If
[/code]
[/quote]

!= isn't a VB operator, you'll need to use <>
August 2, 2003, 5:07 PM
OuTLawZGoSu
so it's :

If chkwhisper.Value = 1 Then
whisper = True
ElseIf chkWhisper.Value <> = 1 Then
whisper = False
End If

?
August 2, 2003, 6:10 PM
Dr.JaY
[quote author=OuTLawZGoSu link=board=17;threadid=2169;start=0#msg16845 date=1059847812]
so it's :

If chkwhisper.Value = 1 Then
whisper = True
ElseIf chkWhisper.Value <> = 1 Then
whisper = False
End If

?
[/quote]

You don't need ElseIf chkWhisper.Value <> = 1 Then,
just use
[code]Else
whisper = False
End If[/code]
August 2, 2003, 7:06 PM
CrAz3D
yay jay
August 2, 2003, 8:23 PM
OuTLawZGoSu
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...
August 3, 2003, 5:58 PM
Dr.JaY
Try this...

[code]If chkwhisper.Value = "0" Then
whisper = True
Else
whisper = False
End If[/code]
August 4, 2003, 12:29 PM
______
[quote author=Dr.JaY link=board=17;threadid=2169;start=0#msg16996 date=1060000172]
Try this...

[code]If chkwhisper.Value = "0" Then
whisper = True
Else
whisper = False
End If[/code]

[/quote]
why put quote's around the 0 ?
August 12, 2003, 2:31 AM
UserLoser
Could just do it in one line.

[code]Whisper = chkWhisper.value[/code]

*Expects massive toasting for helping*
August 12, 2003, 3:06 AM
Dr.JaY
[quote author=___/\___ link=board=17;threadid=2169;start=0#msg17866 date=1060655478]
[quote author=Dr.JaY link=board=17;threadid=2169;start=0#msg16996 date=1060000172]
Try this...

[code]If chkwhisper.Value = "0" Then
whisper = True
Else
whisper = False
End If[/code]

[/quote]
why put quote's around the 0 ?
[/quote]

Because it does the same thing..
August 12, 2003, 3:59 PM
Adron
Normally if two alternatives do the same thing, I'd pick the shorter one. How come you're not using

[code]
If chkwhisper.Value = 0 Then
whisper = True
Else
whisper = False
End If
[/code]

or

[code]
whisper = chkwhisper.Value = 0
[/code]

or

[code]
whisper = Not chkwhisper.Value
[/code]

?
August 12, 2003, 4:34 PM
Avenge
yeah I would rather use a short string than a million If statements, but that is just me..
August 12, 2003, 6:58 PM
Camel
[quote author=Adron link=board=17;threadid=2169;start=15#msg17896 date=1060706060][code]whisper = Not chkwhisper.Value[/code][/quote]
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.

[code]?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[/code]
August 12, 2003, 9:36 PM
Adron
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!
August 12, 2003, 9:43 PM
Camel
[quote author=Adron link=board=17;threadid=2169;start=15#msg17896 date=1060706060][code]whisper = chkwhisper.Value = 0[/code][/quote]

Once again, not that it matters, but I prefer: [code]whisper = (chkwhisper.Value = 0)[/code] 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.
August 12, 2003, 9:50 PM
Grok
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.

[code]
whisper = (chkWhisper.Value = 1)
Send Iif(whisper,"/w " & username,"") & " ---- OuTLawZ BoT"
[/code]
August 12, 2003, 11:46 PM
Camel
[quote author=Grok link=board=17;threadid=2169;start=15#msg17921 date=1060732019]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.[/quote]

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.
August 13, 2003, 12:30 AM
Grok
[quote author=Camel link=board=17;threadid=2169;start=15#msg17924 date=1060734659]
[quote author=Grok link=board=17;threadid=2169;start=15#msg17921 date=1060732019]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.[/quote]

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]

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.
August 13, 2003, 1:13 AM
CrAz3D
chkWhisper.value = vbChecked works jsut aswell
August 13, 2003, 1:24 AM
Adron
[quote author=CrAz3D link=board=17;threadid=2169;start=15#msg17927 date=1060737859]
chkWhisper.value = vbChecked works jsut aswell
[/quote]

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.
August 13, 2003, 8:41 AM
Grok
[quote author=Adron link=board=17;threadid=2169;start=15#msg17946 date=1060764104]
[quote author=CrAz3D link=board=17;threadid=2169;start=15#msg17927 date=1060737859]
chkWhisper.value = vbChecked works jsut aswell
[/quote]

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]

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.
August 13, 2003, 11:18 AM
tA-Kane
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.
August 13, 2003, 12:34 PM
Adron
[quote author=Grok link=board=17;threadid=2169;start=15#msg17950 date=1060773484]

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.
[/quote]

Yes, that was another reason I picked his post to reply to. Much more interesting that way ;)
August 13, 2003, 4:40 PM
Camel
[quote author=tA-Kane link=board=17;threadid=2169;start=15#msg17955 date=1060778048]
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]

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).
August 13, 2003, 5:54 PM
tA-Kane
Ahh, my bad.

So if you set .value to 2, how do you know if it was checked or not?
August 13, 2003, 8:03 PM
Grok
[quote author=Camel link=board=17;threadid=2169;start=15#msg17982 date=1060797259]
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).
[/quote]

Do you make this up as you go along, or do you open VB and test what you're saying?

[code]Check1.Enabled = False
Check1.Value = 0
Check1.Value = 2[/code]

The checkbox is initially enabled, unchecked, and that code makes it disabled, THEN grayed and checked.

[code]Check1.Value = 1
Check1.Value = 2[/code]

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?
August 13, 2003, 9:48 PM
Adron
To make a box gray and unchecked, the way these people have been saying, all you have to do is:

[code]
Check1.Enabled = False
Check1.Value = 0
[/code]

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.
August 13, 2003, 10:11 PM
Grok
[quote author=Adron link=board=17;threadid=2169;start=30#msg18004 date=1060812667]
To make a box gray and unchecked, the way these people have been saying, all you have to do is:

[code]
Check1.Enabled = False
Check1.Value = 0
[/code]

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]

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!
August 14, 2003, 12:39 AM
Camel
[quote author=Grok link=board=17;threadid=2169;start=30#msg17999 date=1060811338]
[quote author=Camel link=board=17;threadid=2169;start=15#msg17982 date=1060797259]
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).
[/quote]

Do you make this up as you go along, or do you open VB and test what you're saying?[/quote]

I said IIRC, which obviously I didn't. Everything else I said is correct.
August 14, 2003, 1:12 AM
Adron
[quote author=Grok link=board=17;threadid=2169;start=30#msg18024 date=1060821556]
It is that to which I was responding, and you know it but love to argue!
[/quote]

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.
August 14, 2003, 9:45 PM
UserLoser
How can a question about a value of a checkbox possibly last for THREE pages?!
August 14, 2003, 10:03 PM
Camel
[quote author=UserLoser link=board=17;threadid=2169;start=30#msg18112 date=1060898591]
How can a question about a value of a checkbox possibly last for THREE pages?!
[/quote]

Want to make it four!?!
August 15, 2003, 12:00 AM
Adron
No, four would be a bit too much. Better stop it now before it grows to that.
August 15, 2003, 1:02 PM

Search