Writefile line override


#1

I wan’t to create a command for subscribers to suggest games on subday with writefile:
(writefile sub.txt, true, (echo) (sender))
It works fine, but every time it creates new line, f.e.:
gamename subscriber1
gamename subscriber1
is it possible to get variable to override each line when same person suggest/using command again?


#2

Change the true part in the variable to false, true would make it append a new line while false will overwrite it.


#3

If I read the original request correctly, “override each line when the same person suggest/using command again.” Does this mean the following:

Bob requests DaggerGame

File:
Bob DaaggerGame

Frank requests DoggerGame

File:

Bob DaggerGame
Frank DoggerGame

Frank requests BadgerGame

File:

Bob DaggerGame
Frank BadgerGame

That is, the entry for “Frank” is replaced as “Frank” already requested a game and “Bob” stays there?


#4

With false it creates only 1 line in file, no matter how many people used command:

(writefile test.txt, false, (echo) (sender))

chatter: !test game
Chatter2: !test gamename
chatter: !test gamename
Chatter2: !test gamename222

test.txt: gamename222 Chatter2


#5

Yes, exactly.


#6

This would require some sort of custom script. Sorry for misunderstanding your first question.


#7

Then. yes, a custom script has to be developed if one single output file is desired that updates based on the request. If multiple output files can be created, that is one per user, that would be fine via a !addcom custom command.

I would ask what the total desire here is. Is it to allow subscribers to create a list of games that they want to see played, only one game allowed of course per subscriber, and are you manually viewing/manipulating the list?


#8

Yes, each month new list - i roll games that will be played on stream on randomizer (how many depends of request) .
Currently using http://streampoll.tv but it request login+permissions from users (and sometimes buggy).
With bot and chat i think must be much easier for users.


#9

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.