Download Game! Currently 104 players and visitors. Last logged in:TontoToudiDornierBauglir

BatMUD Forums > Batclient > Re: plugin/scripting interface

 
 
#1
06 Apr 2012 01:34
 
 
While poking around in batclient's code I noticed that the plugin and for that
matter also the scripting interface is far more powerful than
http://www.bat.org/batclient/javadoc/ makes it look like, there are plenty of
functions that can be used, but simply aren't mentioned. The first such
function I found was in 'ClientGUI' the function 'printMap(ParsedResult pr)'
with that you can print directly in the map window. But far more important
there is also a public membervariable named 'partyFrame' which points to the
party window. Yes koho that is overwhelming powerful. Unfortanely mythicscape
decided to rename all the functions in that class to such silly things like
"do,for,if,case,byte", the problem with that is while the java vm is
perfectly fine with executing them, no matter how they are named the java
compiler dislikes these names. So to use the functions there we have to
directly invoke them - that means the get the class-object 'getClass()' and
then get the methodes from the class 'getDeclaredMethods()' and invoke them
'invoke(Object, Object...)'. I am posting this now because I won't have much
time tomorrow and want to share what I found sofar, this is a list of the
functions and my guess on what they do.

http://pastebin.com/PPW3vmkf

The most useful one sofar is probably 'java.lang.String case(int,int)' which
returns the player name of the player in the position row,cols. This should
allowed to rewrite the 1 button heal script to not need @partyTarget.

 
 
 
Tugmeno
165d, 2h, 48m, 24s old
Level:
76
 
 
#2
07 Apr 2012 01:53
 
 
I finally figgured out how the .c(String) methode works and I have to say it is
pretty much the most important one for us in that class.
The methode takes a String argument and then directly splits it at " " to form
a string array. This string array is then used to update the party window. From
earlier experiments with capturing batclient special packages I found one that
contained quite a bit of party information but I never figgured out what
everything does. Now this string looks like it just the message body, so here
is what I found out on what the values of the string array do:

[0] name [1] race [2] ?? [3] lvl [4] hp [5] hpmax [6] sp [7] spmax [8] ep [9]
epmax [10] partyname with _ for " " [11] row [12] cols [13] >0 means blue star
[14] >0 means not entry tank [15] if >0 member is oof [16] ?not used? [17] >0
means flag3 [18] >0 leader [19] >0 means ld [20] ?not used? [21] >0 means idle
[22] >0 means invis [23] >0 means dead [24] >0 means stuned [25] >0 means uncon
[26] exp [27] total exp of the party [28] active in seconds [29] created

I didn't found anyone for testing in a party with more than one member, but
from what I can tell it should be called for each member about once every 3
secs or so, but nothing prevents us from calling it a few times faster and
everything gets overwritten with the next call. The values for entry tank,party
leader and party owner are a bit confusing, 2 of the values appear to be not
used at all and I have no idea what [2] does.

If you just want to see some result try

clientGUI.partyFrame.c("????? centaur 1 99 500 100 700 1000 300 3000
THIS_IS_APARTYNAME 2 1 0 0 0 0 0 0 0 0 500 1 0 0 0 500 8000 5
Sat_Apr_07_00:11:43_2012");

About some of the values:
[0] you can put here pretty much everything you want, the client doesn't cares
[1] while the client doesn't cares if you invent a new race, loading a picture
might fail in that case it falls back to some default picture
[3] while the client can display IV correct is trys to convert the level to an
integer at some point and fails. I haven't found out why it does that.
[10] for the party name use _ instead of " "
[29] party created date can be anything, doesn't has to be a date - again _ for
" "
[11] & [13] if you change that you can create fake players in the party window
untill a real player gets placed in that slot.

 
 
 
Tugmeno
165d, 8h, 16m, 18s old
Level:
76