Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Ryex

Welcome! / Re: -creeps back in at (almost) midnight-
January 10, 2020, 10:37:54 pm
Welcome back to the Chaos!
use just
D_S.mute_source(0, 011-Waterfall01')
and remove the

The two modules are not nested in the current version. I'm fairly sure they never were but I could be wrong if that's is what is used in the Demo.
 The obvious culprit then is the typo of 'RyexCGG' the Module should be 'RyexCFG'. Since you didn't give a line number I'm assuming the game didn't give a line number for the error which suggests that the error is happening in a script call so double check those if it DID give a line number for the error I'll need that.  Also, the D_S module isn't under the RyexCFG module so any calls to it should remove the 'RyexCFG::' scope.

If you need more help I'll need a screenshot of the error message, a screenshot of the script call that's causing the error,  and you'll have to copy paste the relevant event comments that you're using to create the sound sources that are not working correctly.
ARC Welder / Re: RMXP Project Converter
January 03, 2018, 12:58:08 am

^^ that should have the converter. Good Luck.
you'll have to be a bit more specific. can you snag a screenshot or copy the text of the error message when the script calls crash the game?
ARC Welder / Re: RMXP Project Converter
December 31, 2017, 03:46:50 pm
If you really do want it I can get it to you. It's not Like the code disappeared or anything. You'll just have to wait for me to get home from holiday travel. I might even get lucky have a compiled copy hanging around in my deep storage. Just be warned that the ARC engine can't exactly be said to be stable. I don't remember there being any game breaking bugs but it was running a newer version of ruby so there could be some incompatibilities. Also, you won't really gain anything from using the ARC converter other than a higher FPS potential.

Anyway, Let me know and give me till Thursday if you do want a copy.

As for the Editor, I still have plans for that particular piece of code. there are a lot of structural components in there that I still can't replace with other libraries. but It was for the most part non-functional for editing ARC game data. only about half the game data tabs worked.
Today is the second internet protest on Net Neutrality. In an "Internet-Wide Day of Action to Save Net Neutrality" Many companies and organizations have joined together to spread the word. I feel now is a great time to address the argument for an against. (from my point of view at least)

For those of you who don't know.The 45th President of the United States of America, Donald Trump hired Ajit V. Pai, an ex Verison CEO, as the chairmen of the FCC (Federal Communications Commission). The FCC only recently  (under President Obama) reclassified ISPs (Internet Service Providers) under Title II of the Federal Communication Act of 1934. Making ISPs classified as common carriers, akin to phone services providers. This allowed them to draft, vote on, and pass enforceable rules about "Net Neutrality" which is the principle that all traffic on the internet (and thus the data therein) must be treated equally. That means that it must all be routed to its destination as quickly as possible in the order in which it is received. with no priority given based on where it is coming from or where it is going or what data it contains.

The main argument against Net Neutrality is this:

The ISPs (especially in America do the size of landmass they have to cover with cables) make a significant investment in building out their network; connecting all those cities and all the buildings takes quite a bit a cable. And the routing nodes require expensive hardware and the power to run them. To makes things simple. being the first ISP to cover an area is an expensive bit of overhead the kind of expense you take out multi-million dollar loans to cover hoping that you'll make back the money and more with the service you provide. Now consider the fact that traffic hits it's peak in the evening when most people got off work. Take into account the prevalence of streaming media as a form of entertainment and you can see that during the evening in a given area bandwidth usage will skyrocket.

The FCC actually did a study of ISPs and how well they were providing their advertised speeds [1]. They provide this nice graph of what speeds they were able to provide and what they advertise vs time of day.

Spoiler: ShowHide

Notice that nice dip in provided speeds around 20:00-22:00 ?

perhaps this will put that into perspective. a chart on how the bandwidth usage on the internet over the course of a day [2]

Spoiler: ShowHide

According to that graph, Netflix accounts for half or more of all streaming traffic at a given time and (if the graph is true to scale, hard to tell without numbers) then Netflix could be close to a quarter (25%) of all traffic at peak.

The Argument is that Net Neutrality rules prevent the ISP from collecting a fee from high bandwidth users like Netflix to help recoup the cost of building a network that can push that much data at once. After all during those peak times that have to slow down other users to let all that traffic through.

Here's the problem: By selling internet access ISPs state that they are allowing you to access, not just their leg of the network but the entire internet and all connected networks. and with that access transfer data, usually at speeds up to some limit and sometimes there is a clause about total data transferred and what that means for your access. There may even be clauses about access at certain times of the day. They make this contract with all their customers. by doing so they burden themselves with a legal obligation to build a network that can service all those contracts at once. The problem of users using their access at the full speed they're are allotted in their individual contract and consuming a non-insignificant portion of the network's available bandwidth thus forcing the ISP to shape traffic to ensure nothing gets dropped is the ISPs' not the customer or the service the customer is accessing. Let's not forget that the business is already paying for access to the network to make their services available, They are also paying quite a bit for that access because they need much higher bandwidth than a consumer and that's fair. But what the ISPs are arguing with the above that the business should not only have to pay their local ISP for internet access they also need to pay the ISPs of all their consumers to ensure their traffic gets there in a timely manner. If the ISP CAN't provide that bandwidth to all their customers at once then they have oversold the capacity of their network. While Oversail isn't strictly criminal fraud [3], it does have the potential for civil consequences.

Those graphs above might seem to say Netflix is taking up an unfair percentage of the available bandwidth but that's not the case. The truth is that a large percentage of the ISPs' customers have made the choice to stream Netflix. if it wasn't Netflix it would be something else, that bandwidth is already spoken for. Netflix is just an easy target to leverage your customers against if there is no Net Neutrality protection in place.

The situation I just described would be akin to having to ship goods by truck via routes where every single road was a toll road with different rules and a different fee structure.The price of moving, a given good could change from road to road simply because they could charge more simply based on agreements that particular road had made with you and your competitors. It could change because of your carrying tangerines instead of oranges despite the fact that it's coming from the same place and the total weight of the load is the same. That kind of situation would make it nigh impossible for even a well establish bussiness with lots of money to navigate. when the route the data take to your customer changes how much and who you have to pay suddenly you have to optimize your pricing and content delivery to individual areas. A new or small business with limited capital means wouldn't have a chance. and perhaps that's the point. The increased costs the business have to pay wouldn't stop there too. the business would have to raise the price of their services or add more ads to reflect the higher cost of doing businesses. Passing the cost on the consumers, only for the money to end up in the ISPs' pockets. So even if the ISPs only charged businesses they would still be charging consumers more for the same access they already had. That is double dipping.

The other argument against Net Neutrality is that it's an overreach of government. an unneeded regulation, the free market will solve the problem for us if that's what consumers demand.

but there are multiple problems with that too. Remember that building out a network is expensive. As such ISPs intentionally DON'T directly compete with each other. they have agreements to only cover areas their competitors don't. For most places, there is only one option for internet service. and even if there is a few "local" ISP's the usually buy access from the only ISP who built infrastructure to their area. IF there is no choice then the market isn't free and consumers can't "vote" for an alternative with their wallets because there is no other option.

That the idea that regulating the Internet would stifle innovation is ludicrous on its face. Regulation, even if it was not "Net Neutrality" which is arguably the opposite of red tape, would be consistent and "regular" by definition. by its very nature a lot more manageable than the complex, potentially volatile, fee structure for data, that would exist between all the competing ISPs

And the argument that "there's no problem now, why do we need a new regulation?" is also untrue. Comcast infamously strongarmed Netflix [4] into paying it a fee to keep access to Comcast customers. And then had to do the same with Verizon because they had paid Comcast already  [5].

In case it's not clear. Net Neutrality is a crucial requirement to both keep the Internet as a level playing field and to keep consumer prices of internet access and service from being inflated.

OS, if you're a US citizen and you haven't already, go and leave a comment on this FCC proceeding. And Tell them why net neutrality is important to you.

So this last semester I had to retake an argument and analysis English class. I made sure the class was with the same professor as last time as I had really liked her.

Anyway. for the previous class, I had written an essay on intellectual property law in America and how it has changed; arguing that its effects had drifted significantly from its purpose.
Part of that argument relied on a letter Thomas Jefferson had written to Isaac McPherson where he wrote the often paraphrased lines:

Quote from: Thomas Jefferson to Isaac McPherson: 13 Aug. 1813If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it. Its peculiar character, too, is that no one possesses the less, because every other possesses the whole of it. He who receives an idea from me, receives instruction himself without lessening mine; as he who lights his taper at mine, receives light without darkening me.

(It's really strange how common run on sentences smashed together with commas are in old writings)

Under the assumption that someone as famous and well respected as a scholar as Jefferson would have had a not insignificant impact on anything he cared to comment on I did more research only to find controversy at every turn. In fact, just about every word he ever wrote has well-respected men from his era forward shouting "wrong". Even the public perception seems to have a weird Oh sure he was a Founder of our nation, wrote that all-important declaration of independence - who's those words are effectively holy; but we should disregard his views on almost everything else. So much so that I even have a book my uncle sent me titled "The Jefferson Lies".

So I ended up writing the paper for this last semester on the strange disparity in Jefferson's modern perception.

I touch on everything from the near revolution surrounding the election of 1800 to unfounded attributions of legal scholarship on the basis of court decisions more than a century later.

I'll link a PDF below. If you're just curious, interested in early American history, or just want to see the early parallels to out current political climate feel free to take a look. Hopefully, you'll find it satisfying in some way.
Welcome! / Re: Hello!!
July 03, 2017, 03:02:12 pm
to use my oft-repeated phrase, borrowed and never returned, from a Chaos Project member way back in the day: Welcome to Chaos!

You probably won't see me posting much these days but I am always watching. and I'm always willing to offer help.
Chat / Re: Your Life Here
May 15, 2017, 04:26:50 pm
 well, It's kinda sorta official. for the first time in 4+ years, I've actually passed every class, I enrolled in!
kinda. I don't actually know the final grades in any of the classes but I have reason to suspect that two are passing and one is actually good. this... I.. I don't actually know how to feel about this.

Chat / Re: Your Life Here
May 03, 2017, 01:36:05 pm
Believe it or not caffeine is in the same category as asprin, it's literally just a don't fall asleep yet keep the blood flowing drug. I avoid the sugar/calorie filled caffeine sources best I can. I'm almost always using the sugar free or zero calorie options so I know it's not a sugar rush. And I'm not kidding when I say I've never had much of an effect at all from it. But starting about 2 weeks ago it was suddenly effective like nothing ever has been. Perhaps it's just waking me up enough that I can take full advantage of the medication. I was actually warned, now that I think about it, that the medication would boot the effects of caffeine. Which is odd as they have no official interactions.

However, to put this in perspective. Yesterday around 15:00 I started working on catch up of all my physics homework staring recent and working back. They are written assignments 4 (largely multi part)  questions a piece. The first one on magnetic fields and current. It included a AC generator problem. It took me till 21:30 to finish. That's 6 and a half hours. That length of focus has always been a struggle, normally I stop and browse email or the web in the middle. So the fact that it wasn't even a problem, didn't even get frustrated with the amount of time it was taking.

Then I went and followed it up with an all nighter of nothing but one assignment after another. I not happy I had to do it but it's a dam miracle I was able to focus that long without burning out.
In the last 7 days I've effectively been more productive than the entirety of the last 4 months.
I'm going to need to address the sleep problem soon though 4-5 isn't enough by a long shot.

Chat / Re: Your Life Here
May 01, 2017, 05:59:25 pm
So, I said I'd post back after I had a hold on whether or not the medication was helping; well here goes, I anticipate that this post will run a bit long so I'll try to put a TL;DR at the end, so skip forward to that If you don't want the read the whole thing.

My Doctor put me on Vyvanse. It a "New" still under patent medication that combines Adderall and Ritalin into a complex ratio and time release formula. Don't ask me how they managed time release when it's a powder in a gel cap but that's the claim. Anyway, the shit's expensive, one cap a day cost's  around $300 USD for a 30 day month's supply. I have insurance that's considered "good" by American standards any they would only pay 3/4 leaving me with a $75 USD a month price tag for what I now consider an absolute necessity. But that's a rabbit hole for another time. I was extremely hesitant at first because of that price tag but I actually had a very strong sense that my Dr could be trusted on this decision. Unfortunately, I took just over a week from getting the prescription to getting the pills because the local pharmacy had to order them in.

Ok, I actually have to take a moment on a tangent here. I managed to avoid the insurance hole but this is actually kinda important to my decision-making process. When I was in 5th-7th grade - this would have been back in 2006-2003 when I was between 11-14;  good lord that's  well over a decade ago - I was struggling with school and my parents decided enough was enough and pressured the school district into conducting a series of tests to see if there was anything diagnosable. They also took me to a behavior specialist all the way over in Denver to have some tests done (it's my understanding that ADHD was suggested ass a possibility way back when I was in 1st and 2ed grade but, due to the prevalence of the over-diagnosis of the condition then, these tests were the first follow-up they ever did.). The tests were... inconclusive at best. it placed my IQ in the mid 120's via the Raven's Progressive Matrices test, pointed out that my auditory attention span was subnormal, I had above average logic and comprehension skills, but that was about it. I ended up with a Federal 504 learning plan (504 I believe refers to the section of the "no child left behind" law that mandated that students be accommodated) despite having no officially diagnosable condition. I also got me placed in the "gifted" program a dual state that frustrated everyone involved. Anyway, all of this is to point out that while resulted in some accommodations like extra test time (which has proved invaluable of late) it effectively changed nothing, I was still struggling and there was still no answer.

Continuing that thread, this march I finally got to meet the only licensed medical psychiatrist within 100 miles of where I live (conveniently in town at a presbyterian medical serviced mental health clinic). the man is an oddball. not in the personality sense (not that he doesn't have quirks), but in the "how the hell did a man like this end up here" sense. I live in the central United States attending a small university attached to a small town on the interstate that is literally only alive because the university is here and it's conveniently half way between the two major cities in the state. There is also a smaller east-west highway that runs through where this town is the only stop for about 100 miles but that's minor in comparison. Anyway, this Dr. is a bigshot, privio0us department head of a major hospital on the east coast, who fell off the map due to personal circumstances and ended up in the middle of BFN. And, in the mother of all coincidences, (relative to this situation at leat), He not only know and worked with the psychiatrist I went to in Denver all those years ago, he had helped develop, write, and publish, the major test I'd had administered there.  In a twist of irony, the test was worthless because the scale hadn't been adjusted to my age at the time.  All of that together with how well he was able to read me and extrapolate from the little bit of information I was able to relay to him in that first 30 minutes meant I held him is a fairly high regard. He also implied that people like me were his area of study and that the had a great deal of experience with treatment in the area.
TLDR: I got lucky and the psychiatrist I could visit was probably the best one in  > 800 miles for my particular case

Ugg, two paragraphs later I get back to the medication. I was started off on 30mg of Vyvanse assure that it was the best option to start as The Dr. experience indicated it was simultaneously the most effective, held the lowest possibility for complication and side-effects, and easiest to find the right dosage level on.  Fortunately, I didn't just accept the $75 price tag and move on, I was able to find and claim an offer directly from the manufacturer that would cover part of the out of pocket expense so long as I paid at least $30. $30 is still more than double what I've ever paid for a single prescription before but it was acceptable inside my budget. If I have to the Dr. has assured me that we can explore cheaper options but it will be much easier to find the right balance because we'll know how I respond to Vyvanse, and what maximum effectiveness looks like.

As for what Vyvanse does for me? The range is subtle in a given the moment. but the results are night and day as far as I'm concerned. Because of the number of patients, he covers I can only visit the DR ever 8 weeks or so, that's just how far he's booked out. there are waiting lists for cancellations in case you have a need to get in sooner but that's a crap shoot. you get at most day's warning sometimes as little as tow hours if there is a cancellation. As such I've only seen him three time total, once since I started the medication. I've been moved from 30mg to 50mg a day and the effect is definitely noticeable now, I suspect I'll be moved up to 70mg when next I see him (he was estimating I'de respond best somewhere around 50-70mg anyway).

Before I got here starting a completing a given task was a tossup with the odds increasing towards the low end the less the topic of the last held my interest. I'd long considered that the norm, berating myself for not having the willpower to stick to uninteresting tasks (That, in particular, being the reason I went and sought treatment in the first place, procrastination had become a way of life and I saw little to no hope for improvement on my own). I always wondered how people did it, how could they possibly get so much done in a day when even the simple things took me longer that the norm. Now I realize just how prevalent the small distractions were.  Small things like following trains of thought even when they were irrelevant to the task at hand add up fast.  Those 5 minute breaks to research a tangentially related subject or check up on that thing that could wait, or "let's change the music, the current style is boring me" all add up to hours arguably waisted when the original task shouldn't have even taken that long.

During my first meeting my Dr pointed out that I'm a hyper-focusing personality, I latch on to subjects and tasks and pursue them to their end, all else be damned, and if that thing I'm focusing on falls apart I' would just find something lest risky and focus on it, like video games. He's right I have a great deal of trouble letting a task go. I thinking it's an interesting duality considering the ADHD diagnosis. my therapist thinks so too but neither of us has had time to as him what he thinks of the duality. In that first meeting, he expressed the concern that starting treatment of ADHD with medication had two possible outcomes. Either I'd start being able to function "normal" so to speak, able to focus on a task to completion while also being able to switch tasks if needed; or, it would exacerbate my tendency to focus on the wrong things and cripple my efforts to succeed. This was actually a strong fear of mine as well, but i didn;t have much left to loose at this point so it was Do or Die in regard to my academics.

ADHD is treated with CNS (Central Nervous System) stimulants. Adrenalin is a good example of a CNS Stimulant. They are though to re-balance dopamine and other chemical levels to counter some "defect" in the physical layout of the brain. CNS stimulants in addition to improving function while used in people with ADHD is shown in multiple studies to create permanent improvements in cognitive function with long-term exposure. IE. even if you stop in the future you retain some of the benefits. 
^^ Which is the textbook way of saying "if these people take amfetamines (aka legal, clean, regulated meth) they adjust and do better" Which says nothing about what happens during that adjustment period.

The effect of the 30mg was hard to even pick out in regard to concentration but the first week was weird as fuck. The first and very noticeable effect was the elevated heart rate. I think I posted this before but as I'd taken to wearing a gifted Fitbit at the time I notice that my mean rate was about 10 beats/minute higher. My blood pressure was correspondingly higher as well. I also felt giddy and full of energy like I was anticipating something really fun or exciting, there was also the "heart flutter" feeling. all in all a textbook steroid/adrenalin response. I felt those effects and was acutely aware of them for the first two weeks or so but I seem to adjusted since. During those two weeks, it DID become incredibly hard to let things go. If I wasn't finishing things fast enough or was having difficulty I could feel myself becoming quickly and uncharacteristically frustrated and angry but completely unwilling to give up till I finished. Being late because I had to tear myself away from something became the norm for a bit. Around that same time sleep became a problem, I hand;t been getting enough sleep even before I started but I moved from 6 to 4 or less a night. melatonin was the Dr. suggestion but since it works in conjunction with the rest of your brain's chemical balance and mine hadn't fully adjusted yet it did jack shit at first and just gave me a hangover instead.
I started feeling even more forgetful, I felt I was having to backtrack and pick up my keys and wallet or glasses or phone from wherever I put them down last more often than before. But in retrospect, it's hard to tell if I was actually more forgetful or just more aware of how forgetful I was being. In the third week things finally started to feel more normal and the average time I could concentrate for did seem to improve.

When I met the Dr. next (pretty much exactly a month after I got the 30mg) I explained all this and was moved up to 50mg. Same thing as before with the price, and manufacturer discount. except for this time, I didn't have to wait for it to be ordered in, guess they just didn't keep the lower doses in stock (I think they are mostly only used for people just starting it anyway so makes sense). I didn;t have the physical reaction problems like with starting the 30ms's but the concentration effects were markedly improved. Focus became a choice instead of a fleeting thing day to day, and my fear that I would be unable to turn my focus away to a new task seems unfounded. Sleep is about the same as it was on the 30ms's but melatonin seems to work now so long as I take the right amount. normal human dosage is between 0.2mg and 1mg but as was pointed out I don't exactly have a normal brain chemistry, especially now and he recommended 3 mg. It seems to work will when i remember to use it instead of just staying up.

As an aside, I've greatly reduced my sugary drink and thus my caffeine intake in the last five years or so but about a week ago I had need to stay up and while caffeine has never had much of an effect on keeping me mentally awake it did make it harder to fall asleep. but This time the addition of caffeine was like I'd hit the nos button and started cranking out productive, correct work. This is the reason I suspect that a dosage increase will still be needed. Caffeine is an unacceptable long-term solution. The aim with medication is to hit the top of the curve without going over while staying at the top of that curve as long as possible.



I likely still have a bit to go on finding the right dose but so far It's a significant improvement. Sleep is a problem but melatonin seems to help and it's a relatively cheap over the counter solution. If you plan to pursue treatment yourself do some research and try to find a recommended experienced psychiatrist who deals with ADHD patients. Finding the right dose will take time and you'll need to let yourself adjust before declaring that you don't like how they make you feel. I took 3 weeks before I was comfortable and other people might take longer or need some fine tuning of their particular prescription combination to meet their budget and correctly help them. Sadly medicine is an art form because there are too many independent variables to get ti right the first time or even the third.

If you're tired of just coping with it, or even if your not. seek help, it can get a whole lot better.

Chat / Re: Your Life Here
March 19, 2017, 01:39:22 am
Deffenetly, I've only had the medication for 4 days now and it's really too soon to make any assessments. Plus the dose and such is probably going to have to change etc. I'll try to get back to you guys in like a month or two and give an update on that. The current problem is that the medication the doctor chose is widely considered the "safest" option (it is an amfetamine, no real winners in that category but it is supposed to have the least side effects) but it's still under patent. without insurance, the dam things cost 300 USD a month. and WITH insurance they wanted me to pay 75. fortunately, I went and found a discount program directly from the manufacturer that lets me get it for 30, at least until August. after that, I'll have to find something else. It's defiantly a stimulant substantially higher resting heart rate and all that.I have lot more energy than I had previously; actually a plus kinda, I feel like I have "normal" energy levels now. If I take it too late in the day I have to worry about sleep.As my body adjusts the more prominent effects "should" subside. Other than that It's too soon to say anything on the mental front.
Chat / Re: Your Life Here
March 09, 2017, 04:10:26 pm
That is certainly one way to look at it. Currently it's more of a, "oh yay, I'm so incompetent I can't even control my own mind!". And yes I realize that's not a health outlook.
Chat / Re: Your Life Here
March 08, 2017, 03:30:51 am
So... As of Monday I'm officially diagnosed with ADHD combined type, primarily inattentive. It... explains a lot of things. I'm going to be starting medication here in the next week and I'm hoping for an improvement in my general ability to get things done without getting distracted. Honestly, I've suspected it for about a decade but I never wanted it to be true.  Heck, it was diagnosed when I was really young but my parents ignored the diagnoses then because of the "overdiagnoses" of the condition in the late 90's. They always told me that I just needed to work harder at being normal but it wasn't something that needed medical aid. I've gotten damn good at ignoring the symptoms and masking them over the years. explaining it away as "lack of will" and "boredom" but the fact that I'm still struggling to pass my third year of college credits and was fighting depression to just to do the dishes sent me off to find help. A little over a year later I finally have a diagnosis (getting into the mental health clinic around here took about 4 months, the wait list was that long, then we were looking at other potential causes first.). I'm not quite sure what to expect, just hopping is progress instead of more stand still. I also find myself wondering where I'd be if I'd sought help or otherwise been diagnosed sooner. Dr. warned me that would be a thing and that dwelling on it wouldn't be good but I can't really help it yet.

Anyway, I'd like to apologize for being a ghost of late. I missing hanging out with all of you guys here.
now to figure out where the syntax highlighter went.
It apears to be fixed.

Now we just have to figure out where the code formater plugin went
That seems indicative of a problem with how fopen was handled. but the very concept of such a bug existing is hard to comprehend. fopen is implemented both at the kernel level and at the clib level and both implementations are heavily used, tested, and vetted. have been for years. What's more interesting is that the contents of a file have absolutely no baring on the operation of fopen. that knowledge would lead me to believe that is was file system corruption. except, you say this was reproducible after pulling the file from svn on another computer. it's a bit baffling. could it be that file system corruption that existed when the files we're originally commuted caused svn to set some weird state flags that when cheeked out reproduced that file-system corruption? like misaligned file size/start-end position? something like that would cause the kernel to say "hey your not supposed to be reading there!" and halt the process.
This is a test post for diagnosing the code formater spoiler problem

Code: ruby
#          Author: Heretic
#          Version: 1.0
#          Date: Saturday, July 30th, 2016
#   Instructions: Place Below Dynamic Sounds
#   ----   Patch for Ryex's Dynamic Sound Engine----
# - Fixes a bug that causes a Fatal Game Crash when a Non Edited Save Game
#   has been loaded.  Any Sounds that were Muted before having been saved
#   will be enabled again.
# - Adds the ability to temporarily turn off Dynamic Engine Effects
#   with a Script Call: $game_system.disable_dee
#  Intended for use with DEE Version 1.6 and Dynamic Sounds 2.0

if DEE::DEE_VERSION > 1.6 and RyexCFG::D_S::VERSION > 2.0
  print "ERROR: Ryex\'s Dynamic Sounds Patch isnt needed with\n",
        "versions higher than version 1.6, you may wish to\n",
        "remove the Patch."

module DEE
  class System
    # * Update - DEE::System
    #  - Allows disabling DEE
    alias alias_dee_update update unless $@
    def update
      # Return if DEE is Disabled
      return if $game_system.disable_dee
      # Call Original

# ** Game_System
class Game_System
  attr_accessor :disable_dee    # Allow turning off Dynamic Sounds when true

# ** Scene_Save
class Scene_Save < Scene_File
  # * Write Save Data - Scene_Save
  #  - Saves DEE in addition to other Game Variables
  #     file : write file object (opened)
  alias dynamic_sounds_patch_write_save_data write_save_data unless $@
  def write_save_data(file)
    # Call Original or other Aliases
    # Save DEE to File
    Marshal.dump($DEE, file)

# ** Scene_Load
class Scene_Load < Scene_File
  # * Read Save Data - Scene_Load
  #  - Rebuilds entire Dynamic Sounds for a Map when Game is Loaded
  #     file : file object for reading (opened) 
  alias dynamic_sounds_patch_read_save_data read_save_data unless $@
  def read_save_data(file)
    # Call Original or other Aliases
    # Restore DEE
    $DEE = Marshal.load(file)
    # If magic number is different from when saving
    # (if editing was added with editor)
    if $game_system.magic_number == $data_system.magic_number
      # Setup Dynamic Sounds on Loaded Map