Text that is in this colour is the actual script itself. Descriptions, help etc will be written in standard white text.
Section 1: Declaring Events
Not all Events are declared at the start of the script, some are declared as needed and these will be referenced as the script unfolds.
[Script]
OnWorldDisconnectEvent WFS_IN Description
What the bot will do when it notices it got disconnected from the world
OnWorldReconnectEvent WFS_OUT Description
What the bot will do when it notices it has reconnected to the world
OnCLConnectEvent Connects Description
What the bot will do when it receives a successful connect to the Xelagot
Server
OnCLLoginEvent LogsIn Description
What the bot will do when it logs into the Xelagot server
OnCLMessageEvent Reads Description
What the bot will do when it notices a message on the Xelagot server
OnCLDisconnectEvent Disconnects Description
What the bot will do when it has been disconnected from the Xelagot server
OnCLAddEvent OneMore Description
What the bot will do when it notices another bot on the Xelagot server
OnCLDeleteEvent OneLess Description
What the bot will do when it notices another bot leave the Xelagot server
OnCLUnsent NotThere Descriptions
What the bot will do when it tries to contact another bot on the Xelagot
server but its not there.
OnCLHearEvent Hear Descriptions
What the bot will do when it hears a command issued to itself on the server.
OnCLAnswerEvent Hear Descriptions
What answer the bot will do when it hears a command issued to itself on
the server.
The above events are merely a basic set, in the case of the Shadow
they have little reference to the operation of the script, the monster
bots on the other hand rely solely on the "Hear" events they receive from
the Shadow. Shadow initiates all commands to these bots via the server
but it does not take orders on the return side. the events are mainly for
self checking.
OnChatEvent Chat Description The
main chat event, without this the Shadow would not respond to a single
word the player says :) There are other "chat" events defined at other
points within the script.
OnTimeoutEvent Timeout Description
The time event that tells the Shadow when the players hour is up. After
1 hour this event is triggered and the Shadow quits the game.
OnAvatarDeleteEvent AvDelete Description
If a player dissappears from the Shadow's range for any reason this event
will notify the bot of the fact and initiate a response - in this case
the bot will wait for 60 seconds hoping the player returns, if they don't
it automatically quits the game session.
The above events are defined at the end of the script. There you can see the response/action to each event.
Section 2: Declaring Variables
var $MyLogin, &player, $person, &person,
/t_player, $avd, %avd, %tl, $avadd, $person1, &person1
var $M1, $M2, $Dragon, $Brigand, $Scorpion,
$Skeleton, $Ant, $Beetle, $Orc, $Mantis, $Bug, $Bee, $encend, $encenda,
$encendb
var /s_mydata, $data, /s_myfdata, $fdata,
/s_mydata1, $data1, /s_ldata, $ldata, %la, /s_ldata1, $ldata1, /s_chdata,
$chdata
var %sum1, %sum2, %add, %new, %opp2, %opp1,
%opp12, %us, %defence, %attack, %oppdam, %oppatt, %oppdef, %aa, %ab, %ac,
%ad, %damage, $win, $win1, $win2, $win3, %head, %heads
var $mon, %mon, $enc, %trn, %trg, %ga, %pa,
%pb, %pc, %pd, %ranchat, $ranchat, $ranc, $time
var @m1, @m2, @m3, @m4, @m5, @m6, @m7, @m8,
@m9, @m10, @m11, @m12
var @l1, @l2, @l3, @l4, @l5, @l6, @l7, @l8,
@l9, @l10, @l11, @l12, @l13, @l14, @l15, @l16, @l17, @l18, @l19, @l20
var %d1, $start, %d2, $age, %d3, $sex, %d4,
$hair, %d5, $eyes, %d6, $player, %d7, %gold, $gold, %d8, %level, %d9, %xp,
%d10, %hp, $hp
var %d11, %str, %d12, %dex, %d13, %arm, %d14,
%weap, %d15, %att, %d16, %def, %d17, %d18, %d19, %d20
Var %w1, $w1, %w2, $w2, %w3, $w3, %blupot,
%redpot, %grnpot, %purpot, %it1, $it1, %it2, $it2, %it3
Basically all the multi-variables that need to be defined by the bot in the script. In a Xelagot a variable such as "$t" needs no declaration, yet the variable "$t1" does. Any variable that is greater than one character in length requires declaration via the "var" statement.
Section 3: Defining Variables
Most important that variables are defined so the bot has a value for them. These definitions are what most people will alter to change the behaviour of the Shadow bot.
%avd = 60 The number of seconds
to wait when the player leaves the world or the range of the bot before
initiating game quit
$avd = startup The label name to
reset to if the player returns before the above time limit is reached
%t = 60 The number of minutes the
player is allowed to play this session before the bot says they have had
enough and quits
%u = 90 The number of minutes alloted
before the player can say "start adventure" again. Note this is 90 as game
play is 60, thus an extra 30mins after the game ends is the actual time
%r = 2.3 The radius of the sphere
the bot checks to see if the player is standing at a location. Each location
is treated as a sphere set at that point, the sphere here has a 2.3m radius
%w = 10 The speed (step) at which
the bot joins the player
%x = 2 The distance from the player
the Shadow stands
%y = 330 The angle from the player
the Shadow stands
%z = 0 The angle (with respect
to the player) that the Shadow stands. 0 means it faces the same direction
as the player.
%b = 1 This is a definition for
the number 1. it is used in random generation and a lot of other things.
eg: random monster between 1 an 10, thus between %b and %d DO NOT ALTER
%c = 6 Another number definition
like above - DO NOT ALTER
%d = 10 Another number definition
like above - DO NOT ALTER
%e = 20 Another number definition
like above - DO NOT ALTER
%f = 50 Another number definition
like above - DO NOT ALTER
%h = 4 Another number definition
like above - DO NOT ALTER
%i = 100 Another number definition
like above - DO NOT ALTER
%j = 8 Another number definition
like above - DO NOT ALTER
%d1 = 1 These variables refer to
the data loading. Each data file is a line of comma separated fields. The
%d? is basically telling the bot which field is required eg %d3 is the
3rd field
%d2 = 2 As above
%d3 = 3 As above
%d4 = 4 As above
%d5 = 5 As above
%d6 = 6 As above
%d7 = 7 As above
%d8 = 8 As above
%d9 = 9 As above
%d10 = 10 As above
%d11 = 11 As above
%d12 = 12 As above
%d13 = 13 As above
%d14 = 14 As above
%d15 = 15 As above
%d16 = 16 As above
%d17 = 17 As above
%d18 = 18 As above
%d19 = 19 As above
%d20 = 20 As above
$data = playerchar.txt The name
of the file that contains all the players statistical data
$data1 = playeritems.txt The name
of the file that contains player items and info
$fdata = temp.txt The data file
the bot uses to see who started the adventure. This file is written by
advshadow1.txt when you say start adventure
$ldata = Locations1.txt The name
of the 120 random locations data file the bot uses to calculate the encounter
positions from
$ldata1 = Locations2.txt The name
of the file that holds 12 static locations (shopd etc)
$chdata = rumours1.txt The name
of the file that holds all the rumours
$M1 = M1 The name of the bot that
is playing monster number 1
$M2 = M2 The name of the bot that
is playing monster number 2
$Brigand = "Hear,Play the encbrigand" The
string to send to the monster bots to initiate attack by brigands
$Scorpion = "Hear,Play the encscorpion" The
string to send to the monster bots to initiate attack by scorpions
$Bug = "Hear,Play the encbug" The
string to send to the monster bots to initiate attack by bugs
$Bee = "Hear,Play the encbee" The
string to send to the monster bots to initiate attack by bees
$Skeleton = "Hear,Play the encskeleton" The
string to send to the monster bots to initiate attack by skeletons
$Ant = "Hear,Play the encant" The
string to send to the monster bots to initiate attack by ants
$Beetle = "Hear,Play the encbeetle" The
string to send to the monster bots to initiate attack by beetles
$Orc = "Hear,Play the encorc" The
string to send to the monster bots to initiate attack by orcs
$Mantis = "Hear,Play the encmantis" The
string to send to the monster bots to initiate attack by praying mantis
$Dragon = "Hear,Play the encdragon" The
string to send to the monster bots to initiate attack by dragons
$encend = "Hear,end the play" The
string to send to the monster bots to tell them they are dead :)
$encenda = "Hear,finish" The string
to send to the monster bots to tell them the player has quit the game
$encendb = "Hear,start" The string
to send to the monster bots to tell them someones starting to play
$win1 = "We are winning! We have killed one"
The
string to say to the player when they kill a monster
$win2 = "We have won! We have killed them
all" The string to say to the player when they killed all monsters
in that encounter
$win3 = "We are winning! We have killed a
dragon" The string to say when the player kills a dragon (not
sure if this is used)
@e = <<world coords eg: myworld 10.0n
10.0w 0.0a >> The coordinates the shadow enters the world when
"start adventure" is initiated
Section 4: Logging on to the Xelagot server
These lines should be self explanatory - the first thing the bot does is connect to the Xelagot server.
BotName Shadow
GetName $MyLogin
ClHost <<"your computer hostname or
IP address">>
CLPort <<Port number the Xelagot server
is working on>>
CLLogin $MyLogin
CLPassword <<"your bots password to
the bot server">>
CLConnect
Section 5: Click
here to go to next page and continue reading :)
==============================================