• What do you need help with? Version 1
    5,001 replies, posted
Got it working using: [code] string pattern = searchPattern.Replace(".", "\\."); pattern = searchPattern.Replace("*", "(.+)"); Regex regex = new Regex(pattern, RegexOptions.None); Match match = regex.Match(file.Name); if (match.Success) { listViewItem.Text = match.Groups[1].Value; } [/code] thanks :)
[QUOTE=VeryNiceGuy;24445093]I'm 100% sure the file is where I want it to be, but it's giving me an exception because it's trying to write somewhere [B]else. [/B]It's trying to write to the picturebox2.ImageLocation for some reason.[/QUOTE] [QUOTE=high;24431122]Does the directory exist? [B]Also I would prepend Application.StartupPath to it.[/B][/QUOTE] Path.Combine(Application.StartupPath, "settings/background.txt")
So it should look like this? [code] Dim sw As New IO.StreamWriter(Path.Combine(Application.StartupPath, "settings/background.txt")) MsgBox("Background saved from, " + PictureBox2.ImageLocation + "!") sw.Write(PictureBox2.ImageLocation) sw.Close() [/code] If that's right, it's giving me an error: [code]'Path' is not declared. It may be inaccessible due to its protection level.[/code]
System.IO.Path
Ah, thank you so much! Finally, it works! [editline]10:08[/editline] Just one more thing to make this perfect :v:
I have a list view with a SelectedIndexChanged event, but it isn't called when I do listView.SelectedIndices.Add(0) until it goes into focus - how can I force the event to run?
Back with my a* implementation, for some reason searching isn't alway working like : - search from coordinates 39,39 to 5,14 (works) - search from coordinates 5,14 to 39,39 (not working) When I looked closer any search that features a tile about 10 or more down from the current tile takes a insane amount of time. [url]http://pastebin.com/E4ks2HGg[/url]
[QUOTE=jA_cOp;24440929]None of these things are related to the language. What most of these tools do is just pack an interpreter with the to-be-interpreted code. There's nothing in the way of creating a compiler which emits machine-code for Python or Lua, either (see LuaJIT, and there might be something like this for Python too). For Lua, you could use this: [url]http://www.facepunch.com/showthread.php?t=700562[/url] But there are others out there, too.[/QUOTE] I didnt really want to bump a year old thread so i though id ask you here. Do you still have the source code for this? would you mind me having a look at it?
[QUOTE=quincy18;24458326]Back with my a* implementation, for some reason searching isn't alway working like : - search from coordinates 39,39 to 5,14 (works) - search from coordinates 5,14 to 39,39 (not working) When I looked closer any search that features a tile about 10 or more down from the current tile takes a insane amount of time. [URL]http://pastebin.com/E4ks2HGg[/URL][/QUOTE] [cpp]int remainingDistance = Math.Abs(targetX - x) + Math.Abs(targetY + y);[/cpp] Didn't read much further, but this should be targetY - y, right?
Thanks it worked
[QUOTE=WTF Nuke;24447422]How do I go about erasing parts of a vector? I created a vector to store all the spells that the player casts (since they can cast more than one spell). This is what I got for deleting them after the collide with something / are used:[code] for (int i = spells.size() - 1; i == 0; i --) if (spells[i].move(t)) spells.erase(std::remove(spells.begin(), spells.end(), i), spells.end());[/code] I can't seem to get it to work. Anyone know how to delete the instance without skrewing up the iterators?[/QUOTE] Use a std::list instead.
Are there any really good articles/websites or even tutorials about good game structure design? Like, managing your states and so on? I need to have a good read
[QUOTE=ZeekyHBomb;24462686]Use a std::list instead.[/QUOTE] I can't get a list to work. Can you help? I got this so far, but compiler spits out loads of errors. [CODE] for(cspell * i = mainch.spells.begin(); i < mainch.spells.end(); i++) i->draw();[/CODE]
[QUOTE=WTF Nuke;24473805]I can't get a list to work. Can you help? I got this so far, but compiler spits out loads of errors. -snip- [/QUOTE] [cpp] for(std::list<Spell>::iterator i = mainch.spells.begin(); i != mainch.spells.end(); i++) i->draw(); [/cpp] Where "Spell" is the type of object stored in the "mainch" list.
[QUOTE=jA_cOp;24474824][cpp] for(std::list<Spell>::iterator* i = mainch.spells.begin(); i != mainch.spells.end(); i++) i->draw(); [/cpp] Where "Spell" is the type of object stored in the "mainch" list.[/QUOTE] Thanks man!
[QUOTE=WTF Nuke;24475558]Thanks man![/QUOTE] When I edited your code I forgot to take out the '*', the iterator shouldn't be a pointer. (Edited my earlier post with the correct code)
Is it possible to load an image from a text file if the text file contains the PATH to an image? I'm trying to do this on the load event for Star, but my approach is getting the error '57' and that isn't telling me much.. [img]http://filesmelt.com/dl/what12.png[/img] [editline]11:50PM[/editline] I'm trying to load it into a PictureBox by the way, sorry for forgetting D:
[QUOTE=VeryNiceGuy;24476430]Is it possible to load an image from a text file if the text file contains the PATH to an image?[/QUOTE] Of course not? :sigh: You want to load the path from the text file and then load the file at the given path as your image.
Alright, thanks I just got it! [code] Dim imagePathlol As String = "settings/background.txt" Dim a As New System.IO.StreamReader(imagePathlol) PictureBox2.ImageLocation = a.ReadToEnd() [/code] I think I tried something similar to this but I must have forgotten something. Thanks!
[QUOTE=VeryNiceGuy;24477328]Alright, thanks I just got it! [code] Dim imagePathlol As String = "settings/background.txt" Dim a As New System.IO.StreamReader(imagePathlol) PictureBox2.ImageLocation = a.ReadToEnd() [/code] I think I tried something similar to this but I must have forgotten something. Thanks![/QUOTE] You could use System.IO.File.ReadAllText. (Also, what did local variable names ever do to you? Show some respect!)
Java: I have X and Y coords of a touch input, and X and Y coords of the player. I want the player to rotate to face the touch input. The rotation method takes a degree, 1-359. How do I get the degree to rotate it by?
[QUOTE=ilolled;24481998]Java: I have X and Y coords of a touch input, and X and Y coords of the player. I want the player to rotate to face the touch input. The rotation method takes a degree, 1-359. How do I get the degree to rotate it by?[/QUOTE] What kind of perspective are we talking about? 2D top-down?
2D side scroller., but same thing applies really.
Are there any existing tools used to make GUIs in an SFML game? I could write all the buttons out myself but it's really long and boring. I'm using SFML if that matters.
[QUOTE=WTF Nuke;24482828]Are there any existing tools used to make GUIs in an SFML game? I could write all the buttons out myself but it's really long and boring. I'm using SFML if that matters.[/QUOTE] I assume you mean custom made and not Windows Forms or any of that?
There are a couple of GUI libraries written for SFML, but I haven't tried any of them out. [editline]10:42AM[/editline] [QUOTE=Chris220;24469962]Are there any really good articles/websites or even tutorials about good game structure design? Like, managing your states and so on? I need to have a good read[/QUOTE] Anyone?
[QUOTE=Chris220;24486379]There are a couple of GUI libraries written for SFML, but I haven't tried any of them out. [editline]10:42AM[/editline] Anyone?[/QUOTE] I just googled this: [url]http://gamedesign.wikicomplete.info/game-structure[/url]
[QUOTE=ilolled;24482100]2D side scroller., but same thing applies really.[/QUOTE] Get the deltaX and deltaY from the player to the point (the difference between their X and Y coords) then get the angle by using atan(deltaY/deltaX). Atan will return the angle but it might be in radians, depenging on what language you are using. What I use (C#): [cpp] public static float Angle ( Point A, Point B ) { return (float)Math.Atan2( B.Y - A.Y, B.X - A.X ); } //Converts radians to degrees public static float RadiansToDegrees ( float arg ) { return arg * 57.29577951308232F; }[/cpp]
[QUOTE=WTF Nuke;24482828]Are there any existing tools used to make GUIs in an SFML game? I could write all the buttons out myself but it's really long and boring. I'm using SFML if that matters.[/QUOTE] Why not use garry's GWEN? [editline]02:01PM[/editline] Any good resources to learn some simple assembly? Just enough to make a C/C++ interpreter to build on top of it
Can anyone tell me why this horrible piece of code fails horribly? NB! Don't blame me if you remove the assert-s and your computer explodes NB!2 It's my first try on multithreading [url]http://sim642.pastebin.com/Byqfb9Jx[/url]
Sorry, you need to Log In to post a reply to this thread.