First script: Text file to variables/switches with twitch.tv integration

So me and a friend & programmer named 0Arc is working on a project together. He's entirely new to the scripting system and so am I. However while he has a lot of experience in other programming language, my experience is quite lacking. 

0Arc will be working on a chatbot that will parse commands from the twitch.tv chat and output the. He already has the bot since before. I'm just assuming he will tune it and change it to do what we need. 

The way this is going to work eventually is that people in the twitch chat will be able to interact with your RPGM game. I know, I know some of you experienced scriptwriters might be shouting SOCKETS. While I'd love to make this thing more efficient you have to realize that this is my first script (with a bit of help from snippets I found here and there on the community and some help from my friend).

We are able to load data, and set it to ingame var/swi. We still have to work on parsing things so the document could show the program what switch to set to true and what variable should have the number "1337" etc. (any solid walkthrough or info on how to parse files good and efficiently is very welcome) 

Here's the code:

http://pastebin.com/VVKTT5tH

In addition to this script however and here is where I'd like some help. We have added this to Scene_Map under 
class Scene_Map < Scene_Base 

And inside of "def start" and under "super", right before the "end" we added: $c = PJGPlays::TimeManager.new()

So that we can use  script call for  $c.update() in a parallel event and just add a wait for whatever interval we choose. This imo feels quite clunky. I'm pretty sure there is a better way to do this part? Maybe through aliasing but honestly my understanding of aliasing is messy.

Any ideas on how to improve / change or make other things more efficient gladly accepted. Looking forward to learning more!

Cheers"
What language is this parser written in? I don't see why you need to make new classes, Game_Switches and Game_Variables just to update the ones in the default class.

I'm also unclear as to why you'd need to call $c.update in an event, and not just have it run by the scene automatically.

Could you clarify these points?

Also, Sorry, little annoyance of mine, your indentation is all out of whack:

Spoiler
module PJGPlays class TimeManager @@ftime = 0 @@stime = 0 def initialize() @@ftime = (File.mtime("tvariables.txt")).to_i @@stime = (File.mtime("tswitches.txt")).to_i end def update() if @@ftime < (File.mtime("tvariables.txt")).to_i d = Game_Variables.new() @@ftime = (File.mtime("tvariables.txt")).to_i end if @@stime < (File.mtime("tswitches.txt")).to_i g = Game_Switches.new() @@stime = (File.mtime("tswitches.txt")).to_i end end end class Game_Variables Variables = [1,8,7] alias initialize_defvars initialize def initialize(*a,&bl) initialize_defvars(*a,&bl) File.foreach("tvariables.txt") do |vardata| p(vardata) Variables.each do |id| $game_variables[id] = vardata.to_i; end end end end class Game_Switches Switches = [1,8,7] alias initialize_defswitch initialize def initialize(*b,&cd) initialize_defswitch(*b,&cd) File.foreach("tswitches.txt") do |switchdata| if switchdata == ("1") boolswitch = true else boolswitch = false end p(boolswitch) Switches.each do |id| $game_switches[id] = boolswitch; end #$game_switches[Switches] = boolswitch #Switches.each do |id| @data[id] = boolswitch end end endend 
sorry for the late reply, busy talking to a bunch of people at the moment.
The short answer to those questions is because I/We don't know better. Which is part of the reason why I'm here to listen to more experienced people and take their advice if they'd be so inclined to give any ^_^

The way I worked with the Game_Variables and Game_Switches was inspired from another script that did it that way. Granted a lot have changed since then so it might just be a remnant that is no longer needed.

As for the chat parser for Twitch.tv chat I will have to ask 0Arc when he wakes up. I'm guessing it's Java since he is most proficient in Java, but don't take my word for it. 

Hope that answers your questions.

Thank you for the indentation. We were both making changes and it just ended up quite messy and it passed me by to indent it more properly before linking the script. Sorry!

And no need to be sorry. Thank you for chiming in man! Much appreciated ^_^
Hello, first I would to thank you for the identation, as Mireneye said we were both making changes and I  mostly screwed up the identation 🙂 .

We made the parser for the files in ruby, so it can directly work with RPGM, now the Twitch.TV Chat parser is made in C#.

I also added your changes to the script, I removed the event and called the $c->update() inside the Scene_Map update function.

I removed both  classes and made it a function inside the GameManager class(Used to be TimeManager).

Thanks for the help, i'll try to keep you up to date! 🙂
Pastebin fricks it up atm.

Nice job for a first script, I couldn't do any better
Thank you, we have a somewhat refined version but right now 0Arc is quite busy, once the twitch chat parser is done me and him needs to talk a bit on how to best present it to the community.

Might be announced along with my own game project. However there's still a lot of work to do on both ends so might take a while.
Good luck with your project as well mate! 

Original thread: https://forums.rpgmakerweb.com/threads/first-script-text-file-to-variables-switches-with-twitch-tv-integration.24420/