Upvote Upvoted 0 Downvote Downvoted
Mirc twitch bot help
posted in Off Topic
1
#1
0 Frags +

Disclaimer: pretty bad at coding, pretty new to doing anything involving mIRC scripting, attempting to modify a quote script from this video

So rn I'm trying to add a command to my twitch IRC bot so I can have people add guitar hero song requests and have them save in a text file i can read from to display on stream, and I'm having some trouble.

!request should add someones song request to the file, hoping that i can read the text from file using a text source on OBS
I created a new remote script called requests.ini:

on *:TEXT:!request *:#: {
  write requestsinfo.txt $2- $+
  msg $chan Added $2- to queue.
}
on *:TEXT:!show:#: { 
  if ((%floodREQUEST) || ($($+(%,floodREQUEST.,$nick),2))) { return }
  set -u10 %floodEVERYONE On
  set -u30 %floodEVERYONE. $+ $nick On
  msg $chan $read(requestsinfo.txt)
}  

When I type !request [song name] it replies in chat properly, however when i open the text file or pull the text in an obs text source the file is blank. Using !show, I can get the requests to show up, however this only works during a given session, as after closing mIRC nothing saves.

So my question is (please fix my broken code) is there something I am doing wrong? how do I get the text to actually save to the file? why does it pseudo-write to the file (am able to show the request using !show)?

Disclaimer: pretty bad at coding, pretty new to doing anything involving mIRC scripting, attempting to modify a quote script from[url=https://www.youtube.com/watch?v=0vnEs91x1gU] this video[/url]

So rn I'm trying to add a command to my twitch IRC bot so I can have people add guitar hero song requests and have them save in a text file i can read from to display on stream, and I'm having some trouble.

!request should add someones song request to the file, hoping that i can read the text from file using a text source on OBS
I created a new remote script called requests.ini:
[code]on *:TEXT:!request *:#: {
write requestsinfo.txt $2- $+
msg $chan Added $2- to queue.
}
on *:TEXT:!show:#: {
if ((%floodREQUEST) || ($($+(%,floodREQUEST.,$nick),2))) { return }
set -u10 %floodEVERYONE On
set -u30 %floodEVERYONE. $+ $nick On
msg $chan $read(requestsinfo.txt)
} [/code]
When I type !request [song name] it replies in chat properly, however when i open the text file or pull the text in an obs text source the file is blank. Using !show, I can get the requests to show up, however this only works during a given session, as after closing mIRC nothing saves.

So my question is (please fix my broken code) is there something I am doing wrong? how do I get the text to actually save to the file? why does it pseudo-write to the file (am able to show the request using !show)?
2
#2
2 Frags +

bump still clueless as of how to fix this

bump still clueless as of how to fix this
3
#3
2 Frags +

i replicated the script on my channel and it worked properly. could just be an I/O permission issue relating to your user account & writing to the appdata folder (presuming you're using windows since mIRC is windows-specific & presuming that you didn't point mIRC's scripts folder outside of its default location; didn't see if there were any drop-in cross-platform replacements for mIRC wrt its scripting language).

my hypothesis as to why !show works without the write operation fully succeeding (wrt the file system) is that it operates on a cache that copies the contents of the file if it exists. it doesn't reopen the file on every !show event as that would obviously be extremely costly in large chat rooms. the !request event saves its data in the local cache & makes an attempt to output to the file buffer (at which point the script doesn't care about the end result of the write operation). it's either that or both events just operate directly with an uncloseable file i/o buffer.

the simplest thing you could do is try to write to a folder you know you have complete permissions over: just replace requestsinfo.txt in both the !request and !show event listeners with a direct path (e.g. C:\requestsinfo.txt)

i added you to debug in detail.

edit: using a direct path worked for him.

i replicated the script on my channel and it worked properly. could just be an I/O permission issue relating to your user account & writing to the appdata folder (presuming you're using windows since mIRC is windows-specific & presuming that you didn't point mIRC's scripts folder outside of its default location; didn't see if there were any drop-in cross-platform replacements for mIRC wrt its scripting language).

my hypothesis as to why !show works without the write operation fully succeeding (wrt the file system) is that it operates on a cache that copies the contents of the file if it exists. it doesn't reopen the file on every !show event as that would obviously be extremely costly in large chat rooms. the !request event saves its data in the local cache & makes an attempt to output to the file buffer (at which point the script doesn't care about the end result of the write operation). it's either that or both events just operate directly with an uncloseable file i/o buffer.

the simplest thing you could do is try to write to a folder you know you have complete permissions over: just replace requestsinfo.txt in both the !request and !show event listeners with a direct path (e.g. C:\requestsinfo.txt)

i added you to debug in detail.

edit: using a direct path worked for him.
Please sign in through STEAM to post a comment.