Author Topic: Making a Command Work in a .txt File?  (Read 9671 times)

airikita

  • Newbie
  • *
  • Posts: 17
Making a Command Work in a .txt File?
« on: September 12, 2008, 12:52:30 PM »
is there a way to get something like $read() to work in text after being activated by a $read() in the script?

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: Making a Command Work in a .txt File?
« Reply #1 on: September 12, 2008, 05:29:50 PM »
Yes, depends what your really trying to do, though.
The IceChat God

airikita

  • Newbie
  • *
  • Posts: 17
Re: Making a Command Work in a .txt File?
« Reply #2 on: September 12, 2008, 06:51:33 PM »
I'm trying to use $read() in the txt file (not the script).

DocBeat

  • Newbie
  • *
  • Posts: 43
Re: Making a Command Work in a .txt File?
« Reply #3 on: September 12, 2008, 07:16:11 PM »
Is it a .txt file with some records in it - what would you like to do with the data you read from the .txt specifically - or do you just want to know what method and code to use for reading from the file

airikita

  • Newbie
  • *
  • Posts: 17
Re: Making a Command Work in a .txt File?
« Reply #4 on: September 12, 2008, 08:05:54 PM »
I'm looking for a txt file to run another txt file for the script.. and if anyone is curious why, I'll answer it ahead: because, if you create 1 line, and 7 empty lines, you create a 1/8 random event.. it's easier to have one line rather than split a bunch of lines evenly.

Oh, and for some reason, my script for my random txt quote list somehow cuts out, and stops working. So, I'm thinking if it was run my one txt command for the script, it wouldn't cause that glitch.

Unless, someone has a way to randomize the running of the $read() command in the script itself. Plus, all of thise would just make the list cleaner, and more organized without thousands of quotes spaced throughout the txt file.
« Last Edit: September 12, 2008, 08:09:51 PM by airikita »

Windows_95

  • Newbie
  • *
  • Posts: 31
  • Who's cool and has two thumbs? This guy!
Re: Making a Command Work in a .txt File?
« Reply #5 on: September 12, 2008, 08:19:21 PM »
lol actually yes there is $read(C:\...blah.txt)
or u can use $randphrase(filepath) but if u use $randphrase ur text file has to be named randphrase
I do not feel obliged to believe that the same God who has endowed us with sense, reason, and intellect has intended us to forgo their use. Galileo Galilei

airikita

  • Newbie
  • *
  • Posts: 17
Re: Making a Command Work in a .txt File?
« Reply #6 on: September 12, 2008, 09:23:12 PM »
Ya but, niether of those are working in the txt file..

They're not running as part of the script..

Windows_95

  • Newbie
  • *
  • Posts: 31
  • Who's cool and has two thumbs? This guy!
Re: Making a Command Work in a .txt File?
« Reply #7 on: September 12, 2008, 10:11:03 PM »
still don't quite understand why u need to run a command from a text file
if u described what ur trying to do a little better i think it would help a lot
I do not feel obliged to believe that the same God who has endowed us with sense, reason, and intellect has intended us to forgo their use. Galileo Galilei

airikita

  • Newbie
  • *
  • Posts: 17
Re: Making a Command Work in a .txt File?
« Reply #8 on: September 13, 2008, 08:41:37 AM »
Okay, I'll show you.. if I did it like this:

Quote




<command here>




The empty lines will not send anything when chosen, making a 1/8 chance the command activates. I need this to simulate the bot to actually seem like someone is chatting.

It already works, but the txt I'm using now looks messy with all the spaces, and seems to be less random with the more quotes I put in it. If I had one txt with one line to read from the quotes, I can control the frequency of it, to make sure my bot isn't overdoing it, or underdoing it (where my bot seems to stop after a while too).

It's very convincing, it had my friends trying to chat with "her".. lol

I tried doing so, and it comes up saying "$read(Quote.txt, $+ : Unknown command"
« Last Edit: September 13, 2008, 08:44:03 AM by airikita »

airikita

  • Newbie
  • *
  • Posts: 17
Re: Making a Command Work in a .txt File?
« Reply #9 on: September 13, 2008, 09:20:55 AM »
nvm, I figured out why.. I had to put it with a space at the start.

airikita

  • Newbie
  • *
  • Posts: 17
Re: Making a Command Work in a .txt File?
« Reply #10 on: September 13, 2008, 09:24:29 AM »
But now it's going "/say : Unknown command" from the other txt..

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: Making a Command Work in a .txt File?
« Reply #11 on: September 13, 2008, 09:35:33 AM »
Why don't you paste your code for what you have, it would help a great deal.
The IceChat God

airikita

  • Newbie
  • *
  • Posts: 17
Re: Making a Command Work in a .txt File?
« Reply #12 on: September 13, 2008, 10:20:27 AM »
Okay, here's how it goes:

Code: [Select]
on *:TEXT:*:#:{
 $read(ReadQuotes.txt, $4-
}

ReadQuotes.txt
Code: [Select]




 $read(Quotes2.txt, $+




Quotes2.txt
Code: [Select]
/say <text>
 /say <text>
 /say <text>
 /say <text>
 /say <text>
 /say <text>

ReadQuotes.txt activates Quotes2.txt, but then it says "/say :Unknown command".. I need either a code in the script to make it random, or if there's a solution to Quotes2.txt now, idk why there's problems with it. I'm guessing I did $read(Quotes2.txt, $+ wrong in ReadQuotes.txt, but it works fine in the script..

I'll keep testing it, I'm close to getting it to work.

Windows_95

  • Newbie
  • *
  • Posts: 31
  • Who's cool and has two thumbs? This guy!
Re: Making a Command Work in a .txt File?
« Reply #13 on: September 13, 2008, 11:34:12 AM »
Code: [Select]
Sub ONTEXT(Message,Channel,Nickname,Host,ServerNumber)
  text = getidentifier(read(filepath),Servernumber)
  blah = GetIdentifier("$rnd(8)", ServerNumber)
    if blah = "8" then
    sendcommand "/msg " & Channel & "" & text &"",ServerNumber
end if
end sub

um something like that would do what u want i think i'm not sure about anything right now i'm very very tired lemme know if it works

u just need to replace filepath with the file's actual path and save it as .ice
I do not feel obliged to believe that the same God who has endowed us with sense, reason, and intellect has intended us to forgo their use. Galileo Galilei

DarkStar

  • Full Member
  • ***
  • Posts: 135
  • Scripts for Praise
    • CorpseCorp
Re: Making a Command Work in a .txt File?
« Reply #14 on: September 13, 2008, 11:51:12 AM »
or skip the identifiers and do blah = int(RND * 8) + 1
This message brought to you by the Wonderful Wizard of Oz.