Board ArchivesSite FeaturesActiveworlds SupportHistoric Archives |
tacoguy // User Search
tacoguy // User SearchVB SDK : Multiple instances stealing trigger events .. Please helpFeb 15, 2002, 12:03am
Hello all
I am using MrGrimm OCX (Thanks !) to make a bot to extend chat range in my world. I am a somewhat experienced VB programmer but am an AWSDK novice. I would appreciate any help and thanks in advance ! I am instantizing 3 bots (which works fine) using this code for each : ************* sdk.AwInit AW_BUILD sdk.AwCreate Universe, Port sdk.EnableDefaultEvents sdk.AwLoginApplication = Application sdk.AwLoginOwner = Cit sdk.AwLoginPrivilegePassword = Pass sdk.AwLoginName = BotName1 *************** I am also calling a timer for each bot : timAwWait1.Interval = 1000 timAwWait1.Enabled = True ************** In the timer sub (1 for each of the 3 instances) I am using (latest itteration) : Private Sub timAwWait1_Timer() sdk.AwWait 0 sdk.AwEventSet AW_EVENT_CHAT sdk.AwStateChange End Sub ************** What happens is when bot1 logs in, it receives chat events but when bot2 logs in, bot2 receives the events and bot1 loses them. Same when bot3 logs in ... both bot1 and bot2 have lost events. I have looked everywhere to try to resolve this (including hours of scanning this newsgroup) and just cant find it. Any help would be most appreciated :-) Best as always Taco VB SDK : Multiple instances stealing trigger events .. Please helpFeb 15, 2002, 12:27am
Hi Joe
I don't know ... I have tried everything I can think of ( I first had just one event set and state change on form load and that did not work so I got desperate I guess :) The joys of being a newbie ! Also each instance has a different number ... timer1 is bot 1 and timer2 is bot 2 etc Thanks Taco [View Quote] >Why is the event set and state change in the timer? You only need to call >them once.. > >-Joe VB SDK : Multiple instances stealing trigger events .. Please helpFeb 16, 2002, 12:16am
Hello all !
Thanks so very much Grimble for your assistance ! While I was unable to get mutiple OCX to work on a single form ... that was the clue I needed so badly! What I ended up doing was making MDI child pages and placing the AW wrapper OCX on each form. I would have liked to do this on one form but I kept getting errors even if I tried a control array or renaming the 3 controls. The array kept giving compile errors while the renaming of the 3 controls would log in but not return events. I am sure as I recover from this massive headache that there is a much more elegant solution. Thanks for getting me pointed in the right direction ... I am so appreciative ! Best as Always Tacoguy Source code for RelayBot (long)Feb 22, 2002, 1:43am
Hello all !
I am posting this code in hopes that it can be a source of information for new people so they do not have to go thru the brain damage I did to make a bot. It is not authorative and only partial code is here as there are actually 3 bots but this is a start. This includes ability to store/retrieve location data, use multiple cit# and encrypt / decrypt passwords. Please don't throw stones at me for code imperfections ... there simply was no information available other than what very little I could get from this NG. This is Visual Basic Best as always ! Tacoguy ************************************** ' *******************Formbot1****************** ' RelayBot by Tacoguy ' Allows 3 Bots to enter any world in any location ' Parameters such as location and owner can be saved and restored ' The Bots listen to chat and send chat to the other 2 Bots ' This enables large areas of a world to be "chat enabled" ' 2 Cit#'s are allowed to avoid maximum Bots exceeded by the UniServer Private Const BotName1 = "Relay1" Private Const Application = "RelayBot" Private Const Universe = "auth.activeworlds.com" Private Const Port = 5670 Private Const MyYaw = 0 Public rc1 As Long Public Bot1NS Public Bot1WE Public Bot2NS Public Bot2WE Public Bot3NS Public Bot3WE Private Sub Check1_Click() 'Checkbox if saving is enabled Command4.Enabled = True Check1.Visible = False End Sub Private Sub Check2_Click() If Check2.Value = 1 Then NS3.Enabled = True WE3.Enabled = True ALT3.Enabled = True AV3.Enabled = True WLD3.Enabled = True UseCit3.Enabled = True Cit2.Enabled = True Pass2.Enabled = True End If If Check2.Value = 0 Then NS3.Enabled = False WE3.Enabled = False ALT3.Enabled = False AV3.Enabled = False WLD3.Enabled = False UseCit3.Enabled = False Cit2.Enabled = True Pass2.Enabled = True End If End Sub Private Sub Command1_Click() Bot2on.Value = 0 'Tells other bots that Bot2 is off Bot3on.Value = 0 'Tells other bots that Bot3 is off Text16.Text = "Logging In Relay1" 'Instance 1 sdk.AwInit AW_BUILD ' Init the API sdk.AwCreate Universe, Port ' Gets ready to log into the universe 'sdk.EnableDefaultEvents ' Allows the bot to receive events sdk.AwEventSet AW_EVEN_AVATAR_ADD sdk.AwEventSet AW_EVENT_CHAT 'All of these below set the login parameters sdk.AwLoginApplication = Application 'Cit Used If Formbot1.UseCit1 = "2" Then sdk.AwLoginOwner = Cit2 Else sdk.AwLoginOwner = Cit End If 'Pass Used If Formbot1.UseCit1 = "2" Then sdk.AwLoginPrivilegePassword = Pass2 Else sdk.AwLoginPrivilegePassword = Pass End If sdk.AwLoginName = BotName1 rc1 = sdk.AwLogin 'Performs the login If rc1 = 0 Then Text16.Text = "Relay1 is Logged in OK" Else Text16.Text = (rc1 & ": " & sdk.RCLookUp(rc)) End If sdk.AwEnter WLD1 'World 'This enters the world. ns1a = Bot1NS * 1000 we1a = Bot1WE * 1000 ALT1A = ALT1 * 100 ' The lines below specify the location of the bot within the world. IF you ommit the lines here, the bot will still be in the world, only invisible and will be limited to only a few functions. sdk.AwMyType = AV1 'MyType sdk.AwMyX = we1a 'MyX sdk.AwMyY = ALT1A 'MyY sdk.AwMyZ = ns1a 'MyZ sdk.AwMyYaw = MyYaw ' Starts the aw wait timer thisSession1 = sdk.AwSession() timAwWait1.Interval = 1000 timAwWait1.Enabled = True sdk.AwStateChange Command2.Enabled = True Command5.Enabled = True Command1.Enabled = False Command2.Visible = True Command5.Visible = True Command1.Visible = False End Sub Private Sub Command10_Click() 'This starts the bots 'makes sure there are no empty boxes If NS1.Text = "" Then MsgBox "Please enter N/S value for Bot1" GoTo NoData ElseIf NS2.Text = "" Then MsgBox "Please enter N/S value for Bot2" GoTo NoData ElseIf WE1.Text = "" Then MsgBox "Please enter W/E value for Bot1" GoTo NoData ElseIf WE2.Text = "" Then MsgBox "Please enter W/E value for Bot2" GoTo NoData ElseIf ALT1.Text = "" Then MsgBox "Please enter Altitude value for Bot1" GoTo NoData ElseIf ALT2.Text = "" Then MsgBox "Please enter Altitude value for Bot2" GoTo NoData ElseIf AV1.Text = "" Then MsgBox "Please enter Avatar value for Bot1" GoTo NoData ElseIf AV2.Text = "" Then MsgBox "Please enter Avatar value for Bot2" GoTo NoData ElseIf WLD1.Text = "" Then MsgBox "Please enter World name for Bot1" GoTo NoData ElseIf WLD2.Text = "" Then MsgBox "Please enter World name for Bot2" GoTo NoData ElseIf Cit.Text = "" Then MsgBox "Please enter Cit #1" GoTo NoData ElseIf Pass.Text = "" Then MsgBox "Please enter Priv Pass for Cit #1" GoTo NoData ElseIf Cit2.Text = "" Then MsgBox "Please enter Cit #2" GoTo NoData ElseIf Pass2.Text = "" Then MsgBox "Please enter Priv Pass for Cit #2" GoTo NoData End If 'bot 3 is enabled If Check2.Value = 0 Then GoTo Ready End If If NS3.Text = "" Then MsgBox "Please enter N/S value for Bot3" GoTo NoData ElseIf WE3.Text = "" Then MsgBox "Please enter W/E value for Bot3" GoTo NoData ElseIf ALT3.Text = "" Then MsgBox "Please enter Altitude value for Bot3" GoTo NoData ElseIf AV3.Text = "" Then MsgBox "Please enter Avatar value for Bot3" GoTo NoData ElseIf WLD3.Text = "" Then MsgBox "Please enter World name for Bot3" GoTo NoData End If Ready: Command1.Enabled = True Command1.Value = True 'Command1.Visible = True Command10.Visible = False Check2.Enabled = False NoData: End Sub Private Sub Command5_Click() Text16.Text = "Logging In as Relay2" 'Instance 2 Load Formbot2 Command1.Visible = False End Sub Private Sub Command7_Click() Text16.Text = "Logging In Relay3" 'Instance 3 Load Formbot3 End Sub Private Sub Command8_Click() sdk.AwSay Textin.Text End Sub Private Sub sdk_EventChat() TextChat1.Text = vbNewLine & sdk.AwChatMessage If sdk.AwAvatarName = "[Relay1]" Then GoTo Ignore End If If sdk.AwAvatarName = "[Relay2]" Then GoTo Ignore End If If sdk.AwAvatarName = "[Relay3]" Then GoTo Ignore End If Command8.Value = False If Bot2on.Value = 1 Then Formbot2.Textin.Text = "{" & sdk.AwAvatarName & "}" & TextChat1.Text Formbot2.Command1.Value = True Else End If If Formbot1.Bot3on.Value = 1 Then Formbot3.Textin.Text = "{" & sdk.AwAvatarName & "}" & TextChat1.Text Formbot3.Command1.Value = True Else End If Ignore: End Sub Private Sub Command2_Click() 'We done and close things and reset for another round Text16.Text = "All Relays have logged off" timAwWait1.Enabled = False ' Stops the timers Formbot2.timAwWait1.Enabled = False Formbot3.timAwWait1.Enabled = False sdk.AwTerm ' Kills the SDK Unload Formbot3 Unload Formbot2 Command10.Visible = True Command10.Enabled = True Command2.Enabled = False Command2.Visible = False Command3.Visible = True Command3.Enabled = True Command5.Visible = False Command7.Visible = False Bot2on.Value = 0 'Tells other bots that Bot2 is off Bot3on.Value = 0 'Tells other bots that Bot3 is off Check2.Enabled = True Text16.Text = "All Relays have logged off" End Sub Private Sub Form_Unload(Cancel As Integer) timAwWait1.Enabled = False ' Stops the timers sdk.AwTerm ' Kills the SDK Unload Formbot3 Unload Formbot2 Unload Formbot0 Unload Me End Sub Private Sub timAwWait1_Timer() sdk.AwWait 0 End Sub Private Sub sdk_EventAvatarAdd() 'When another user enters the world.... sdk.AwWhisper sdk.AwAvatarSession, "Hi " & sdk.AwAvatarName & " ! I am RelayBot1" End Sub Private Sub Command4_Click() 'Makes the file that saves data 'encrypt passwords ePass = "rtutz" 'sets the encrypt pass NewPass = EncryptText((Pass), ePass) NewPass2 = EncryptText((Pass2), ePass) Open "parameters.txt" For Output As #1 Print #1, Cit.Text Print #1, NewPass Print #1, Cit2.Text Print #1, NewPass2 Print #1, WLD1.Text Print #1, UseCit1.Text Print #1, NS1.Text Print #1, WE1.Text Print #1, Int(ALT1.Text) Print #1, AV1.Text Print #1, WLD2.Text Print #1, UseCit2.Text Print #1, NS2.Text Print #1, WE2.Text Print #1, Int(ALT2.Text) Print #1, AV2.Text Print #1, WLD3.Text Print #1, UseCit3.Text Print #1, NS3.Text Print #1, WE3.Text Print #1, Int(ALT3.Text) Print #1, AV3.Text Print #1, Check2.Value Close #1 End Sub Private Sub Command3_Click() 'Gets the file that has the data Open "parameters.txt" For Input As #1 Dim data Do Until EOF(1) Line Input #1, data Cit.Text = data Line Input #1, data Pass.Text = data Line Input #1, data Cit2.Text = data Line Input #1, data Pass2.Text = data Line Input #1, data WLD1.Text = data Line Input #1, data UseCit1.Text = data Line Input #1, data NS1.Text = data Line Input #1, data WE1.Text = data Line Input #1, data ALT1.Text = data Line Input #1, data AV1.Text = data Line Input #1, data WLD2.Text = data Line Input #1, data UseCit2.Text = data Line Input #1, data NS2.Text = data Line Input #1, data WE2.Text = data Line Input #1, data ALT2.Text = data Line Input #1, data AV2.Text = data Line Input #1, data WLD3.Text = data Line Input #1, data UseCit3.Text = data Line Input #1, data NS3.Text = data Line Input #1, data WE3.Text = data Line Input #1, data ALT3.Text = data Line Input #1, data AV3.Text = data Line Input #1, data Check2.Value = data Loop Close #1 'decrypt passwords ePass = "MYPASSHERE" 'sets the decrypt pass Pass.Text = DecryptText((Pass), ePass) Pass2.Text = DecryptText((Pass2), ePass) ' convert N/S and W/E coords to + and - values Bot1NSA = NS1.Text Bot2NSA = NS2.Text Bot3NSA = NS3.Text Bot1WEA = WE1.Text Bot2WEA = WE2.Text Bot3WEA = WE3.Text Dim NSC As String NSC = Bot1NSA GoSub NSCalc Bot1NS = NSC NSC = Bot2NSA GoSub NSCalc Bot2NS = NSC NSC = Bot3NSA GoSub NSCalc Bot3NS = NSC GoTo ReadyWE NSCalc: 'Determine if N or S from string x = InStr(NSC, "S") If x > 0 Then North = "-" GoTo FoundN End If x = InStr(NSC, "s") If x > 0 Then North = "-" GoTo FoundN Else: North = "" End If 'Strip the N/S away from the string FoundN: CleanN = Clean1(NSC) 'Make a new + / - string NSC = North & CleanN Return ReadyWE: Dim WEC As String WEC = Bot1WEA GoSub WECalc Bot1WE = WEC WEC = Bot2WEA GoSub WECalc Bot2WE = WEC WEC = Bot3WEA GoSub WECalc Bot3WE = WEC GoTo CalcDone WECalc: 'Determine if W or E from string x = InStr(WEC, "E") If x > 0 Then West = "-" GoTo FoundW End If x = InStr(WEC, "e") If x > 0 Then West = "-" GoTo FoundW Else: West = "" End If 'Strip the W/E away from the string FoundW: cleanW = Clean(WEC) 'Make a new + / - string WEC = West & cleanW Return CalcDone: Command3.Visible = False End Sub 'Encrypt passwords Private Function EncryptText(strText As String, ByVal strPwd As String) Dim i As Integer, c As Integer Dim strBuff As String #If Not CASE_SENSITIVE_PASSWORD Then 'Convert password to upper case 'if not case-sensitive strPwd = UCase$(strPwd) #End If 'Encrypt string If Len(strPwd) Then For i = 1 To Len(strText) c = Asc(Mid$(strText, i, 1)) c = c + Asc(Mid$(strPwd, (i Mod Len(strPwd)) + 1, 1)) strBuff = strBuff & Chr$(c And &HFF) Next i Else strBuff = strText End If EncryptText = strBuff End Function 'Decrypt passwords Private Function DecryptText(strText As String, ByVal strPwd As String) Dim i As Integer, c As Integer Dim strBuff As String 'Convert password to upper case 'if not case-sensitive strPwd = UCase$(strPwd) 'Decrypt string If Len(strPwd) Then For i = 1 To Len(strText) c = Asc(Mid$(strText, i, 1)) c = c - Asc(Mid$(strPwd, (i Mod Len(strPwd)) + 1, 1)) strBuff = strBuff & Chr$(c And &HFF) Next i Else strBuff = strText End If DecryptText = strBuff End Function Public Function Clean(WEC As String) As String Dim nLength As Integer Dim nStart As Integer Dim sOne As String Dim sNoWay As String ' sNoWay = " ',-.()!_$*<>/\?;:=+NnSsWwEe" If Not IsNull(WEC) Then nLength = Len(WEC) nStart = 1 Do While nStart <= nLength sOne = Mid(WEC, nStart, 1) If InStr(1, sNoWay, sOne, vbTextCompare) = 0 Then Clean = Clean & sOne End If nStart = nStart + 1 Loop End If End Function Public Function Clean1(NSC As String) As String Dim nLength1 As Integer Dim nStart1 As Integer Dim sOne1 As String Dim sNoWay1 As String ' sNoWay1 = " ',-.()!_$*<>/\?;:=+NnSsWwEe" If Not IsNull(NSC) Then nLength1 = Len(NSC) nStart1 = 1 Do While nStart1 <= nLength1 sOne1 = Mid(NSC, nStart1, 1) If InStr(1, sNoWay1, sOne1, vbTextCompare) = 0 Then Clean1 = Clean1 & sOne1 End If nStart1 = nStart1 + 1 Loop End If End Function Mulit - Universe capability of RelayerFeb 26, 2002, 9:48pm
Hello All
I wish to announce version 4 of Relayer. This bot is similar to PhoneBot but has significant enhancements. It enables up to 3 bots to be logged into any World in 1 or 2 Universes of your choosing and enables extended chat. It is extremely stable and allows saving and restoring of login information. You can use 2 different Cit#s (required for multi - Universe) or desired in some cases to avoid the "Bot Limit Exceeded" error. It is free and you can see it at: http://www.jefftech.net/relaybot.html Best as always :-) Tacoguy Releasing instancesMar 18, 2002, 1:09am
Hello all
This is a VB question. I want to thank all who have contributed to the TimerBot project! I most particularly want to thank Grimble for getting me on the right track to start with. I am having a problem with multiple instances. I can initiate multiple instances within the same API without problem. The problem comes when I release an instance. Any initiation of a new instance will pass events to an already created instance ! I have tried everything I can think of in my exit handler for an instance. I have even tried : AwDestroy and it comes back to an already created (but not killed instance) rather than a new one when recreated ! Any insight would be greatly appreciated :-) Best as always Taco Multi - Universe capability of RelayerFeb 26, 2002, 9:47pm
Hello All
I wish to announce version 4 of Relayer. This bot is similar to PhoneBot but has significant enhancements. It enables up to 3 bots to be logged into any World in 1 or 2 Universes of your choosing and enables extended chat. It is extremely stable and allows saving and restoring of login information. You can use 2 different Cit#s (required for multi - Universe) or desired in some cases to avoid the "Bot Limit Exceeded" error. It is free and you can see it at: http://www.jefftech.net/relaybot.html Best as always :-) Tacoguy New bot by TacoguyMar 6, 2002, 8:34pm
Hi all
I wish to announce my second Bot called TimerBot It is designed to watch an area of any World in any Universe where you have Bot privs. The idea is to place the Bot high above an area to be watched so it is not seen and it watches for avatars entering or exiting the area. What it does is keeps track of the time that an avatar has been there by reading the system clock for when the av enters and leaves. Times are updated for each avatar in the area every 10 secs. It also pops up a small window on top of all windows for 10 seconds and generates a sound when an event occurs if notification is enabled. The different sounds used for entering and leaving are included in the package. The Bot does not announce it's presence and has no chat or whisper functionality at all at this time. TimerBot completely ignores other Bots. You can save / restore the Cit info and retrieved information for ease of use and cumulative analysis of traffic in the area. The Priv. password is hidden from view for your protection. Please note that the file saved with the parameters DOES have the password encrypted as well. It uses an algorithm that I developed several years ago that is quite secure. Please see http://www.jefftech.net/timerbot.html for further information and free download. Best as awways Tacoguy New bot by TacoguyMar 6, 2002, 9:17pm
[View Quote]
I was thinking (after posting this) that TimerBot could have an
additional function. An intrusion logging mechanism that would be quite easy to implement actually. Here is the idea ... Timer would log chat in the area and save it to an encrypted file using the same algorythm that I currently use that can not be read by the person using the Bot but able to be read by only PK's. This could actually be a definitve source of untainted information to resolve disputes. Only PK's would have the password necessary to decrypt the chat file that TimerBot has generated. The Bot has logged chat already and tampering is impossible. Any ideas here would be appreciated as the mechanism is in place to very easily do this. > >Best as awways > >Tacoguy New bot by TacoguyMar 7, 2002, 9:39pm
Hello again
This is not intended to be an algotithm of 1024 Cypher strength. It is intended to keep the usual abusers in AW and their victims honest. Most typical (at least in my world) is a gang will invade (usually teenaged boys) and make life hard for legitimate people. This is intended to provide a mechanism to validate the event occured and was not "doctored." I did in fact develop such a mechanism in the form of 2 executable files. TimerBot itself is now capable of storing an encrypted text file of avatar events and chat events that includes local time/date stamps. This file can only be read by the companion program unless you are into crypto which is highly unlikely for AW users. Rather than hand out passwords to PKs ... the decryption executable has the same algorithm and password as the TimerBot itself. I will never release source code for this. If a user has an issue ... they can send the encrypted file to the PK and the PK can decrypt with full confidence that the event did actually occur. Please see www.jefftech.net/timerbot.html for full details and download Best as always Taco New bot by TacoguyMar 7, 2002, 10:55pm
Hi again
I was thinking about the posts about encrypt strength again. There is absolutely no need to have a strong cypher as the data is intended to be decrypted with minimal code. What is needed for this application is the inability to modify the encrypted string and there is a CRC checksum built into the string so if it is modified ... decode will either fail altogether or it will appear tampered in the Decrypt executable. I am not giving away my secrets but trust me ... the security is more than meets the eye here. Best as awways Tacoguy TimerBot and Relayer final releaseMar 16, 2002, 12:10am
Greets to all
Stable and debugged versions of TimerBot and Relayer are released today after nearly 2 months of development. Please let me please explain the purpose of each. **** Relayer is an enhaced Phonebot that enables chat between different Universes or different Worlds or simply to increase chat range in a World. *** Timer is an ambitious project that can watch an area in a World. It monitors all avatar and chat events and can save this activity with time and date stamps to an encrypted file. There is a companion program that can read this file. The intention of Timer is ttwofold actually: 1) To keep a cumulative log of avatars entering and leaving the area and time spent such as GZ of a World. 2) To generate a valid log file that can not be tampered with than can be sent to PKs in case of disputes. ***** If you are interested in these projects ... they are both well documented with screenshots too and you can download them at : www.jefftech.net/relaybot.html www.jefftech.net/timerbot.html **** Best as always Tacoguy What does it take?Oct 11, 2001, 8:06pm
Hello all
I have been following the dialog of the issues that Insanity has raised. I am a consutant for 4 ISPs and there have been numerous E-Commerce issues I have addressed. I fully concur that E-Mail is a wholly inadequate mechanism for credit card transactions and that practice should be halted. It is completely insecure and is vulnerable to snooping as well as spoofing. I am appalled that AW would set up an online transaction where double billing would or could occur. When setting up an E-Commerce site, you test and retest and then test again till you are sure all is well ... and you use SSL. These transactions must be secure ! I can not address the issues of "refunds to customers" related to overbilling as I have no personal knowledge of that but I can say that AW is getting very bad marks in my book for the way it treats their customers. I have a wonderful example of "customer care". The decision was made to buy my world. I contacted customer service via E-Mail and asked what are the ramications of world purchase. I was told all would be well ... no complications, the world would be available in a minute or two. So I purchased the world only to find that it was totally devoid of objects ! Desperate attempts to contact AW resulted in a response some hours later that they had not saved world contents ! Well as I have my own object path and world host ... I was totally hosed ! Fortunately I had backed up the world with BuildBot and was able to recover. I however was appalled at AW customer service telling me all would be well when in fact all was lost ! So I fully concur with Insanity that there is something very wrong there. Best Tacoguy Happy B'day Andras !Oct 15, 2001, 7:49pm
I want to wish the happiest of birthdays to Andras ... a great guy and
a tremendous asset to the AW community ! I was fortunate enough to go to his party where I saw old friends and met new ones alike. It is wonderful to see many of the " people that make AW better " get together and have fun. There is much that is good with AW and we have to continue to look for the good side. In spite if the flame wars that occur here ... there is the often overlooked (and taken for granted) 95% of the population that has fun in AW ! Not aware of underlying issues perhaps ... but they have fun. Best as always :-) Taco |