Author Topic: VBScripting help  (Read 2692 times)

Vector

  • Administrator
  • Hero Member
  • *****
  • Posts: 550
    • View Profile
    • http://clanmage.phost.ws
VBScripting help
« Reply #15 on: February 26, 2009, 07:16:01 PM »
Quote from: shhdn
i found a few things. and sorry for spamming this topic. i was looking the HL plugins addon to abort the game and i found something here is my slightly revised script still need help tho. p.s. if i could just edit my above post i would have but i cant so once again sorry.

Code: [Select]
'talk
'0.1

Sub talk_Event_PressedEnter(Text)
  If Left(LCase(Text), 11) = "/hai" Then

               idk what to do here >.>

end sub

Sub talk_Event_PressedEnter(Text)
  If Left(LCase(Text), 11) = "/hai"
Then was stolen from the plugin at:http://rev77.net/scripts/?query=view&script=hlAbortPlaying.plug
so idk if it will work but it looks good^_^

Code: [Select]
'talk
'0.1

Sub talk_Event_PressedEnter(Text)

  '// Lets check the leftmost nine characters to see if they said /saythis<space>
  '// LCase() just means make it lowercase. That way they can use /SaY, and /saY, and it won't matter
  If Left(LCase(Text), 9) = "/saythis " Then
    AddChat vbGreen, "You said " & Right(Text, Len(Text) - 9)
  End If
End Sub

What you wanted was this:

Code: [Select]
'talk
'0.1

Sub talk_Event_UserTalk(Username, Flags, Message, Ping)

  '// Lets check the leftmost eight characters plus the length of the trigger to see if they said <trigger>saythis<space>
  '// LCase() just means make it lowercase. That way they can use /SaY, and /saY, and it won't matter
  If Left(LCase(Text), Len(BotVars.Trigger) + 8) = BotVars.Trigger & "saythis " Then
    '// get what they put after <trigger>saythis
    sayTheRest = Right(Message, Len(Message) - (Len(BotVars.Trigger) + 8)
    AddQ sayTheRest
  End If
End Sub

Blake, DSP conforms with the command processor that Mike and I use in our scripts. You will learn it later. I have a tutorial for it on here though.
« Last Edit: February 26, 2009, 07:21:00 PM by Vector »
I am an Unofficial StealthBot Technician, an Unofficial StealthBot scripter, among other things. See my about page for more info.

Quote from: ArticWolve
Sorry I went down. Had internet problems with a cracker-jack-licensed driver hitting my internet pole (about 8 of them fell) and drooping my phone and electricity. Sorry ><

Rev77.net Plugins Manager

Proud host of Vector.no-ip.info | VectorJBLS.no-ip.org Status: [img]http://rev77.net/ServerCheck/check.asp?query=check&server=VectorJBLS.no-ip.org_status.png\" border=\"0\" class=\"linked-image\" /]

Shito-Ryu Karate-Do Genbu-Kai Rank: 8th Kyu (White belt, one stripe)

Rev77.Net Remote Support (Double-Click my name only if you were told to)

If the above link doesn't work, or if you use Vista, try this alternate link.

Noob ~Vector

shhdn

  • Newbie
  • *
  • Posts: 22
    • View Profile
    • http://
VBScripting help
« Reply #16 on: February 27, 2009, 08:58:16 AM »
is this good?
Code: [Select]
'talk
'0.2

Sub talk_Event_Load()
    vbYellow "talk test loaded"
End Sub

sub talk_Event_UserTalk(Username, Flags, Message, Ping)

     If Left(LCase(Text), Len(BotVars.Trigger) + 6) = BotVars.Trigger & "speak " Then
        sayTheRest = Right(Message, Len(Message) - (Len(BotVars.Trigger) + 6)
    AddQ sayTheRest
  End If
End Sub

the following i dont understand:
(Username, Flags, Message, Ping)
Len
and the +6 is the words plus 1 for the space?
AddQ
« Last Edit: February 27, 2009, 09:00:11 AM by shhdn »
Quote
[8:01:08 PM] <Nice> lol you would say thats what you said
 [8:01:19 PM] <shhdn> yes
 [8:01:23 PM] <Nice> you would agree
 [8:01:26 PM] <shhdn> nope
 [8:01:32 PM] <Nice> you would disagree to agreeing
 [8:01:37 PM] <shhdn> maby
 [8:01:46 PM] <Nice> you would be indecisive when i make fun of you
 [8:01:59 PM] <shhdn> most likely

Dare you click this?

~I am the Global in your Sig. Guess who I am.

its obvious who you are. you are text, but not any text, you are Sentient!!
Nope.-Mysterious Global

shhdn

  • Newbie
  • *
  • Posts: 22
    • View Profile
    • http://
VBScripting help
« Reply #17 on: February 27, 2009, 12:15:16 PM »
whoops i for got something:

Sub talk_Event_Load()
   AddChat   vbYellow "talk test loaded"
End Sub
Quote
[8:01:08 PM] <Nice> lol you would say thats what you said
 [8:01:19 PM] <shhdn> yes
 [8:01:23 PM] <Nice> you would agree
 [8:01:26 PM] <shhdn> nope
 [8:01:32 PM] <Nice> you would disagree to agreeing
 [8:01:37 PM] <shhdn> maby
 [8:01:46 PM] <Nice> you would be indecisive when i make fun of you
 [8:01:59 PM] <shhdn> most likely

Dare you click this?

~I am the Global in your Sig. Guess who I am.

its obvious who you are. you are text, but not any text, you are Sentient!!
Nope.-Mysterious Global

Vector

  • Administrator
  • Hero Member
  • *****
  • Posts: 550
    • View Profile
    • http://clanmage.phost.ws
VBScripting help
« Reply #18 on: February 27, 2009, 12:52:07 PM »
Quote from: shhdn
is this good?
'talk
'0.2

Sub talk_Event_Load()
   AddChat vbYellow, "talk test loaded"
End Sub

sub talk_Event_UserTalk(Username, Flags, Message, Ping)

    If Left(LCase(Text), Len(BotVars.Trigger) + 6) = BotVars.Trigger & "speak " Then
      sayTheRest = Right(Message, Len(Message) - (Len(BotVars.Trigger) + 6))
   AddQ sayTheRest
  End If
End Sub
Note the corrections in bold.

As for the rest:

(Username, Flags, Message, Ping) = Everytime a user talks, this Sub is called, and these four things are "passed" to the function, meaning you may access these variables everytime a user talks. They are: Username which contains the name of the user who spoke. Flags, the user's battle.net flags. Flag 0 is for a normal user (not opped or anything). Message is the message they said when they talked. Ping just contains their ping value at logon.

AddQ = sends the specified text to battle.net, same as if you typed something and pressed enter.

Len = the length of a string. "hai there" and "Hello world!" are both strings.

I will break down the following code for you:
Code: [Select]
  sayTheRest = Right(Message, Len(Message) - (Len(BotVars.Trigger) + 6))
Right() returns the rightmost characters of a string.

Basically, the Message is what we want to extract characters out of.

Take the second part here:

Code: [Select]
Len(Message) - (Len(BotVars.Trigger) + 6)Ok, say someone said ".speak hai there"

What this would do is take the length of the message as indicated by Len(Message), and subtract the length represented by ".speak " out of the message, leaving "hai there". The (Len(BotVars.Trigger) + 6) part just adds the length of the trigger + 6 together, making 7, which would represent the leftmost part of the message that says ".speak ". After that part is taken out, we are then left with "hai there"

AddQ sayTheRest simply sends the resulting string to battle.net

the 6 is the length of "speak" plus a space, because that is the most logical way to do it.
« Last Edit: February 27, 2009, 12:55:19 PM by Vector »
I am an Unofficial StealthBot Technician, an Unofficial StealthBot scripter, among other things. See my about page for more info.

Quote from: ArticWolve
Sorry I went down. Had internet problems with a cracker-jack-licensed driver hitting my internet pole (about 8 of them fell) and drooping my phone and electricity. Sorry ><

Rev77.net Plugins Manager

Proud host of Vector.no-ip.info | VectorJBLS.no-ip.org Status: [img]http://rev77.net/ServerCheck/check.asp?query=check&server=VectorJBLS.no-ip.org_status.png\" border=\"0\" class=\"linked-image\" /]

Shito-Ryu Karate-Do Genbu-Kai Rank: 8th Kyu (White belt, one stripe)

Rev77.Net Remote Support (Double-Click my name only if you were told to)

If the above link doesn't work, or if you use Vista, try this alternate link.

Noob ~Vector

shhdn

  • Newbie
  • *
  • Posts: 22
    • View Profile
    • http://
VBScripting help
« Reply #19 on: February 27, 2009, 07:21:29 PM »
yay my second script  now i want to get an atuomated one that says "hello,<person who said hi>"
and i want to make it like a trigger i guess with an access of 20 or so. i need help with the geting the name tho... ill c what i can do till i get help for that.
Quote
[8:01:08 PM] <Nice> lol you would say thats what you said
 [8:01:19 PM] <shhdn> yes
 [8:01:23 PM] <Nice> you would agree
 [8:01:26 PM] <shhdn> nope
 [8:01:32 PM] <Nice> you would disagree to agreeing
 [8:01:37 PM] <shhdn> maby
 [8:01:46 PM] <Nice> you would be indecisive when i make fun of you
 [8:01:59 PM] <shhdn> most likely

Dare you click this?

~I am the Global in your Sig. Guess who I am.

its obvious who you are. you are text, but not any text, you are Sentient!!
Nope.-Mysterious Global

ArticWolve

  • Global Moderators
  • Hero Member
  • *****
  • Posts: 636
    • View Profile
    • http://
VBScripting help
« Reply #20 on: February 27, 2009, 07:41:32 PM »
To get someones username and reply "HELLO, NAME" via SB Scripting for users with 20 access or more, your userjoin sub would look like this:

GetDBEntry Username, Access, Flags
If MyAccess< 20 Then EXIT SUB
AddQ "Hello " & Username & "."
Quote
Darker then the darkest shade of night...
    A Rebel at heart... A criminal by mind
    All in the eyes of the beholder... is the truth to life
    But Th---The Only---The One and Only True Master of Death is the Reaper itself
[/color]
[/color]
[div align=\'center\'][img]http://img261.imageshack.us/img261/9411/mydesktopce6.jpg\" border=\"0\" class=\"linked-sig-image\" /][img]http://www.danasoft.com/sig/238153.jpg\" border=\"0\" class=\"linked-sig-image\" /][/div]                     [div align=\'center\']    Click ME for my forums. You know you want to click ME. Come on CLICK ME DAMN IT! But don't click THIS!![/div]

shhdn

  • Newbie
  • *
  • Posts: 22
    • View Profile
    • http://
VBScripting help
« Reply #21 on: February 27, 2009, 07:53:42 PM »
ahh ok i under stand.
Quote
[8:01:08 PM] <Nice> lol you would say thats what you said
 [8:01:19 PM] <shhdn> yes
 [8:01:23 PM] <Nice> you would agree
 [8:01:26 PM] <shhdn> nope
 [8:01:32 PM] <Nice> you would disagree to agreeing
 [8:01:37 PM] <shhdn> maby
 [8:01:46 PM] <Nice> you would be indecisive when i make fun of you
 [8:01:59 PM] <shhdn> most likely

Dare you click this?

~I am the Global in your Sig. Guess who I am.

its obvious who you are. you are text, but not any text, you are Sentient!!
Nope.-Mysterious Global

Zakara

  • Beta Testers
  • Jr. Member
  • **
  • Posts: 91
    • View Profile
    • http://images.google.com/images?hl=en&client=firefox-a&rls=org.mozilla:en-GB:official&hs=elw&q=prince albert piercing&um=1&ie=UTF-8&sa=N&tab=wi
VBScripting help
« Reply #22 on: March 08, 2009, 08:59:29 PM »
What are or were you trying to do exactly?
[!--quoteo(post=0:date=:name=John SHADOW T.)--][div class=\'quotetop\']QUOTE (John SHADOW T.)[/div][div class=\'quotemain\'][!--quotec--]Half Human; Half Shylaeran; All pride and wisdom.
Fierce in combat, Tame at heart;
Wise with words, Foolish with affection;
Strong as a bull, Weak as a rose;
Love a man, Hate his people;
Leave your kind, To never see again
The truth in his words,
Of Love and Beauty,
Of Affection and Lust,
Of Wisdom and Power,
Of Bravery and Foolishness.
That this woman, now tells his lesson, to those of young,
That not all, is forbidden, for he too,
Was all the same to me.[/quote]
Do not edit her signature anymore. You have all been warned. ~ArticWolve