Locked Home » Forums » Legacy & Archived » Archived Content » Vanguard » VGExtreme Programs

VGExtreme - DiplomacyBot 2.2 : VGExtreme Programs

Posted: April 20th, 2008
Total Posts:77 Joined:2007
DipolmacyBot 2.2 - Release 5/10/08

Features:
- Fully automated "Parley Runs" between 1-8 NPCs!
- Intelligent Parley Logic plays cards based on available Expression!
- Ability to react to tells from other players!
- Two modes, Unattended Botting and Test/Quest mode!
- Ability to Pause the bot during your Opponent's turn using F12!
- Waypoint matrix navigation!
- Automated setup!

Update - Version 2.2
- Bug fix for NPCs that do not have the Civic Diplomacy Button in the dialog window.
- Added, Const DoAllTypes
Setting this to True will cause the bot to select the top parley until the NPC has no more available or ParleysPerNpc is reached.

Update - Version 2.1
- Added the ability to completely ignore tells (not recommended)
- Bug fix for tell check

Update - Version 2.0
- Ability to specify Conversation Types, great for moving levers!
- You can now parley with up to 8 NPCs!
- Added a "wait time" that will cause the bot to rest for a minute if no NPCs were ready on last run.
- If you are winning by 8 or more the bot will not play Assertions to be more efficient.
- Vastly improved setup!

Version History:
- Version 2.2 - 5/10/08
- Version 2.1 - 5/8/08
- Version 2.0 - 5/1/08
- Version 1.0 - 4/20/08

Setup:
Download the zip file and extract it into your VGExtreme directory.
Run VGExtreme and open DiplomacyBot 2.1 as a project and follow the instructions from there.

If you are updating from an earlier version:
Rename "DBSettings.vbs" to "DBSettingBackup.vbs" and extract DiplomacyBot 2.2 into your VGExtreme directory, overwriting any files that come up.
Open DiplomacyBot 2.2 as project, then open "DBSettingsBackup.vbs" as source.
You can then copy your old settings such as Card Data, Safe Players and Waypoints from "DBSettingsBackup.vbs" to "DBSettings.vbs"


Refer to the Readme and the example picture in the DBIncludes folder for instructions on deck building.


Credits:
Thanks to WyvernX for his work with VGExtreme.
Thanks to Beergeek for his VG adaptation of the EQ2 HarvestBot4.xx navigation script.
Lastly, "DB Config.vbs" contains some code from "Waypoint Creator 1.1" which was originally written by Binafus, then modified by Beergeek.


Attachments:
DiplomacyBot 2.2.zip Register to unlock hidden link
Contains all of the files necessary to run the bot. Extract into your VGExtreme directory.
(265.34 KiB) Downloaded 73 times


Last edited by mythicskunk on June 12th, 2008, 6:19 pm, edited 18 times in total.
Posted: April 20th, 2008
User avatar
administrator
Total Posts:29891 Joined:2002
Nice nice

Can members say yay or nay to this being moved to a confirmed section.
Posted: April 23rd, 2008
rommel62
Can confim this works, very nice job!

Only problem I see is its nearly impossible to pause using f12. Oh, also, the hotbutton setup didnt seem to automatically set up as described, but I did it manually so all was well.

Good Job!
Posted: April 23rd, 2008
User avatar
administrator
Total Posts:29891 Joined:2002
1k points to you and moved to confirmed. GREAT ITEM!
Posted: April 23rd, 2008
beergeek
Sweet! Glad to see someone else actively contributing again. Now I don't have to write a diplo bot myself beyond the crude one I already released :)
Posted: April 23rd, 2008
Total Posts:77 Joined:2007
Thanks for the positive feedback guys. I'm just happy to finally contribute something substantial to the community. Hopefully this will allow Beergeek to concentrate on reworking UltraBot for VG as that is now the only thing missing from our selection of VGExtreme bots. (It's also way out of my league) :D

I hope add more to this bot over time if it is necessary. Depending on how substantial the lever's are in APW and other end game areas, I may try to get that in.

Also, I would like to ask that everyone with 95%-100% success rates submit their decks.
DECKS ONLY! Please don't submit your bot spots!!!
Posted: April 23rd, 2008
Total Posts:77 Joined:2007
rommel62 wrote: Only problem I see is its nearly impossible to pause using f12. Oh, also, the hotbutton setup didnt seem to automatically set up as described, but I did it manually so all was well.

Good Job!
You can only pause the bot during your opponent's turn. which lasts about 2.5 seconds.

As for the Hotkey Setup. When the prompts come up that tell you to mouse over a hotkey, you must click OK to close the prompt before mousing over and pressing F12.
Posted: April 23rd, 2008
beergeek
getting Division by Zero error after winning a parley. Corrected the code in dbinclude.vbs under Parley Logic:

OLD:

Code: Register to unlock hidden link

    If Parley_hasWon then       'Check to see if we won or lost before attempting to play a card.
        VGSendText HK3
        Sleep 500
        VGSendText HK4
        Sleep 500
        ParleysWon = ParleysWon + 1
        debugLog " Parleys Won  : " & ParleysWon
        debugLog " Parleys Lost : " & ParleysLost
        debugLog " Success Rate : " & ParleysWon / TotalParleys * 100 & "%"     '  <--- problem line
    ElseIf Parley_hasLost then
        VGSendText HK3
        Sleep 500
        TotalParleys = totalParleys + 1
        ParleysLost = ParleysLost + 1
        debugLog " Parleys Won  : " & ParleysWon
        debugLog " Parleys Lost : " & ParleysLost
    End If
NEW:

Code: Register to unlock hidden link

    If Parley_hasWon then       'Check to see if we won or lost before attempting to play a card.
        VGSendText HK3
        Sleep 500
        VGSendText HK4
        Sleep 500
        TotalParleys = totalParleys + 1    '  <--- ADDED
        ParleysWon = ParleysWon + 1
        debugLog " Parleys Won  : " & ParleysWon
        debugLog " Parleys Lost : " & ParleysLost
        debugLog " Success Rate : " & ParleysWon / TotalParleys * 100 & "%"
    ElseIf Parley_hasLost then
        VGSendText HK3
        Sleep 500
        TotalParleys = totalParleys + 1     '  <--- ADDED
        ParleysLost = ParleysLost + 1
        debugLog " Parleys Won  : " & ParleysWon
        debugLog " Parleys Lost : " & ParleysLost
    End If
Posted: April 23rd, 2008
beergeek
By the way, I love the auto-setup logic. That may be motivation for me to include something like that in my craft bot, although I think I'd convert most of the configs to .ini format to keep the user from having to copy/paste. The test mode rocks, too. I can see putting that in crafting bot to monitor when step 1 is complete and finish the recipe for you. That all may be a 2.0 release...
Posted: April 23rd, 2008
Total Posts:77 Joined:2007
That's strange, I don't remember getting that error. TotalParleys should increase by 1 in the StartTalking sub before the Parley sub starts.

Code: Register to unlock hidden link

        For a = 1 to 4
            TellCheck
            If Opponent1Moves Then
                MoveToMob getTarget
            End If
            VGSendText HK2
            sleep 500

            for b = 1 to 3
                Mouse.LMouseClick CD_X, CD_Y, 1, 0
                sleep LagDelay
                Mouse.LMouseClick CD_X, CD_Y, 1, 0
                sleep 500
                If Parley_inParley then
                    FaceMob getTarget
                    exit for
                End If
            next

            If Parley_inParley then
                TotalParleys = TotalParleys + 1    <-- should increase here
                debugLog " We have engaged in parley with Opponent " & CurrentOpponent + 1
            Else
                debugLog " We attempted to engage in parley with Opponent " & CurrentOpponent + 1 & ", but they weren't ready."
                exit for
            End If

            While Parley_inParley
                Parley
            Wend
        Sleep 500
        Next
However, the line made more sense where you suggested so I deleted this line, added yours and uploaded a new file.

Thanks man, I'm glad you liked the little extras. Your feedback is always more than welcome:) The .ini format is a great idea and would make setup that much easier. Tomorrow I'm going to look into ini reading/writing in VB.
Posted: April 24th, 2008
beergeek
The exhume wiki documentation has all the ini functions listed. You can also go to Debug - Functions in the debugger, which will give you a decent quick reference to all the available xunleashed functions categorized.

I looked more into the division by zero problem, and found the reason. When running in test mode, you never hit the StartTalking sub. Therefore, TotalParleys never gets incremented. It also only gives the error if you win, since success rate isn't displayed if you lose. In any case, the changes I made and removing the old lines fixes it.
Posted: April 24th, 2008
Total Posts:77 Joined:2007
Yeah, I started working on the ini last night. I don't have internet access at my house so my time with the bot is limited.

I'm not currently at my friends house where my pc is located so I won't be able to add/fix anything for a day or two. So if anyone has any questions regarding the bot and I don't respond right away, it's because I am unable to check the thread.

Thanks again man for tracking down that problem.
Posted: April 25th, 2008
beergeek
I put together a function that will determine what type of parley (incite, interview, entertain, gossip, convince) is available on an npc at the icon coordinates specified. It does this by reading pixel RGB values.

Usage:

function determineParleyType(x as integer, y as integer)


where X,Y is the coordinate of the center of the inkwell on the inkwell icon for the parley you want analyzed. There is about a +/- 4 pixel vertical tolerance from the horizontal centerline through the expression icons.

Returns the following integer:

0: Could not determine (probably bad icon location)
1: Interview
2: Entertain
3: Gossip
4: Convince
5: Incite

In my tests, it worked for all five types, although an Interview was erroneously reported as Entertain at one of the vertical boundaries. It was still reliable within a 9 vertical pixel range in all tests.

The only requirement is the default /parleyassess window. Obviously, pixel analysis is touchy if people start messing with positions or colors.

My suggestion is to have this procedure called four times before each parley after the /parleyasses command is given, one at each possible icon position for four parleys (the locations won't change, just add x pixels to the base loc for each of the three others)

fyi, all local variables have been declared in case you are using option explicit.

Code: Register to unlock hidden link

function determineParleyPixelColor(x,y)        'Support function for determineParleyType(x,y) -- returns 1 if found red button, 2 for green, 3 for blue, 4 for yellow.  Returns 0 if no match

dim pixelColor
dim rval, bval, gval
dim csum
dim rratio, bratio, gratio
dim rtest, btest, gtest

    determineParleyPixelColor = 0
    pixelColor = GetPixelColor(x,y)
    rval= ExtractRGB_Red(pixelColor)
    bval= ExtractRGB_Blue(pixelColor)
    gval= ExtractRGB_Green(pixelColor)
    csum = rval + bval + gval
    if csum > 200 AND csum < 430 then       'filter dark pixels and most light background pixels to save processing time
        rratio = rval / csum
        bratio = bval / csum
        gratio = gval / csum
        'red (demand) check
        rtest = ABS(rratio - 0.66) - 0.015
        gtest = ABS(gratio - 0.19) - 0.015
        btest = ABS(bratio - 0.15) - 0.02
        if (rtest <= 0) AND (gtest <= 0) AND (btest <= 0) then
            determineParleyPixelColor = 1
            exit function
        end if
        'green (reason) check
        rtest = ABS(rratio - 0.28) - 0.015
        gtest = ABS(gratio - 0.47) - 0.02
        btest = ABS(bratio - 0.25) - 0.01
        if (rtest <= 0) AND (gtest <= 0) AND (btest <= 0) then
            determineParleyPixelColor = 2
            exit function
        end if
        'blue (inspire) check
        rtest = ABS(rratio - 0.27) - 0.01
        gtest = ABS(gratio - 0.31) - 0.015
        btest = ABS(bratio - 0.42) - 0.01
        if (rtest <= 0) AND (gtest <= 0) AND (btest <= 0) then
            determineParleyPixelColor = 3
            exit function
        end if
        'yellow (flattery) check
        rtest = ABS(rratio - 0.47) - 0.015
        gtest = ABS(gratio - 0.42) - 0.015
        btest = ABS(bratio - 0.13) - 0.025
        if (rtest <= 0) AND (gtest <= 0) AND (btest <= 0) then
            determineParleyPixelColor = 4
            exit function
        end if
    end if
end function

function determineParleyType(x,y)           'Takes x,y coordinate of center of inkwell in inkwell icon.  Returns 1 if interview, 2 if entertain, 3 if gossip, 4 if convince, 5 if incite.  Returns 0 if no match (error)

dim foundDemand, foundReason, foundInspire, foundFlattery
dim i
dim pixelColor
    
    determineParleyType = 0
    foundDemand = FALSE
    foundReason = FALSE
    foundInspire = FALSE
    foundFlattery = FALSE
    for i = 66 to 206
        pixelColor = determineParleyPixelColor(x+i, y)
       ' debugLog pixelColor
        select case pixelColor
            case 1 foundDemand = TRUE
            case 2 foundReason = TRUE
            case 3 foundInspire = TRUE
            case 4 foundFlattery = TRUE    
        end select
    next
    if foundDemand AND foundReason AND foundInspire AND foundFlattery then
        determineParleyType = 1
        exit function
    elseif foundReason AND foundInspire AND foundFlattery then
        determineParleyType = 2
        exit function
    elseif foundDemand AND foundInspire AND foundFlattery then
        determineParleyType = 3
        exit function
    elseif foundDemand AND foundReason AND foundFlattery then
        determineParleyType = 4
        exit function
    elseif foundDemand AND foundReason AND foundInspire then
        determineParleyType = 5
        exit function
    else
        debugLog "Could not determine parley type!  Possibly the X,Y coordinates aren't correct."
    end if

end function
Posted: April 26th, 2008
Total Posts:77 Joined:2007
Very nice. I talked to my friend and was able to convince him to let me come over tomorrow to mess with the bot. So I'll get this function in for sure. This is definitely gonna help with the lever moving. Thanks man.
Posted: April 26th, 2008
beergeek
anytime... let me know if you need any other function you'd like me to write.
Ready to join the community? Click here and see all of the benefits!
blue large dotWho is online
Users browsing this forum: No registered users and 1 guest
Locked