Recommended Posts

Hey, I need a little bit of help with scripting a bot for an IRC RPG. I simply need a bot to store information about a players character e.g Money etc and then to add or subtract from the money(plus some other stuff) when players buy things. If someone can help me with this It would be much appreciated.

Link to post
Share on other sites

making an IRC rpg isn't an easy task, but I can give you an idea where to start using mIRC.

First you'll need to read up on "on text" events in mIRC, they will be the interface your players will use.

Then you will need to learn about "hash tables" which are the best way to store info. hash tables are lists of variables, similar to a spreadsheet (though not nearly as powerful).

Next would be tokens, though not required, they allow you to store alot of info into 1 hash table entry then you normally would.

The only thing that remains is timers, which would be used for random events.

IRC rpgs can be complex, so it's best to read the help file before starting, it can save alot of headaches. :)

good luck :D

Link to post
Share on other sites

thanks for the response, actually since then, i've spoken to a few people and got a bit of help,

tbh, i've already made the game, the bot just automates certain sections of the game like buying buildings or getting income. What I would really like to know, is how to set a variable,such as money, then increase or decrease it depending on if people type certain phrases into the game, like !buy xxxx.

If you could help me with that specifically, that would be great.

Link to post
Share on other sites

well, if the language is mIRC script, then to set a variable would be:

/set %variable value

to increase by 1, would be:

/inc %variable

to decrease by 1 would be:

/dec %variable

Link to post
Share on other sites

thanks for that, i have tried to make a small section of script for the game, but as it is my 1st, it isn't quite working yet. Could you tell me what I need to change/do to get this bit to work?

Thanks in advance

on 1:TEXT:!buy %quantity Fishing Boats:*:{

set %price 10

dec %gc $calc (%price * %quantity)

writeini $nick $+ .ini Inventory GC %gc

/msg $chan You have bought %quantity Fishing Boats

}

Link to post
Share on other sites

the match text part of the event is off, mIRC script is very simple when it comes to that.

on 1:TEXT:!buy %quantity Fishing Boats:*:{

should be:

on 1:TEXT:!buy * Fishing Boats*:*:{
set %quantity $2

the set %quantity $2 stores the second word in the line which matched the event (in your case, the quantity of boats) and stores it into the variable. The rest of the code looks good, but you may want to check %gc, from what it looks like it is a global gold count. I don't know the rest of the code, so I can't tell if that's what you want to do or not.

Link to post
Share on other sites

yep, that worked perfectly, the bot is almost finished, im just having trouble with one final part. This section is designed to increase the amount of GC a person has when they type !income. I have tried several things but nothing seems to work.

here is what I have so far.

on 1:TEXT:!income $2* *:*:{

inc %GC $2

/msg $chan $nick currently have %gc GC

that is just the particular section of the code, if you need the rest of the script, I can provide that as well. Thanks

Link to post
Share on other sites

you don't need the $2 in the event at all, mirc fills it automatically, plus the extra space may throw off the matching. try:

on 1:TEXT:!income*:*:{

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...