Post reply

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.
Name:
Email:
Subject:
Message icon:

Verification:

shortcuts: hit alt+s to submit/post or alt+p to preview


Topic Summary

Posted by: King_Hual
« on: February 10, 2011, 03:29:19 pm »

Hello. Today I'm REALLY gonna explain how the bot reads files. And to be more specific, how the bot reads a random line from a file. For example, the file will be C:\slap.txt. You can create it in any folder, and then just put the destination to it at the place where i put "file name", or the example file name.

Code: [Select]
on *:TEXT:!slap*:#: { It's obvious that this is the TEXT event.
 
Code: [Select]
msg # $read(C:\slap.txt, $r(1,$lines(C:\slap.txt) ) )
}
"$read(file name, line to read)" opens and reads the file (a specific line from it), and then returns the text from the line. To read the random lines like in the example above, just type $r(1, $lines(file name) ) where the "line to read" text is. "$lines(file name)" returns the total value of the lines. Like if you have 2 lines, it will return a value of 2.

And the full code:
Code: [Select]
on *:TEXT:!slap*:#: {
  msg # $read(C:\slap.txt, $r(1,$lines(C:\slap.txt) ) )
}

If you have any questions ask me, rookies  ;)
Posted by: Jane
« on: February 10, 2011, 07:24:45 am »

I Remmeber these scritps ;D it's nice for new bies to start learning. Good job!
Posted by: Glow
« on: February 10, 2011, 06:38:02 am »

Hello,

Today I gonna explain you how you bot reads a file so you dont have to fill in everything in your script remote!

First of all you have to create the file. So for example create (a txt file) slap. Insert some funny things(each enter means another sentence).

Then the command!
First of all the normal
Code: [Select]
on *:TEXT:!slap*:#: {Then you have to let your bot read the file.
Code: [Select]
msg # %read C:\documents\slap.txt
}

The C:\documents\slap.txt is just an example. If you place it somewhere else note each step you take to your file.
So here the code you finally get:
Code: [Select]
on *:TEXT:!slap*:#: {
msg # %read C:\documents\slap.txt
}

If you didnt understand something you can ask me ;)

Jane: Modify Your Script Please, Thanks.