Originally Posted By: negeren
ok can anyone tell me how to referance the last output


Your best option would be to use a hash table. Automatically store the last 2 lines of text from every person. When you get a new line from that person, it moves the last text to the second to last and then writes the new text. Hm... that's confusing... here's a visual example:
Quote:

Hash Table: SpokenText
Item=Data
Riamus.1=This is the last thing I wrote.
Riamus.2=This is what I wrote before what was written in Riamus.1.

Now, if I wrote "This is my new text.", it would look like this:
Quote:

Hash Table: SpokenText
Item=Data
Riamus.1=This is my new text.
Riamus.2=This is the last thing I wrote.


See how it moves the stuff around? That lets you look back at the last 2 things said in order to keep track of what's going on.

From there, you can have your bot set a variable whenever it asks a question. Something like %asked.Riamus = wait_how_much . I'd probably set the variable to automatically unset after a couple of minutes since the person isn't likely to respond after that and you don't want them to type something 2 hours later and you respond to them. Then when I type something new, you check for %asked.Riamus (obviously Riamus would be $nick) and see if it's set. If so, it will check what the variable is set to in order to know what question was asked. Then, you can call an alias that has the same name as the variable's data and it will check what was said by the nick and if it fits a given criteria (has to include a number in this case), it will respond appropriately based on the question.

The hash table is there so that you can easily look back and use part of what they said previously. Something like...
Quote:

Riamus: I made a lot of money today.
Bot: How much?
Riamus: $500
Bot: You made $500? That's a lot.

The blue is taken from the previous text, the red is taken from the latest text. It lets your bot sound more realistic. Of course, it's also more complicated making it valid, but if you want it to be realistic, that's your best option.

Don't forget to unset your %asked.nick variable after the bot replies.


Invision Support
#Invision on irc.irchighway.net