ScriptUO

Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: 12TimesOver on November 03, 2008, 11:15:00 AM

Title: Resbot - Looking for input
Post by: 12TimesOver on November 03, 2008, 11:15:00 AM
I'm just having trouble thinking about how to code this logic, looking for insight from someone else.

I would like to have a character hide in a spot and wait for some type of key activity to initiate a res then hide again. So, for example, the script scans the journal for a passphrase. Once passphrase = #TRUE it loads the speaker as the last target and res's them.

I'm just confused as to how I would parse the appropriate information from the journal so that I can compare it to the name of a character on screen. Or is there a better way to do it?

A kick in the direction of a similar routine would be welcome as well, I remember there being a decent BOT script on UOC at one time, not sure who owned that one.

Thanks much gents!

XII
Title: Re: Resbot - Looking for input
Post by: TrailMyx on November 03, 2008, 11:19:28 AM
I've been trying to get Cerveza to post it again... ;)
Title: Re: Resbot - Looking for input
Post by: 12TimesOver on November 03, 2008, 11:25:10 AM
Ah, a first responder!!

So how would you accomplish such a task as getting from the journal scan to loading a ltarget with the ID of the character Mr. Myx?

I've been trying to get Cerveza to post it again... ;)

Ah right, Global Bot was the name. I thought I had DL'd it but no dice, can't find it anywhere. I just went to try to scrape some stuff up over at web.archive.org but unfortunately there is no file download available from UOC without logging in and web.archive.org doesn't seem to have the login mechanism archived as well (one could wish, right?) although I see there is opportunity to scrape together many a decent conversation that was lost in the general forums including a number of the tutorials, etc.

XII
Title: Re: Resbot - Looking for input
Post by: TrailMyx on November 03, 2008, 12:23:39 PM
Well, there's a couple approaches to it.  With Cerveza's GBOT, it was a client/server kinda thing so really there was only one "client" which the bot would interact with.

From what I see with you, you'd like to "service" any number of people who might show up.  So I'm guessing that you'd want to be scanning guild chat?  Whispers?  Anything journal related should have some safeguards to keep people from setting off your bot and determining that you are a cheating mangy scripter.

Either way, it's pretty easy to determine what the #FINDID is from the incoming text.  Really, you need to:

1) Determine if spamed command is from a valid "''customer"
2) Scan within range for valid people #FINDTYPES, and event property them.  The first part in the #PROPERTY (separated by $) should be the character name.  Compare that to what showed up in the #JOURNAL request.
3) If that matches, then do your stuff, res, heal, cure, moon, whatever.
Title: Re: Resbot - Looking for input
Post by: Endless Night on November 03, 2008, 12:26:09 PM
Really shouldnt be that difficult to do.

Could just scan for ghosts. and if they come close rezz em.
Title: Re: Resbot - Looking for input
Post by: Cerveza on November 03, 2008, 12:36:06 PM
I had this on my projects list. PartyBot. Would hang out in your house, drink all your ale and eat all your fishsteaks, pollute your bathroom then talk you into going out to Buc's Den bar.

It would have to run on some type of password, OR you would have to get the ID of the chars allowed to use it.

But basically it would perform simple actions.

I'd listed them once and asked for inputs, but that info is long since gone.

Possibilities include:

Heal me
Rez me
Cure me
Bless me
Gate {location}
Rez pet
Heal pet
Cure pet
Protect me
Hide
Avoid

? more ?

Simple syntax. Walk up and say "X129FG heal me" {password, command, target}.

I even had a decent char template setup for it. I'll try to gather up some of my old stuff and see if I can find anything. No scripting had begun on this, but since GBot worked so well, it seemed that this would be the next logical step.

And with TM's Journal scanning, it seemed like a "plug-n-play" script.
Title: Re: Resbot - Looking for input
Post by: 12TimesOver on November 03, 2008, 12:41:56 PM
Scanning for ghosts could work fine as well but could also limit the flexibility in that, as TM pointed out, I may want to limit the use of the "service" to characters meeting some type of criteria. On the other hand, something like a "Res all ghosts" sub would be handy in a number of scenarios but I was having trouble figuring out how to determine if there is a ghost present as I couldn't see that there was a different ItemID as a ghost but I was having some other trouble when I was testing last night and I may have screwed up.

On the journal scan, etc I guess I just need to learn how to parse the value of #jindex to pull out only the character name. I guess that's what stumps me, how to pull out a certain number of characters from the journal and set it as a !var. I assume it would be something like:

Code: [Select]
Journal scan loop waiting for passphrase (or whatever)
Passphrase = #TRUE, gosub FigureOutCharName
set !varLineInJournal #journal
Parse !varLineInJournal to get all text up to the ':'
Set this string to !varCharName
scan for item type of a player character
when found check if !varCharName in !varLineInJournal

Not too far off I'm assuming but it's the parsing of the #journal value to get the name of the character that spoke the phrase that is confusing me.

Good input so far, I appreciate it!

XII

Cerv - I do remember that conversation, seems like a long time ago!

.edit.
you are a cheating mangy scripter

Heh-heh
Title: Re: Resbot - Looking for input
Post by: TrailMyx on November 03, 2008, 01:16:40 PM
I would really shoot for a set criterion for rezzing.  Some of the more zealot anti-scripters out there may notice there is a rezbot at work; you'll get paged on in a heartbeat regardless of your intentions to do good.
Title: Re: Resbot - Looking for input
Post by: TrailMyx on November 03, 2008, 01:20:46 PM
Another thought for you script is to have an interactive setup where you can target the people you would like the bot to manage.  Then you can database their #FINDIDs for later interaction.
Title: Re: Resbot - Looking for input
Post by: Endless Night on November 03, 2008, 01:22:09 PM
Extracting a name...

str pos #Journal :
Str LEft #journal #Strres
display ok this should be the name : #strres

Or something like that.
I have a sub someplace dthat does it all the types party, allaince etc.. variations on the above...
Title: Re: Resbot - Looking for input
Post by: Cerveza on November 03, 2008, 01:27:44 PM
We had discussed this before, and determined it best to use some "private" chat system.

If someone is hidden and sees you type "XR330B Heal Me" they will know it's a bot running. If you use Party, Guild or UOAM chats, it's limits the accessibility to the commands, but also limits the number of users.
Title: Re: Resbot - Looking for input
Post by: Endless Night on November 03, 2008, 01:31:07 PM
Could also keep a list of allowed players.. and just compare to that...

Players could be added via the pasword system in general chat as above  .. saying something like
Mr cheese watsup!

Then save thier id to the allowed file that script reads on startup.

Then later they would only have to say
Oi heal me now
or
ooOOooOOoo

And becuase thier name and or id already in the list it does its job.
Title: Re: Resbot - Looking for input
Post by: TrailMyx on November 03, 2008, 01:53:35 PM
We had discussed this before, and determined it best to use some "private" chat system.

At least this time the discussion isn't in jeopardy of "disappearing".. lol
Title: Re: Resbot - Looking for input
Post by: Konesky on November 03, 2008, 02:08:21 PM
The first thing I thought of when I read the part about the pass phrase was the fact your ghost is speaking oOOooOo so unless your healer is a Necro they won't be seeing any passphrase anyway, at least unless its in a guild chat, party etc as mentioned below, perhaps im pointing out the obvious here but keep that in mind... you healer will need to be partied up, guilded up or have SS/Necro (whatever one alows you to see ghosts speak).

I've got a little self rez script snippet in a few scripts, nothing to it... add in some hiding and you're done... I think I'm missing something here because this seems like a pretty simple script... This wouldn't perform a check to make sure you're rezzing the keyword speaker but it would make sure the password was recieved before coming unhidden and rezzing the guy immedately beside him... And if the password was spoke but no ghost was beside, it would ignore it...  Am I missing something here? whipped this up for ya, untested give it a try at your house


Code: [Select]
set %passphrase CHEETOES
set %alwaysrezyesno FALSE ;Set this to "TRUE" to rez anyone without PW
;=======================
Start:
for %z 1 2
{
Scanjournal %z
If %passphrase in #journal
 set #result TRUE
}
Finditem KS G_1
If #findkind <> -1 && #result = TRUE
{
 event macro 15 58
 target 6s
 set #ltargetid #findid
 event macro 22 0
 wait 20
}
set #result FALSE
If H notin #charstatus
 event macro 13 21
wait 10
goto Start
Title: Re: Resbot - Looking for input
Post by: _C2_ on November 04, 2008, 07:39:23 AM
I don't know if this is here or not but how about using a #findrep to only allow guildies to get rezzed and or if guild tag in evvent property of the #findid.  I didn't see it in the initial scan of posts.

so somethign like this idea
event prop #findid
if #findrep = (whatever guild member one is) or guilabrv. in #property
   res #findid
Title: Re: Resbot - Looking for input
Post by: 12TimesOver on November 04, 2008, 12:13:00 PM
Some great input here! I really appreciate it!

For starters, EN nailed my question regarding the parsing of the journal to pull out the name information. I'm heading over to read up on the str command after posting this.

As for the function, I envision a couple if not a few different operating modes of which the user chooses at script startup:

1) Manual mode - add of specific object ID's on the Bot account, ie "click this button and select a target that will be allowed to use this Bot". This way the access is managed but requires manual intervention
2) Semi-Automatic mode - a specific code/passphrase is required to be added to the list. This should be customizable at script startup thus is dynamic rather than built specifically into the script. I am thinking this should be a whisper thus within one tile of the bot but I'm still thinking through this. I need to learn a little more about guild chat verse party vs alliance vs general and if there is a way to confirm that it's any of these verse the other.
3) Fully Automatic mode where any ghost within x tiles will get res'd. This can be handy when leaving a char in a house, for example, when fighting or performing other tasks (ie trick-or-treating) whereby new people can jump in with no intervention required. ie someone new jumps into a house fight and can just run inside and get res'd with no intervention required or a password given with the idea that if they have access to the house they should be ok.
4) Semi-auto version 2 - Be automatic only for people with specific criteria in their properties (eg, guild tag).

Res'ng was the only function I have been thinking of initially, not sure if I have the time to run with a full-fledged Bot system like Cerv started working on back on UOC but man, this does sound like a damn cool project. I was actually just looking at changing out my "client/server" configuration with my Trick-or-treat script and Justice gainer scripts with a more automated res routine. I mean, damn, I still have to go understand STR for crying out loud! lol!

Konesky - thanks for your example. I notice that you use the object type of KS to represent ghosts. I looked that up in the EUO object type database and it comes back as a "Sandstone Archway" LOL. I did hear from our buddy JustAnotherFace that this is one of four different object types for ghosts, each representing male/female elf/human. Does this sound right to anyonw else? I haven't tested yet but JaF has never steered me wrong!! :p

XII
Title: Re: Resbot - Looking for input
Post by: Cerveza on November 04, 2008, 12:38:52 PM
Once you have the recognition system down, adding in functions would be totally modular.

Want gating? Add the sub routine with the trigger.
Want healing? Do the same
Want pet assistance? Same thing.

A nice little checkbox menu with options for the BOT might be nice to have also :)
Title: Re: Resbot - Looking for input
Post by: Konesky on November 04, 2008, 02:54:05 PM
Konesky - thanks for your example. I notice that you use the object type of KS to represent ghosts. I looked that up in the EUO object type database and it comes back as a "Sandstone Archway" LOL. I did hear from our buddy JustAnotherFace that this is one of four different object types for ghosts, each representing male/female elf/human. Does this sound right to anyonw else? I haven't tested yet but JaF has never steered me wrong!! :p

...Just a follow up, as mentioned in my example it was untested but I do know that KS is a type of ghost because i cut and paste that from my ToT script. For ideas on Trick or Treating and auto-rezzers, head on over to my mammoth post on Begging. Theres no code there but it outlines in detail how to set it up.

Regarding the ID's, KS is definitely a type of ghost, I never rely on "object type database's" because 1) I dont know where they are and 2) they can be wrong. I've got a neat little script that just lets you target anything you like and it spits back everything about the item... pretty handy, I call it my Item ID finder. You're probably right about there being more types of ghosts, 4 makes sense.

I'm not much for menus or making commercial scripts but if you're looking for something temporary and simple, that one I posted will do, it will work for ya in a house (just change the toggle up top to #TRUE to rez anyone without a password). It will work hidden somewhere for PvP...  and at least you can use it while your learning STR commands and working on the multipurpose rex bot. :)
Title: Re: Resbot - Looking for input
Post by: 12TimesOver on November 04, 2008, 02:58:53 PM
Once you have the recognition system down, adding in functions would be totally modular.

Want gating? Add the sub routine with the trigger.
Want healing? Do the same
Want pet assistance? Same thing.

A nice little checkbox menu with options for the BOT might be nice to have also :)

Funny, I was on my way home tonight thinking the same thing. Every sub would simply be called based on a value showing up in the journal. Then a check is run against a) is the person who said that allowed to use me? b) does the person meet the criteria for the action (eg, if it's asking for a res is it a ghost)? c) potential error checking related responses to the request (eg, target not close enough or can't res in that location in journal msg "move closer idiot").

Could be quite cool really. Some other modules could be along the lines of "follow me", "area peace", "peace target", "stay", "repair my stuff", "Add xxx to party", on and on! Great potential!

I'd start by parking him in Doom lol.

The modes could be "Guild Tag", "Password", "Fully Automatic (answer to anyone)", "Fully Manual (answer to nobody until added to the list)". Also something about commands requiring party chat would be good too; is that based on journal text color or is there a better way to do it?

Oh, and Konesky, I never doubted your object type accuracy (and JaF confirmed for me that it was one of four), I just found the "Sandstone Archway" funny and wanted to post it :) Your snippet was actually very helpful!

XII
Title: Re: Resbot - Looking for input
Post by: Endless Night on November 04, 2008, 06:00:16 PM
Dont ever rely on that item database over on easyuo.. it is completely out of date

And yes thier are 4 ghost types as you summerized.. human elf male female.
Title: Re: Resbot - Looking for input
Post by: TrailMyx on November 04, 2008, 06:46:41 PM
Dont ever rely on that item database over on easyuo.. it is completely out of date

And yes thier are 4 ghost types as you summerized.. human elf male female.


Umm, plus also it seems that some RunUO item types have worked their way into the mix...
Title: Re: Resbot - Looking for input
Post by: Scrripty on August 03, 2009, 03:03:53 PM
I'd be interested in helping out on this if it was turned into a project... :)  I'm working on a fairly advanced version of Cerv's Gbot as we speak.  The damn thing is better then most noob pvpers at being a backup healer. :)
Title: Re: Resbot - Looking for input
Post by: welgill on August 04, 2009, 05:21:38 PM
I can actualy help with this one check out lord sids work on euo he had a working minerbot control was through a http server if i remember right was way above my knowlege level but we ran it on opening of lake austin so I know it worked
Title: Re: Resbot - Looking for input
Post by: Scrripty on August 04, 2009, 06:59:37 PM
As an interesting note on this, I've added a rail system to my healer bot, which I use voice commands to control.  I can call out a spot number on the rail and the bot will stealth to that spot.  The problem I have is my mouse location has to be in the middle of the screen when I do it or he runs and comes out of stealth.  I'm looking for a way around that.  Unless it's an emergency.  I'm also adding archery to him so I can use him as a dismount heal/bandage/res bot.  On the fly.  I'm doing an emergency hide/stealth away button too when I get a chance.  So if I die, he'll use invis and stealth the hell out on the rail! haha  Thanks for getting me started on this. :)  The rail I have goes to the most usual spots I pvp at yew gate for now.  Just testing it.  It also takes a round about way so as not to run into people.  I need to add a check so he will rehide on reveal.  I also want to add a few voice commands so that I can command him to do things irregardless of what he's doing atm.  Like queue up a dismount.  I was thinking, have the script put numbers above each players head, then when I say attack 1, the script will set that char as the target, and when it's within distance, toggle dismount and attack.  Then hide with magery and steath back on the rail some and wait a certain amount of time and come back. :)  Ideas ideas... :)