 |
The Collective Mynd
Development help for third party software in Furcadia
|
| Complete Working Guildbot |
The Collective Mynd Forum Index -> Script Archives |
| View previous topic :: View next topic |
| Author | Message |
Dreamless Dancer
Code Crasher
Joined: 24 May 2004
Posts: 142
|
Posted: Fri Aug 27, 2004 6:22 am Post subject: Complete Working Guildbot |
 |
|
Guildbot download wrapper page.
NOTE: This bot works, though I would prefer if you would get GuildBot II for that is the "current" bot in which all future development will be conducted.
EDIT 9/18/04, Ok, I lied just a bit on the above, there was an error which is fixed in the download. Note to self: Beware Cut And Paste of code for the variable names need to be changed.
First off, no posting in this thread, if you have a question, please ask it in Golemspeak and I will answer it there, as well as adjusting this post as needed to reflect the changes I implement to meet problems with this bot. Modifications for this bot will be handled in separate threads.
Ok, bearing in mind that the PHP and Browser will not tolerate a massive post of all the code in one chunk, this post will be broken up into smaller sections, each section containing parts of the code. This is a complete bot for version .24 of Silver Golem, it's using the workarounds described elsewhere to ensure that the script works completely. Also, another bug was discovered in creating this bot, mainly that if you add a map dynamically to the active maps list, the bot does not prompt you to save the bot when exiting. But that's a minor whoops. First, I'm posting the complete command list which is also the replies.ini used by the bot for ingame help.
| replies.ini wrote: |
[owner]
Owner commands: {add controller}
{remove controller}
[controllers]
Controller commands: {fix your map}
{add member}
{remove member}
{add ban}
{remove ban}
{add share}
{remove share}
{add greeting}
{block greeting}
{delete greeting}
{get greeting}
{grant greeting}
{remove greeting}
you may also summon me. Remember
all commands requiring a name need to be pipe-spaced.
[members]
Member Commands: {see greeting}
{set greeting}
{share}
i will also summon you. Leave the {} off when requesting help * for any command, eg. help set greeting.
[add controller]
Grants the furre named in word3 the ability to modify the member list.
[remove controller]
Removes the furre named in word3 from the controller list.
[fix your map]
For when i am not responding to commands, but of course
if i'm talking to you
you don't need this.
[add member]
Adds said furre to the member list
granting them the ability to change their greeting and gives them share. Also sets up their money. If said furre already exists
command does not reset their greeting or money.
[remove member]
Removes said furre from the member list, deleting their greeting and money as well.
[add ban]
Adds said furre to the banning list.
[remove ban]
Removes said furre from the banning list.
[add share]
For either adding a friend you want to share with
or restoring a member's share when it was revoked a rule violation.
[remove share]
To remove autoshare from someone.
[add greeting]
Specifically for setting a greeting for someone
they do not have to be a member for them to have a custom greeting.
[block greeting]
Removes the ability for someone to change their greeting
the only reason for this is if someone set a gross or inappropriate greeting and you set a specific greeting for them which they are not allowed to change.
[delete greeting]
Completely removes a custom greeting and the ability to change it from a player.
[get greeting]
Allows controller's to get anyone's greeting.
[grant greeting]
Grants anyone the ability to change their greeting
they do not have to be a member.
[remove greeting]
Removes the custom greeting for said furre
does not remove the ability of said furre to change their greeting.
[see greeting]
Retrieves YOUR greeting.
[set greeting]
Sets your greeting. Remember
you are responsible for the content of the greeting
you should include something which indicates your name someplace in the greeting.
[share]
Just in case I manage to not see you when you enter the dream. |
|
|
Dreamless Dancer
Code Crasher
Joined: 24 May 2004
Posts: 142
|
Posted: Fri Aug 27, 2004 6:33 am Post subject: |
 |
|
add remove controllers
The very first thing to do, is set yourself up as a controller. The command for doing this is add controller *, this will create the members.ini, money.ini, and greets.ini. This is the only bot owner command I use in the script, all other list control commands check against the controllers list in members.ini.
| Code: |
(0:6) When a furre whispers anything,
(1:4) and the message is something like {add controller *},
(1:127) and {[player]} is on the bot owner list.
(5:78) remove {[word3]} from the list in section {controllers} of file {members}.
(5:76) add {[word3]} to the list in section {controllers} of file {members}.
(5:12) whisper {"[word3]" is now a controller} to the triggering furre.
(0:6) When a furre whispers anything,
(1:4) and the message is something like {remove controller *},
(1:127) and {[player]} is on the bot owner list.
(5:78) remove {[word3]} from the list in section {controllers} of file {members}.
(5:12) whisper {"[word3]" is no longer a controller} to the triggering furre. |
P.S. be sure you set yourself up correctly in the Bot Owners. |
|
Dreamless Dancer
Code Crasher
Joined: 24 May 2004
Posts: 142
|
Posted: Fri Aug 27, 2004 6:43 am Post subject: |
 |
|
runtime clock, map fixing routine
summon & join
Every bot needs an UpTimer. For this bot I've chosen to only implement a minutes UpTime.
The map fixing routine is unique for I'm using a different method of retrieving the correct map from the game server. We know that bots react faster than the game server responds, so doing a who and expecting the results withing the same time frame is a no brainer. So I set up a count down timer in Silver to wait till the correct map is retrieved by the bot.
On the summoning and joining, you will note that only controllers can summon the bot, and any furre who is not banned may join. This is something I think may be overlooked by some, that an open joining bot will gladly summon those who are banned, then ejecting them when they arrive, which means that a malicious scriptor could overload your bot with a banned character.
| Code: |
(0:45) When {60} seconds have passed,
(5:69) take variable {uptime} and add {1} to it.
(5:15) set the bot's description to {[golem.desc] ([uptime])}.
(0:6) When a furre whispers anything,
(1:123) and {[player]} is on the list in section {controllers} of file {members}.
(1:2) and the message is {fix your map},
(5:21) check who is on the map.
(5:68) take variable {newmap} and store {10} in it.
(5:68) take variable {callback} and store {[player]} in it.
(0:45) When {1} seconds have passed,
(1:115) and variable {[newmap]} is greater than {0}.
(5:70) take variable {newmap} and subtact {1} from it.
(5:2) display {map tick: [newmap]} in the connection log.
(0:45) When {1} seconds have passed,
(1:114) and variable {[newmap]} is equal to {5}.
(5:21) check who is on the map.
(0:45) When {1} seconds have passed,
(1:114) and variable {[newmap]} is equal to {1}.
(5:85) remove {[map]} from the active maps list.
(5:84) add {[map]} to the active maps list.
(5:11) whisper {map fixed:[map]} to {[callback]}.
(0:27) When a furre requests to summon the bot,
(1:123) and {[player]} is on the list in section {controllers} of file {members}.
(5:45) join the triggering furre.
(0:26) When a furre requests to join the bot,
(1:124) and {[player]} is not on the list in section {banned} of file {members}.
(5:47) summon the triggering furre. |
|
|
Dreamless Dancer
Code Crasher
Joined: 24 May 2004
Posts: 142
|
Posted: Fri Aug 27, 2004 6:52 am Post subject: |
 |
|
add remove members
Personally, I dislike the idea of "open joining" of a club or any member oriented activity, but for those who want to run automated signup bots, I will (at a later date) provide a chunk to grant that, but for now, in this bot, only controllers can sign someone up. This will add their names to all three control sections for the bot, as well as creating a money entry and a greeting entry for that player. The code is designed with a bit of foolproofing in it, if the player does exist, it recovers their money balance and their custom greeting, the bot does fail to fill a value from a list if it does not exist in the list. THIS IS GOOD, for it permits one to preload values and not have them erased with garbage when loading from the list (and said item does not exist) and does not require one to have extensive return value checking before setting a default value for something, one instead sets the default value first, and if the item exists in the list, then that replaces the default value, otherwise, the default value is used.
While (further down) I include a bit of a method for crediting a member with a bit of "silver" for visiting the guild, there is no other bankbot code in here.
| Code: |
(0:6) When a furre whispers anything,
(1:4) and the message is something like {add member *},
(1:123) and {[player]} is on the list in section {controllers} of file {members}.
(5:78) remove {[word3]} from the list in section {members} of file {members}.
(5:76) add {[word3]} to the list in section {members} of file {members}.
(5:78) remove {[word3]} from the list in section {shares} of file {members}.
(5:76) add {[word3]} to the list in section {shares} of file {members}.
(5:78) remove {[word3]} from the list in section {greets} of file {members}.
(5:76) add {[word3]} to the list in section {greets} of file {members}.
(5:68) take variable {fraction} and store {0} in it.
(5:74) in section {[word3]} of file {stats}, get the value of {silver} and store it in variable {fraction}.
(5:68) take variable {decimal} and store {0} in it.
(5:74) in section {[word3]} of file {stats}, get the value of {gold} and store it in variable {decimal}.
(5:68) take variable {greeting} and store {default} in it.
(5:73) in section {[word3]} of file {stats}, write {[fraction]} as the value for {silver}.
(5:73) in section {[word3]} of file {stats}, write {[decimal]} as the value for {gold}.
(5:74) in section {[word3]} of file {greets}, get the value of {greets} and store it in variable {greeting}.
(5:73) in section {[word3]} of file {greets}, write {[greeting]} as the value for {greets}.
(5:12) whisper {member "[word3]" added to the database with a balance of #SM[decimal].[fraction]} to the triggering furre.
(0:6) When a furre whispers anything,
(1:4) and the message is something like {remove member *},
(1:123) and {[player]} is on the list in section {controllers} of file {members}.
(5:78) remove {[word3]} from the list in section {members} of file {members}.
(5:78) remove {[word3]} from the list in section {shares} of file {members}.
(5:78) remove {[word3]} from the list in section {greets} of file {members}.
(5:79) remove the section named {[word3]} and all values in it from file {stats}.
(5:79) remove the section named {[word3]} and all values in it from file {greets}.
(5:12) whisper {member "[word3]" removed from the database} to the triggering furre. |
|
|
Dreamless Dancer
Code Crasher
Joined: 24 May 2004
Posts: 142
|
Posted: Fri Aug 27, 2004 7:05 am Post subject: |
 |
|
add remove share
Being able to set share independantly of adding members is always a good thing, if a member breaks a rule, then you can remove their share for a period of time as punishment, or you can add someone as a shared friend if you so desire. Remember, autosharing can only be done by the owner of the dream, and will not happen unless you follow the guidelines here: Coming to, leaving, and staying on a map.
| Code: |
(0:6) When a furre whispers anything,
(1:4) and the message is something like {add share *},
(1:123) and {[player]} is on the list in section {controllers} of file {members}.
(5:78) remove {[word3]} from the list in section {shares} of file {members}.
(5:76) add {[word3]} to the list in section {shares} of file {members}.
(5:32) share control of the dream with {[word3]}.
(5:12) whisper {share added for "[word3]" to the database} to the triggering furre.
(0:6) When a furre whispers anything,
(1:4) and the message is something like {remove share *},
(1:123) and {[player]} is on the list in section {controllers} of file {members}.
(5:78) remove {[word3]} from the list in section {shares} of file {members}.
(5:42) remove share from the furre named {[words]}.
(5:12) whisper {share removed for "[word3]" from the database} to the triggering furre. |
|
|
Dreamless Dancer
Code Crasher
Joined: 24 May 2004
Posts: 142
|
Posted: Fri Aug 27, 2004 7:15 am Post subject: |
 |
|
add remove adjust custom greeting
Next to having share, probably one of the biggest perks is the ability to have a custom greeting. But like many things, it too can be abused, or perhaps you want to set a specific greeting as a warning to certain visitors, or even to a member. So this is a large chunk of code because Silver Golem has no means of parsing a string and determing if the name is in it, or that it's improper. You can even set a greeting for someone who's banned!
| Code: |
(0:6) When a furre whispers anything,
(1:4) and the message is something like {grant greeting *},
(1:123) and {[player]} is on the list in section {controllers} of file {members}.
(5:78) remove {[word3]} from the list in section {greets} of file {members}.
(5:76) add {[word3]} to the list in section {greets} of file {members}.
(5:68) take variable {greeting} and store {default} in it.
(5:74) in section {[word3]} of file {greets}, get the value of {greets} and store it in variable {greeting}.
(5:73) in section {[word3]} of file {greets}, write {[greeting]} as the value for {greets}.
(5:12) whisper {ability to change greeting given to "[word3]"} to the triggering furre.
(0:6) When a furre whispers anything,
(1:4) and the message is something like {block greeting *},
(1:123) and {[player]} is on the list in section {controllers} of file {members}.
(5:78) remove {[word3]} from the list in section {greets} of file {members}.
(5:12) whisper {ability to change greeting removed for "[word3]"} to the triggering furre.
(0:6) When a furre whispers anything,
(1:4) and the message is something like {remove greeting *},
(1:123) and {[player]} is on the list in section {controllers} of file {members}.
(1:123) and {[word3]} is on the list in section {greets} of file {members}.
(5:68) take variable {greeting} and store {default} in it.
(5:73) in section {[word3]} of file {greets}, write {[greeting]} as the value for {greets}.
(5:12) whisper {greeting set to "[greeting]" for "[word3]"} to the triggering furre.
(0:6) When a furre whispers anything,
(1:4) and the message is something like {delete greeting *},
(1:123) and {[player]} is on the list in section {controllers} of file {members}.
(5:78) remove {[word3]} from the list in section {greets} of file {members}.
(5:79) remove the section named {[word3]} and all values in it from file {greets}.
(5:12) whisper {greeting and ability to change greeting removed for "[word3]"} to the triggering furre.
(0:6) When a furre whispers anything,
(1:4) and the message is something like {add greeting *},
(1:123) and {[player]} is on the list in section {controllers} of file {members}.
(5:68) take variable {greeting} and store {[startingword4]} in it.
(5:73) in section {[word3]} of file {greets}, write {[greeting]} as the value for {greets}.
(5:12) whisper {greeting set to "[greeting]" for "[word3]"} to the triggering furre.
(0:6) When a furre whispers anything,
(1:4) and the message is something like {get greeting *},
(1:123) and {[player]} is on the list in section {controllers} of file {members}.
(5:68) take variable {greeting} and store {default} in it.
(5:74) in section {[word3]} of file {greets}, get the value of {greets} and store it in variable {greeting}.
(5:12) whisper {[word3]'s greeting is "[greeting]"} to the triggering furre.
(0:6) When a furre whispers anything,
(1:2) and the message is {see greeting},
(1:124) and {[player]} is not on the list in section {banned} of file {members}.
(5:68) take variable {greeting} and store {default} in it.
(5:74) in section {[player]} of file {greets}, get the value of {greets} and store it in variable {greeting}.
(5:12) whisper {Your greeting is "[greeting]"} to the triggering furre.
(0:6) When a furre whispers anything,
(1:4) and the message is something like {set greeting *},
(1:123) and {[player]} is on the list in section {greets} of file {members}.
(5:68) take variable {greeting} and store {[startingword3]} in it.
(5:73) in section {[player]} of file {greets}, write {[greeting]} as the value for {greets}.
(5:12) whisper {greeting set to "[greeting]"} to the triggering furre.
(0:6) When a furre whispers anything,
(1:4) and the message is something like {set greeting *},
(1:124) and {[player]} is not on the list in section {greets} of file {members}.
(5:12) whisper {you do not have the ability to change your greeting} to the triggering furre. |
|
|
Dreamless Dancer
Code Crasher
Joined: 24 May 2004
Posts: 142
|
Posted: Fri Aug 27, 2004 7:18 am Post subject: |
 |
|
add remove ban
Even with the promised update coming out, there may be times when you don't want to ban all the alts, but just a specific name because you have an objection to it. Of course, if said person does not "get it", then whack all the alts as well.
| Code: |
(0:6) When a furre whispers anything,
(1:4) and the message is something like {add ban *},
(1:123) and {[player]} is on the list in section {controllers} of file {members}.
(5:78) remove {[word3]} from the list in section {banned} of file {members}.
(5:76) add {[word3]} to the list in section {banned} of file {members}.
(5:12) whisper {"[word3]" is now banned} to the triggering furre.
(0:6) When a furre whispers anything,
(1:4) and the message is something like {remove ban *},
(1:123) and {[player]} is on the list in section {controllers} of file {members}.
(5:78) remove {[word3]} from the list in section {banned} of file {members}.
(5:12) whisper {ban is removed for "[word3]"} to the triggering furre. |
|
|
Dreamless Dancer
Code Crasher
Joined: 24 May 2004
Posts: 142
|
Posted: Fri Aug 27, 2004 7:26 am Post subject: |
 |
|
ds triggered entry exit code
Finally we get to where all this comes together, demonstrating how the bot does cool stuff. I again point out the topic Coming to, leaving, and staying on a map for ensuring a fault free operation, even if you know the lines where your DS triggers on entry and exit. Personally, I use a (5:40) set the floor to type 0 at (0,0) instead of playing a sound, that seems to clear up the floor ghosting problem as well.
Anyway, in order of execution, when the bot sees someone, it checks all the lists for their name on each list, acting according to what it finds, it's possible to share and eject someone, because it doesn't have a block action if someone is on the banned list. The final bit, within a separate code block, is the basic bankbot code, it grants a sliver of silver for every day a member visits the map.
| Code: |
(0:38) When DragonSpeak is triggered but, not by the bot,
(1:96) and line number {1} in the DragonSpeak is triggered,
(5:21) check who is on the map.
(0:38) When DragonSpeak is triggered but, not by the bot,
(1:96) and line number {3} in the DragonSpeak is triggered,
(5:21) check who is on the map.
* ejectable?
(0:20) When a furre comes onto the map,
(1:70) and the bot is on a map named {[golem.name]},
(1:123) and {[player]} is on the list in section {banned} of file {members}.
(5:35) eject the triggering furre.
* shareable?
(0:20) When a furre comes onto the map,
(1:70) and the bot is on a map named {[golem.name]},
(1:123) and {[player]} is on the list in section {shares} of file {members}.
(5:33) share control of the dream with the triggering furre.
* greetable?
(0:20) When a furre comes onto the map,
(1:70) and the bot is on a map named {[golem.name]},
(5:68) take variable {greeting} and store {default} in it.
(5:74) in section {[word3]} of file {greets}, get the value of {greets} and store it in variable {greeting}.
(0:20) When a furre comes onto the map,
(1:70) and the bot is on a map named {[golem.name]},
(1:118) and variable {[greeting]} is something like {default}.
(5:68) take variable {greeting} and store {Welcome to the World of [golem.name], [player]} in it.
(0:20) When a furre comes onto the map,
(1:70) and the bot is on a map named {[golem.name]},
(5:14) emitloud {[greeting]}. |
Scoring! EDIT NOTE: the error was that I Cut & Paste, and didn't change WORD3 variable to PLAYER below. And, looking up, same error was made in the greeting code! I'm not editing the code here (hehe) so you can see the error.
Another error is, which is changed, is that I used the (1:131) check instead of the (1:70) check, so the bot didn't work.
Remember, my download should be gotten instead of this code for this code is for explaining the bot, though also, I would prefer you to get GuildBot II for it's to be my development version.
| Code: |
(0:20) When a furre comes onto the map,
(1:70) and the bot is on a map named {[golem.name]},
(1:123) and {[player]} is on the list in section {members} of file {members}.
(5:68) take variable {fraction} and store {0} in it.
(5:74) in section {[word3]} of file {stats}, get the value of {silver} and store it in variable {fraction}.
(5:68) take variable {decimal} and store {0} in it.
(5:74) in section {[word3]} of file {stats}, get the value of {gold} and store it in variable {decimal}.
(5:68) take variable {lastday} and store {[date]} in it.
(5:74) in section {[word3]} of file {stats}, get the value of {lastvisit} and store it in variable {lastday}.
(0:20) When a furre comes onto the map,
(1:70) and the bot is on a map named {[golem.name]},
(1:123) and {[player]} is on the list in section {members} of file {members}.
(1:121) and variable {[lastday]} is not something like {[date]}.
(5:69) take variable {fraction} and add {1} to it.
(0:20) When a furre comes onto the map,
(1:70) and the bot is on a map named {[golem.name]},
(1:123) and {[player]} is on the list in section {members} of file {members}.
(1:115) and variable {[fraction]} is greater than {9}.
(5:69) take variable {decimal} and add {1} to it.
(5:68) take variable {fraction} and store {0} in it.
(0:20) When a furre comes onto the map,
(1:70) and the bot is on a map named {[golem.name]},
(1:123) and {[player]} is on the list in section {members} of file {members}.
(5:73) in section {[word3]} of file {stats}, write {[fraction]} as the value for {silver}.
(5:73) in section {[word3]} of file {stats}, write {[decimal]} as the value for {gold}.
(5:73) in section {[word3]} of file {stats}, write {[date]} as the value for {lastvisit}. |
|
|
Dreamless Dancer
Code Crasher
Joined: 24 May 2004
Posts: 142
|
Posted: Fri Aug 27, 2004 7:34 am Post subject: |
 |
|
help system & spare share
First, it's possible in a boggy situation where the bot does not see someone enter the map, in which case I include a command where someone on the share list can gain share by simply whispering the bot share. BaDaBing.
| Code: |
(0:6) When a furre whispers anything,
(1:2) and the message is {share},
(1:123) and {[player]} is on the list in section {shares} of file {members}.
(5:33) share control of the dream with the triggering furre. |
The help system is using my code saver routine where all the replies are kept in a separate file, with each command in it's own section. This saves space within the bot, and demonstrates both another (possible) bug, and a method for handling syntax errors.
| Code: |
| (5:77) get all values from the list in section {[startingword2]} of file {replies} and store them in variable {reply}. |
Does not obey the usage of setting a default value to a variable, it will return a null value if the section does not exist, or the section is empty. To counter this, there's a section trigger which checks the value of reply against a null set of braces {}, and the bot says huh?.
| Code: |
(0:6) When a furre whispers anything,
(1:2) and the message is {help},
(1:127) and {[player]} is on the bot owner list.
(5:77) get all values from the list in section {owner} of file {replies} and store them in variable {reply}.
(5:12) whisper {[reply]} to the triggering furre.
(0:6) When a furre whispers anything,
(1:2) and the message is {help},
(1:123) and {[player]} is on the list in section {controllers} of file {members}.
(5:77) get all values from the list in section {controllers} of file {replies} and store them in variable {reply}.
(5:12) whisper {[reply]} to the triggering furre.
(0:6) When a furre whispers anything,
(1:2) and the message is {help},
(1:123) and {[player]} is on the list in section {members} of file {members}.
(5:77) get all values from the list in section {members} of file {replies} and store them in variable {reply}.
(5:12) whisper {[reply]} to the triggering furre.
(0:6) When a furre whispers anything,
(1:4) and the message is something like {help *},
(1:124) and {[player]} is not on the list in section {banned} of file {members}.
(5:77) get all values from the list in section {[startingword2]} of file {replies} and store them in variable {reply}.
(5:12) whisper {[reply]} to the triggering furre.
(0:6) When a furre whispers anything,
(1:4) and the message is something like {help *},
(1:124) and {[player]} is not on the list in section {banned} of file {members}.
(1:118) and variable {[reply]} is something like {}.
(5:12) whisper {huh?} to the triggering furre. |
|
|
The Collective Mynd Forum Index -> Script Archives |
All times are GMT - 6 Hours
|
| Page 1 of 1 |
Powered by phpBB 2.0.11 © 2001, 2002 phpBB Group
|