VhaBot => Feature Requests => Topic started by: Fixhog on January 23, 2010, 04:19:09 AM

Title: Plugin to call scripts we make
Post by: Fixhog on January 23, 2010, 04:19:09 AM
Ok, I make a toon of scripts for org to give them info on different things.
i am not always online to fire the scripts for them.

Can there be a plugin that "calls" scripts to fire?

so !script  would call up a list of clickable names of scripts
you click one and the bot fires a /scriptname in org channel so that the script is fired off.

What we as user of this plugin would need to do is edit a section of the script to put in the name of the script and then move the script to a folder (posibly new?) in the bots folder list.

What ya think? posible?

Title: Re: Plugin to call scripts we make
Post by: Fixhog on January 24, 2010, 01:04:16 AM
After thinking some last night.... Would a plug in modled the same as the !links work?
just change the final command to direct a /script in a tell to the person clicking the link?
Instead of its current command to fire a web site link.

That would allow for a good platform to give catagory to scripts.

Is this posible?

Title: Re: Plugin to call scripts we make
Post by: veremit on January 24, 2010, 01:21:32 AM
I don't think there is any way to make any Bot execute a 'game script' as its an entirely different system .. and the bot doesn't use the game interface to process it.

Similarly, even if you posted in the channel, it wouldn't execute a 'player script' either.

What kind of 'script' did you have in mind?

I -think- what would be nearest, is the !links plugin points to web pages of interest. There isn't presently a 'Guides' plugin like I've seen elsewhere for in-game use.

Title: Re: Plugin to call scripts we make
Post by: Fixhog on January 24, 2010, 02:11:10 AM
!guilds is nice, but not what im after here.
We can make our own "Guilds" through !links and tune it to more topics that are of use to owr orgs needs.

I make scripts like
/bs (lists all the levels and locations for battle stations)
/Farming (Lists a toon of froob able items to clicksave and info on them)
/Gardens (Lists the clan and omni garden names and keys for each)
/Belts (Lists the lowest ql of belts click it to get exact stats info)
/Faction (Lists the amount of Guardian faction required for each area)
/Island (Copied from online some place, makes a nice script of noob island trade skill items)
/Towers (Lists how many towers each level range can plant)

Basically these are just helpful info scripts that people can look up the info....
Most just ask in org channel so its fast and easy for me to pop a script to answer them.
Some scripts just dump the info to org channel like I typed it in.
Others are a click here for info type that opens a box with the info for the users who click.

So I was wondering if there was a way that I could make a directory called Scripts in the Bot Directory and then move those types of scripts there and have a plugin that members then use to access my scripts if I am not online on a toon to fire them.

Hmm if we are un able to get this to happen in the manor I am thinking would it be possible to consider alternative ways?

Such as a plugin that hmmm well how is it that recipebot can do such info?
That info is made into a database and called by the bot by recipe #'s
Would a similar style of programming be able to produce what I am looking for?
I would think it would require some ability on the user to paste script info into the plugin at points designated and be logical enough to add to a script counter system or something?

Perhaps this is just not able to happen in this form, last option I have is to make a web site and put the scripts there in more of a text informative way and use !links as an access for the info for org members.

Title: Re: Plugin to call scripts we make
Post by: veremit on January 24, 2010, 02:36:07 AM
In short, sadly, No.

The long answer .. you'd have to create bot code to create each textwindow for each script. Not a trivial task alas, and then fire on the !command.
I don't think there's even an easy-ish way to display a text file or AOML file if you could put it in the bot folder.

So yeah, nothing I can think of, really. Dunno whether the other code-monkeys can suggest anything. But I'm out :(

Title: Re: Plugin to call scripts we make
Post by: Llie on January 24, 2010, 08:38:39 AM
Seems like text massaging to me.  If one would make a "!script [scriptname]" plugin, the bot would read the script from a configured location or "C:\Program Files\Funcom\Anarchy Online\Scripts" by default and construct a richtextwindow clicky based on the text of the script.

I can immediately think of lots of scripts that are going to give this idea heartburn.  I can also immediately think of the possibility of executing "malicious code" or security risks of doing something like this... (what if I did something like "!script ..\..\..\windows\win.ini" or something more exotic?  Will I crash the bot? will I crash the system? Can I find some other file of interest to have parsed by the bot?)

I think the traditional way to provide scripts to the community is to give the entire package a fancy name "fixhog's scripts of ubahness!" and zip them all up with a fancy readme.txt file and posting them somewhere like aodevs or something.

Title: Re: Plugin to call scripts we make
Post by: Vhab on January 24, 2010, 08:56:49 AM
How about a middle ground.
Instead of running scripts (which can do quite a bit, like /delay etc), a plugin able to display text windows from files.
- !info: displays a list of all .txt files in the /info/ directory
- !info towers: displays /info/towers.txt inside a text window

If people want to exchange 'scripts' they can just exchange the .txt files and dump it into their info directory.

For security, do a regex match on the second argument before using it, if it fails, don't read the file.
A pattern like this would do nicely: ^[a-zA-Z0-9_]+$

Title: Re: Plugin to call scripts we make
Post by: veremit on January 24, 2010, 01:26:17 PM
Sounds like a plan Vhab .. and yes, there are security concerns that can be mitigated by some basic checks.

I suppose there is the possibility of using the AOML tags, etc. to make the window look pretty - I would assume the syntax is the same for the bot windows as for the game itself. Similarly, external links and ItemRefs could be added too. If the AOML is consistent, users can create their TextBlobs in whatever, test them in game, then save to a text file.

Extending my thinking .. if you took the whole "<a href='text" starting block .. the bot could easily check this at the start of the text file, and omit adding it (and the matching End Tag) to the Vhabot textwindow. This would provide pretty good security checking and easy copy-pasting from a script editor like AOscripter/etc.

Title: Re: Plugin to call scripts we make
Post by: Fixhog on January 25, 2010, 08:40:43 PM
I did not think of what risk this project may have as I was considering it as a plug-in that the end user would supply the scripts. Once this is functional (if ever) perhaps a script folder on your web site for us to share our scripts? Although in the risk side of things perhaps not? But why would we want to crash our own bots? There may be reasons I don’t know of since I don’t think in the destructive mind.
So yes put some restrictions and checks into place.

Wow if we could still use the typical bot style commands like click link to stats and or web sites etc through this text file pop up window that would be very nice. And it falls along the lines of a /tell message text box to the user requesting it so spam to org channel stays to minimum very nice :)

This could create a new “style” of script writing for the game :)

Title: Re: Plugin to call scripts we make
Post by: Arys on August 28, 2010, 05:31:16 AM
Hog, I'm not sure how many scripts you have at this point but if you want, go ahead and post any here that you want added to a plugin and I can take a look at writing a general info one for you.

I already have several general info commands built into my fork of vhabot that includes things like:

!zods - Locations of all the zodiacs in Pande
!towerlevels - How many towers you can plant at what levels
!sllevels - Levels required to skip Ergo trials in SL
!titlelevels - List of the title levels and what levels they span
!chips - List of what DOJA chips drop where for what level toons

They are currently additions to the vh_Levels plugin but I could easily break them out into a more general info plugin that could be made public.