09-21-2009, 12:42 AM | #1 |
Snek
Join Date: Jan 2003
Location: Kansas
Age: 34
Posts: 9,192
|
SpeedModGenerator2.5 (autosave function)
Download http://www.flashflashrevolution.com/...p?songid=39261 -------------------------------------------------- So I worked on this today. I started not knowing how to search for a specific file and write to it but I believe I figured it all out. This one only works with 3.9 and 3.95 because I got fed up with trying to make it work for 3.9 and 4.0 while saving. Try it out for me and tell me if it works please. It is generally pretty stable if you aren't completely dumb. Last edited by Izzy; 09-22-2009 at 02:03 PM.. |
09-21-2009, 12:48 AM | #2 |
FFR Player
|
Re: SpeedModGenerator2.5 (autosave function)
very cool i'll try it out tomorrow
__________________
|
09-21-2009, 12:50 AM | #3 |
I am leonid
Join Date: Oct 2008
Location: MOUNTAIN VIEW
Age: 35
Posts: 8,080
|
Re: SpeedModGenerator2.5 (autosave function)
Doesn't work on mac
lame |
09-21-2009, 12:54 AM | #4 |
⁽ ´ཀ`⁾
|
Re: SpeedModGenerator2.5 (autosave function)
i agre, macs are lame
__________________
|
09-21-2009, 12:55 AM | #5 |
I am leonid
Join Date: Oct 2008
Location: MOUNTAIN VIEW
Age: 35
Posts: 8,080
|
Re: SpeedModGenerator2.5 (autosave function)
i agree with that too
|
09-21-2009, 12:51 PM | #6 |
Snek
Join Date: Jan 2003
Location: Kansas
Age: 34
Posts: 9,192
|
Re: SpeedModGenerator2.5 (autosave function)
Here is my horrendous looking code. I'm aware there might be easier or less bulky methods of doing things. I just put down the first thing that came to my head that made it work.
Code:
using System; using System.ComponentModel; using System.Windows.Forms; using System.IO; namespace WindowsFormsApplication1 { public partial class SpeedmodGen : Form { StreamReader x = new StreamReader("metrics.ini"); public int xcount = 1; public int xxcount = 1; public int ccount = 1; public int cccount = 1; public double xstart = 0; public double xend = 0; public double xinc = 0; public int cstart = 0; public int cend = 0; public int cinc = 0; public SpeedmodGen() { InitializeComponent(); } private void pictureBox1_Click(object sender, EventArgs e) { } private void Go_Click(object sender, EventArgs e) { if (Xstart.Text == "" || Xend.Text == "" || Xinc.Text == "" || Cstart.Text == "" || Cend.Text == "" || Cinc.Text == "") { MessageBox.Show("At least one field is empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { xstart = Convert.ToDouble(Xstart.Text); xend = Convert.ToDouble(Xend.Text); xinc = Convert.ToDouble(Xinc.Text); cstart = Convert.ToInt32(Cstart.Text); cend = Convert.ToInt32(Cend.Text); cinc = Convert.ToInt32(Cinc.Text); metrics.Text = ""; Language.Text = ""; for (double i = xstart; i <= xend; i = i + xinc) { xxcount += 1; } cccount = xxcount; for (int i = cstart; i < cend; i = i + cinc) { cccount += 1; } metrics.Text = ("# Player options\r\n"); metrics.Text = metrics.Text + ("Speed=" + cccount + "\r\n"); metrics.Text = metrics.Text + ("SpeedDefault=mod,1x\r\n"); for (double i = xstart; i <= xend; i = i + xinc) { metrics.Text = metrics.Text + ("Speed," + xcount + "=mod," + System.Math.Round(i, 3) + "x;name,x" + System.Math.Round(i, 3) + "\r\n"); xcount += 1; metrics.Update(); } ccount = xcount; for (int i = cstart; i <= cend; i = i + cinc) { metrics.Text = metrics.Text + ("Speed," + ccount + "=mod," + "C" + i + ";name,C" + i + "\r\n"); ccount += 1; metrics.Update(); } Language.Text = ""; for (double i = xstart; i <= xend; i = i + xinc) { Language.Text = Language.Text + ("x" + System.Math.Round(i, 3) + "=x" + System.Math.Round(i, 3) + "\r\n"); metrics.Update(); } for (int i = cstart; i <= cend; i = i + cinc) { Language.Text = Language.Text + ("C" + i + "=C" + i + "\r\n"); metrics.Update(); } xcount = 1; xxcount = 1; ccount = 1; cccount = 1; xstart = 0; xend = 0; xinc = 0; cstart = 0; cend = 0; cinc = 0; } } private void Clear_Click(object sender, EventArgs e) { Xstart.Text = ""; Xend.Text = ""; Xinc.Text = ""; Cstart.Text = ""; Cend.Text = ""; Cinc.Text = ""; metrics.Text = ""; Language.Text = ""; filePath.Text = ""; } private void Form1_Load(object sender, EventArgs e) { } private void Help_Click(object sender, EventArgs e) { metrics.Text = ""; Language.Text = ""; metrics.Text = "Created by: Izzy\r\n"; metrics.Text = metrics.Text + "http://www.flashflashrevolution.com/profile/Izzy/"; Language.Text = "1) Don't leave any fields blank \r\n"; Language.Text = Language.Text + ("2) Don't use any letters \r\n"); Language.Text = Language.Text + ("3) Don't make the incriments bigger then the end value \r\n"); Language.Text = Language.Text + ("4) It's a good idea to make your values pass through 1x \r\n"); } private void Save_Click(object sender, EventArgs e) { int screenop = 0; xcount = 1; xxcount = 1; ccount = 1; cccount = 1; xstart = 0; xend = 0; xinc = 0; cstart = 0; cend = 0; cinc = 0; string num = "0"; if (filePath.Text == "") { MessageBox.Show("No directory selected. Please browse for a file.", "Error" ,MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (filePath.Text.Contains("metrics.ini") == false) { MessageBox.Show("Please select the metrics.ini file.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (Xstart.Text == "" || Xend.Text == "" || Xinc.Text == "" || Cstart.Text == "" || Cend.Text == "" || Cinc.Text == "") { MessageBox.Show("At least one field is empty.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { StreamReader r = new StreamReader(filePath.Text); string line = ""; int lines = 0; while ((line = r.ReadLine()) != null) { lines++; } r.Close(); StreamReader rx = new StreamReader(filePath.Text); string[] meh = new string[lines]; for (int i = 0; i < meh.Length; i++) { line = rx.ReadLine(); meh[i] = line; if (meh[i] == "# Player options") { num = rx.ReadLine(); num = num.Substring(6); } } rx.Close(); string beh = ""; for (int j = 0; j < meh.Length; j++) { beh = meh[j]; if (meh[j] == "# Player options") { meh[j] = " "; } if (meh[j] == null) { } else if (beh.Contains("SpeedDefault=mod,")) { meh[j] = " "; } if (meh[j] == null) { } else if (beh.Contains("Speed,")) { meh[j] = " "; } if (meh[j] == "[ScreenOptionsMaster]") { screenop++; if (screenop >= 2) { meh[j] = " "; } } } int blank = 0; for (int o = 0; o < meh.Length; o++) { if (meh[o] == " ") { blank++; } } string[] mah = new string[meh.Length - blank]; int m = 0; for (int l = 0; l < meh.Length; l++) { if (meh[l] != " ") { mah[m] = meh[l]; m++; } } StreamWriter w = File.CreateText(@filePath.Text); for (int x = 0; x < mah.Length -1; x++) { w.WriteLine(mah[x]); } w.Close(); StreamWriter wx = File.AppendText(@filePath.Text); xstart = Convert.ToDouble(Xstart.Text); xend = Convert.ToDouble(Xend.Text); xinc = Convert.ToDouble(Xinc.Text); cstart = Convert.ToInt32(Cstart.Text); cend = Convert.ToInt32(Cend.Text); cinc = Convert.ToInt32(Cinc.Text); for (double i = xstart; i <= xend; i = i + xinc) { xxcount += 1; } cccount = xxcount; for (int i = cstart; i < cend; i = i + cinc) { cccount += 1; } wx.WriteLine("[ScreenOptionsMaster]"); wx.WriteLine("# Player options"); wx.WriteLine("Speed=" + cccount + ""); wx.WriteLine("SpeedDefault=mod,1x"); for (double i = xstart; i <= xend; i = i + xinc) { wx.WriteLine("Speed," + xcount + "=mod," + System.Math.Round(i, 3) + "x;name,x" + System.Math.Round(i, 3)); xcount += 1; } ccount = xcount; for (int i = cstart; i <= cend; i = i + cinc) { wx.WriteLine("Speed," + ccount + "=mod," + "C" + i + ";name,C" + i); ccount += 1; } wx.Close(); } } private void openFileDialog1_FileOk(object sender, CancelEventArgs e) { } private void Save2_Click(object sender, EventArgs e) { xcount = 1; xxcount = 1; ccount = 1; cccount = 1; xstart = 0; xend = 0; xinc = 0; cstart = 0; cend = 0; cinc = 0; if (filePath.Text == "") { MessageBox.Show("No directory selected. Please browse for a file.", "Error" ,MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (filePath.Text.Contains("english.ini") == false) { MessageBox.Show("Please select the english.ini file.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (Xstart.Text == "" || Xend.Text == "" || Xinc.Text == "" || Cstart.Text == "" || Cend.Text == "" || Cinc.Text == "") { MessageBox.Show("At least one field is empty.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { StreamWriter wx = File.AppendText(@filePath.Text); wx.WriteLine("[OptionNames]"); xstart = Convert.ToDouble(Xstart.Text); xend = Convert.ToDouble(Xend.Text); xinc = Convert.ToDouble(Xinc.Text); cstart = Convert.ToInt32(Cstart.Text); cend = Convert.ToInt32(Cend.Text); cinc = Convert.ToInt32(Cinc.Text); for (double i = xstart; i <= xend; i = i + xinc) { xxcount += 1; } cccount = xxcount; for (int i = cstart; i < cend; i = i + cinc) { cccount += 1; } for (double i = xstart; i <= xend; i = i + xinc) { xcount += 1; } ccount = xcount; for (int i = cstart; i <= cend; i = i + cinc) { ccount += 1; } for (double i = xstart; i <= xend; i = i + xinc) { wx.WriteLine("x" + System.Math.Round(i, 3) + "=x" + System.Math.Round(i, 3)); } for (int i = cstart; i <= cend; i = i + cinc) { wx.WriteLine("C" + i + "=C" + i); } wx.Close(); } } private void search_Click(object sender, EventArgs e) { OpenFileDialog F = new OpenFileDialog(); F.Title = "Search for file"; F.InitialDirectory = @"C:\Program Files"; F.Filter = "All files (*.*)|*.*"; F.FilterIndex = 1; F.RestoreDirectory = true; if (F.ShowDialog() == DialogResult.OK) { filePath.Text = F.FileName; } } } } |
09-21-2009, 01:09 PM | #7 |
Bagel
Join Date: Apr 2008
Location: california
Posts: 266
|
Re: SpeedModGenerator2.5 (autosave function)
Can you make a mac version?
__________________
My latest simfiles: Xenobius: http://www.stepmania.com/download.ph...Xenobius.smzip Coward Killing Time: http://www.flashflashrevolution.com/...p?songid=38838 Minute: http://www.flashflashrevolution.com/...p?songid=35958 Chaoz Impact: http://www.stepmania.com/download.ph...ozImpact.smzip |
09-21-2009, 01:15 PM | #8 |
Snek
Join Date: Jan 2003
Location: Kansas
Age: 34
Posts: 9,192
|
Re: SpeedModGenerator2.5 (autosave function)
I'm sorry, I have no idea how to program apps. Also I do not own a mac computer.
|
09-21-2009, 01:23 PM | #9 |
Live a wonderful life~
Join Date: Oct 2006
Posts: 7,313
|
Re: SpeedModGenerator2.5 (autosave function)
Just downloaded this and it seems pretty stable to me. I really love the auto save feature and the browsing button. Good job Izzy, I will definitely start using this.
__________________
=============================== The idea that RDCP 3 may come out in the future is a fun thought to have~ =============================== |
09-21-2009, 01:30 PM | #10 | |
FFR Player
Join Date: Apr 2006
Posts: 7
|
Re: SpeedModGenerator2.5 (autosave function)
Quote:
|
|
09-21-2009, 02:17 PM | #11 |
I am leonid
Join Date: Oct 2008
Location: MOUNTAIN VIEW
Age: 35
Posts: 8,080
|
Re: SpeedModGenerator2.5 (autosave function)
For mac users, I just wrote a Ruby script that generates speedmods.
Download and unzip THIS FILE, open up terminal, go to the folder where speedmodgen.rb is located, and type following command: Code:
ruby speedmodgen.rb (xmod start) (xmod end) (xmod increment) (cmod start) (cmod end) (cmod increment) <usage example> ruby speedmodgen.rb 1 10 0.25 200 800 20 *xmod increment rate should be at least 0.001, and cmod increment rate at least 1 Then the script will generate two files: english and metric Open up those files, copy the content, and paste onto appropriate location at english.ini and metric.ini. No fancy GUI or anything, but this script works at least. Here's the source code. Code:
if $*.size < 6 puts "Usage: #$0 Xmod_start Xmod_end Xmod_increment Cmod_start Cmod_end Cmod_increment" exit end xstart, xend, xinc, cstart, cend, cinc = $*.map{|i|i.to_f} if xinc < 0.001 puts "Xmod increment rate should be at least 0.001" exit end if cinc < 1 puts "Cmod increment rate should be at least 1" exit end xnum = [((xend-xstart)/xinc).to_i + 1, 0].max cnum = [((cend-cstart)/cinc).to_i + 1, 0].max xmod = xstart cmod = cstart met = File.open("metric","w") eng = File.open("english","w") met.puts"[ScreenOptionsMaster]" met.puts"# Player options" met.puts"Speed=#{xnum+cnum}" met.puts"SpeedDefault=mod,1x" eng.puts"[OptionNames]" eng.puts"# Menu option entry text" 1.upto(xnum) do |i| mline="Speed,%d=mod,%.3fx;name,x%.3f"%[i,xmod,xmod] eline="x%.3f=x%.3f"%[xmod,xmod] met.puts mline.gsub /\.?0+(x|$)/,'\1' eng.puts eline.gsub /\.?0+(=|$)/,'\1' xmod += xinc end 1.upto(cnum) do |i| met.puts"Speed,%d=mod,C%d;name,C%d"%[i+xnum,cmod,cmod] eng.puts"C%d=C%d"%[cmod,cmod] cmod += cinc end If you are windows user, just use Izzy's program since it's much more convenient to use than this one. Last edited by leonid; 09-21-2009 at 02:44 PM.. |
09-21-2009, 04:26 PM | #12 | |
Use me as a porta-potty
Join Date: Dec 2006
Age: 30
Posts: 4,319
|
Re: SpeedModGenerator2.5 (autosave function)
__________________
Quote:
You're Aja Leith of the Holograms! You're very exotic, intelligent and sophisticated. |
|
09-21-2009, 04:49 PM | #13 |
RobMagic
|
Re: SpeedModGenerator2.5 (autosave function)
Good job Izzy I'm sure many people will want this.
|
09-21-2009, 05:41 PM | #14 | |
I am leonid
Join Date: Oct 2008
Location: MOUNTAIN VIEW
Age: 35
Posts: 8,080
|
Re: SpeedModGenerator2.5 (autosave function)
Quote:
Why did I write ruby script lmao |
|
09-21-2009, 05:42 PM | #15 |
Snek
Join Date: Jan 2003
Location: Kansas
Age: 34
Posts: 9,192
|
Re: SpeedModGenerator2.5 (autosave function)
Nice one. =)
|
09-21-2009, 06:37 PM | #16 |
Banned
Join Date: Sep 2009
Posts: 41
|
Re: SpeedModGenerator2.5 (autosave function)
|
09-22-2009, 01:25 PM | #17 |
FFR Player
Join Date: Sep 2004
Posts: 4
|
Re: SpeedModGenerator2.5 (autosave function)
Unfortunately this program crushes under my system.
It returns error: "Application wasn`t initialized properly (0xc0000135)" Does it work under winXP ? |
09-22-2009, 01:31 PM | #18 |
Snek
Join Date: Jan 2003
Location: Kansas
Age: 34
Posts: 9,192
|
Re: SpeedModGenerator2.5 (autosave function)
If you have updated windows it should. Windows XP by itself probably doesn't have the newest .netframework without updating. I tried making it work with .netframework 2.0 but I started having issues. It might have been unrelated so I could try again later.
Edit: http://www.flashflashrevolution.com/...p?songid=39261 Reuploaded it. I switched it to be compatible with .netframework 2.0 and removed all using system statements that it didn't use. Should work on unupdated windows xp now. Last edited by Izzy; 09-22-2009 at 02:03 PM.. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|