How do you use client scripting?

Requests for assistance and other HOWTOs.

Moderator: Board moderators

Kevin Rudat
Newbie
Posts: 5
Joined: Thu Jun 05, 2003 2:17 pm

How do you use client scripting?

Post by Kevin Rudat »

I'm trying to figure out a good set of commands for scripts to manipulate the item tabs. Suggestions are very welcome. Also:

What do you have your scripts do?

How do you debug your scripts?

(What language do you write your scripts in?)

What do you think about the script commands we've already got?

Do you have one big monolithic script, or lots of little ones?

Do you run the same script more than once?

Do you have multiple copies of the same script running at the same time?

I'd really love to see people's scripts - consider private-message-thingy if you don't want other people to see them (e.g. keep TC scripting from spreading?)
Mith
Senior member
Posts: 348
Joined: Mon Oct 25, 2004 5:53 pm
Location: somewhere in nowhere

Re: How do you use client scripting?

Post by Mith »

Kevin Rudat wrote: I'm trying to figure out a good set of commands for scripts to manipulate the item tabs. Suggestions are very welcome.
i have very limited knowledge about scripting, so i'm also interesting :)
Kevin Rudat wrote: What do you have your scripts do?
to do stupid things in large numbers ;)
Kevin Rudat wrote: How do you debug your scripts?
by reading them again and again and finally trying them. (preferably at localhost)
Kevin Rudat wrote: (What language do you write your scripts in?)
bash - i use linux.
every language should do fine, as long as you have an interpreter for them. Don't ask me about windows, i have absoutely no idea...
Kevin Rudat wrote: What do you think about the script commands we've already got?
phew... there are huge possibilities, but i know little... theoretically it should be possible to create a 'shopping script' some script that searches for something in all shops, but that would require a LOT of work
Kevin Rudat wrote: Do you have one big monolithic script, or lots of little ones?
just a few little ones
Kevin Rudat wrote: Do you run the same script more than once?
Do you have multiple copies of the same script running at the same time?
serial, not paralel. scripting is only useful if you use it more than once (or use it once for a long time, for example to move a lot of items from one part of your appartment to an other part.)

basically, scripting is a huge keybinding, but more powerful
Bibendi ergo sum
or rather: sum ergo bibendi
Kevin Rudat
Newbie
Posts: 5
Joined: Thu Jun 05, 2003 2:17 pm

Re: How do you use client scripting?

Post by Kevin Rudat »

Mith wrote:
Kevin Rudat wrote: How do you debug your scripts?
by reading them again and again and finally trying them. (preferably at localhost)
What do you do if your apartment-reshuffling script walks you into a wall? :)

What do you do if bash fails?
Mith wrote:
Kevin Rudat wrote: What do you think about the script commands we've already got?
phew... there are huge possibilities, but i know little... theoretically it should be possible to create a 'shopping script' some script that searches for something in all shops, but that would require a LOT of work
What do you think of the way your script talks to the client? Would you change anything?
Mith wrote:
Kevin Rudat wrote: Do you run the same script more than once?
Do you have multiple copies of the same script running at the same time?
serial, not paralel. scripting is only useful if you use it more than once (or use it once for a long time, for example to move a lot of items from one part of your appartment to an other part.)
I heard that people run a more intelligent auto-eat script. Wouldn't someone run that and their Apartment Management script at the same time?
Aaron
Senior member
Posts: 496
Joined: Sun Jan 30, 2005 9:04 pm
Location: New Jersey
Contact:

Post by Aaron »

well, im not sure, but i would guess that the auto-eat script would have to be included in what ever script is running, killed then re-launched, or is just hacked to allow it to run in the background...
techolous
Regular
Posts: 77
Joined: Thu Jun 17, 2004 2:41 am
Location: Eastern Coast of the United States

Post by techolous »

more than one script can be running at the same time.

scripts - lists running scripts, and numbers asociated with them
scriptkill SCRIPTNO (or something like that) - kills the script

as for any errors the script makes, it has to correct them itself

there is some documentation in cvs (not shure about the releases):
client/Documentation/scripting.html , I think ...
bort
Forum Junkie
Posts: 607
Joined: Sun Jun 20, 2004 9:40 pm
Location: LG

Post by bort »

Anyone have an example of scripts to share?
lordyoukai.DA
My wraith is cooler than your dragon.
techolous
Regular
Posts: 77
Joined: Thu Jun 17, 2004 2:41 am
Location: Eastern Coast of the United States

Post by techolous »

bort wrote:Anyone have an example of scripts to share?
Well, I would like to setup a repository, but I lack the resources to do so.
techolous
Regular
Posts: 77
Joined: Thu Jun 17, 2004 2:41 am
Location: Eastern Coast of the United States

Post by techolous »

Ok here are two python scripts I have made, the first one is mostly useless, the seccond issues "use_skill inscription" with lines from a text file.

This one pops up a window, with a button, that when clicked, moves you move north, and then makes you say "blip". After that, the window closes, and the script exits.

NOTE: requires pygtk

Code: Select all

#! /usr/bin/env python

import pygtk
pygtk.require('2.0')
import gtk

def hello(fubar):
        print("issue 1 1 north")
        print("issue 1 1 say blip")
        gtk.main_quit()

def main():
        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        button = gtk.Button("BLIP!")
        button.connect("clicked", hello)
        window.add(button)
        button.show()
        window.show()
        gtk.main()
main()
This script sends "use_skill inscription" for every line in a text file.
That results in it writing the contents of the textfile in a book, if a book is marked, and the user has the "inscription" skill at the time (usualy gotten by holding a pen). Otherwise it will probaly make the server send a bunch of error messages.

Code: Select all

#! /usr/bin/env python
#writes books from a text file

#replace "FILEHERE" with the path to the text file
file = "FILEHERE"

fileobject = open(file, "r")

#Each string in this list has a newline char on the end #except for the last one, this combined with "print"
#adding a newline also, works, but seems unclean
lines = fileobject.readlines()

for line in lines:
        print("issue 1 1 use_skill inscription " + line)
bort
Forum Junkie
Posts: 607
Joined: Sun Jun 20, 2004 9:40 pm
Location: LG

Post by bort »

And how do you use the second script :)
You have my attention.
lordyoukai.DA
My wraith is cooler than your dragon.
Rednaxela
Senior member
Posts: 434
Joined: Wed Jan 26, 2005 5:13 am

Post by Rednaxela »

replace FILEHERE with the path to the file, then run the script with "script <pathtoscript>" in the client. And make sure you have a pen in your invintory and the item to write on marked. (and of course, you need python as that's what these ones are written in :P )
Post Reply