mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Nov 2013
Posts: 19
D
Pikka bird
OP Offline
Pikka bird
D
Joined: Nov 2013
Posts: 19
So i have this script, that i use for my twitch bot to read off a .txt file, basically what i want to do is everytime this txt file creates a new text i want that text to be displayed in my chat, is this possible?

on *:TEXT:followed:#:{
msg # $!read(C:\Users\Blahh\Desktop\streamstuff\TwitchAlerts V0.56.9\Log\LastFollower.txt)
}
}

Joined: Apr 2014
Posts: 191
B
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191
It is not possible to do such thing with on text event.
on text event will be triggered when someone say something in the channel.

Your code will be triggered when someone say "followed" in the channel.

I'm not sure but i guess /timer command will do.

Joined: Feb 2003
Posts: 3,432
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
Im not shure, but i think you can use the information of the size of the file, or the date it was last edited, and then make use of that.


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Nov 2013
Posts: 19
D
Pikka bird
OP Offline
Pikka bird
D
Joined: Nov 2013
Posts: 19
and how would i go about doing that?

Joined: Apr 2014
Posts: 191
B
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191
What comes to mind is use timer to check the file.
If file has text, msg to the channel, clean the file or remove file
Wait for another new text write into the file.


Joined: Nov 2013
Posts: 19
D
Pikka bird
OP Offline
Pikka bird
D
Joined: Nov 2013
Posts: 19
what i want to do is have a script that looks at a file and looks to see if it changed. should go kinda like this i think:

if var1 = var2 return
else
var1 != var2
replace var1 with var2
$!read (C:\users\user\desktop\streamstuff\twitchalerts\log\lastfollower.txt)
return

where var2 is the current name in the above file, and var one is a previous copy of that name in that file.

if this makes any sense.

so the flow would go like this:
the script first checks that the stored contents of variable 1 is the same as the name currently in the log file,
if it is the same then return to the top and check again.
if it is not equal to the first variable as in the contents of the log file changed, then update variable one with the new name and then post the name found in the file into the chat. after that is done, then return to the top of the if else statement.

this script will be activating by someone typing in to the chat "Followed"

if you need more information let me know

Joined: Apr 2014
Posts: 191
B
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191
This is untested and based on your posting. Idk if you want it like that or not, but hope you can 'read' and understand the flow of script so you can expand from there.

Code:
on *:TEXT:followed:#:{
  ; if user say followed, fill var %last with value of $read(file.txt,1) 
  var %last $read(C:\Users\Blahh\Desktop\streamstuff\TwitchAlerts V0.56.9\Log\LastFollower.txt,1)
  
  ; check if var %previous.follower has value, fill it to %prev, otherwise %prev will be fill by %last value
  var %prev $iif(%previous.follower,$v1,%last)
  
  if %last != %prev { 
  
   ; %last != %prev, msg %last to channel, replace %previous.follower with %last     
    msg # %last
    set %previous.follower %last
  } 
  ; script done, waits for user say followed again.  
}



Joined: Nov 2013
Posts: 19
D
Pikka bird
OP Offline
Pikka bird
D
Joined: Nov 2013
Posts: 19
Thank you !
i'm going to play with this and try to get it to work.
appreciate it.


Link Copied to Clipboard