Post reply

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.
Name:
Email:
Subject:
Message icon:

shortcuts: hit alt+s to submit/post or alt+p to preview


Topic Summary

Posted by: Zakara
« on: March 08, 2009, 08:59:29 PM »

What are or were you trying to do exactly?
Posted by: shhdn
« on: February 27, 2009, 07:53:42 PM »

ahh ok i under stand.
Posted by: ArticWolve
« 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 & "."
Posted by: shhdn
« 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.
Posted by: Vector
« 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.
Posted by: shhdn
« on: February 27, 2009, 12:15:16 PM »

whoops i for got something:

Sub talk_Event_Load()
   AddChat   vbYellow "talk test loaded"
End Sub
Posted by: shhdn
« 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
Posted by: Vector
« 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.
Posted by: Hero
« on: February 26, 2009, 07:12:59 PM »

He can just use http://mike.vbscript.pastebin.com or http://blake.pastebin.com

Fixed this up
Code: [Select]
'talk
'0.1

Sub talk_Event_PressedEnter(Text)
  ' Left takes the specified amount of letters off the left of a string or message
  ' You took off 11, for "/hai" you only need 4
  If Left(LCase(Text), 4) = "/hai" Then
    ' This is a comment and should be used for things you want to remind yourself of or tell others
    ' If Statements must end in a matching End If
    ' Something you could put here would be:
    AddChat vbGreen, "hai2u2"
  End If
End Sub
Posted by: shhdn
« on: February 26, 2009, 05:37:43 PM »

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^_^
Posted by: shhdn
« on: February 26, 2009, 02:49:53 PM »

ok for my next little try i am stuck again. i want to make it say something to the channel not just the person useing the sb. i think i have it so far but im stuck i dont know how to make it run only when a trigger is said either :/



Code: [Select]
'talk
     '0.1
    
     sub {dont know what goes here, or is it talk_Event_Load()}
         DSP Origin, "HAI PPL"
     end sub

at least i think "DSP Origin" is how you make it talk in a channel as of :
http://rev77.net/scripts/?query=view&script=pageme.plug
Posted by: shhdn
« on: February 26, 2009, 12:42:46 PM »

2 more things:

1. i write this on notepad right? if not then on what?
2. i save them as yadayada.plug?
Posted by: Vector
« on: February 26, 2009, 11:38:07 AM »

The 0.1 indicates the plugin version, and is required to be there in order to load the plugin.
Posted by: shhdn
« on: February 26, 2009, 11:22:09 AM »

'test
'0.1


sub test_Event_Load()
    AddChat vbBlue "o hai"
end sub

ok i understand. the Test in  "Test_event_load()" is the name as mentioned above that in " 'test "
and i under stand to tell it when to show up the event(trying to learn quickly and underline things without knowing what im doing if it works im happy) is the load up. but y is there a " '0.1 " that i dont get. and yes i do need a better place for this. im happy i under stand a bit now tho
Posted by: Vector
« on: February 26, 2009, 10:34:23 AM »

Quote from: shhdn
at : http://rev77.net/scripts/?query=view&script=run.plug
 
"AddChat vbGreen"

does that meen i can use other colors?
trying to make something that shows up on startup like the plugin manager. just more simple like "hi"
T.T i think i know what im doing. and lastly what program do i wright this on? is notepad ok?
ill probly be working on this at school so anything i make at school i have to post here so i can edit it when i get home. at least untill i find my flash drive. if this is not ok plz tell me.
Talk to Mike about getting your own subdomain, like blake.rev77.net, so you don't have to do this every single time.

I could always set you up with an ftp account on clanmage.phost.ws as an alternative.

Quote from: shhdn
ok here it is. as far as i know this will work then again its only 1 line long >.> i cant test it as i am in school for now but if there is no responce ill tryit when i get home.

sub text_test()
    AddChat vbBlue "o hai"
end sub

if this does work. then i guess i need to try something harder
According to the plugin system, that line will fire when you add the following:

Quote
'test
'0.1


sub test_Event_Load()
    AddChat vbBlue "o hai"
end sub
the first line "'test" defines the prefix, and is how the plugin system will call your plugin.

This line:
Code: [Select]
Sub test_Event_Load()Fires EACH time the bot either starts up, or the scripts are reloaded