• What do you need help with? V. 3.0
    4,884 replies, posted
[QUOTE=benjojo;31496074][url]http://pastebin.com/ZdvBarCX[/url] Right after solving one issue A new one happens. If anyone can see anything dumb here Please say. If you can pass MC via this then its working... The closer I get, the further I move away... :suicide:[/QUOTE] It'd be nice to know that the problem is. [editline]3rd August 2011[/editline] [QUOTE=Map in a box;31496237]Would a basic interpreter need a tokenizer? (unrelated to zeek)[/QUOTE] No. It's probably more comfortable and extensible though.
Well seems like I broke something. The program seems to be ignoring the T and P characters (except for the last P). It can read and distinguish S and E, with the respective numbers to its side but for some reason it is not reading T or P (except last P). Anyone think of what might be the problem? I changed from !feof to fgets and it seemed to work but then I realized it was not responding to the other characters. [quote] S 10 T P E 15 T T P [/quote] [code]while (fgets(string, sizeof(string), fp) != NULL){ //while file still has lines tokenPtr = strtok(string, " "); //begin tokenizing string while (tokenPtr != NULL){ //while there are still tokens left if (strcmp(tokenPtr, "S") == 0 ){ tokenPtr = strtok(NULL, " "); printf("S: %s\n", tokenPtr); } else if (strcmp(tokenPtr, "T") == 0 ){ printf("T\n"); ++S; } else if (strcmp(tokenPtr, "E") == 0){ tokenPtr = strtok(NULL, " "); printf("E: %s\n", tokenPtr); } else if (strcmp(tokenPtr, "P") == 0){ printf("Time: %d, Next Signal: %d, Header: %d\n", S, E, Si); } else{} tokenPtr = strtok(NULL, " "); }}}[/code] Output: [quote] S: 10 E: 15 Time: 0, Next Signal: 0, Header: 0 [/quote] Not sure why it does extra spaces.
Okay, so, I'm pretty clueless here, so please bear with me. I'm trying to write some sort of program that I can use to read arbitrary memory locations of other processes, and spit out packets of information over serial. I want to do this so that I can display random bits of information from games in various ways, using my Arduino and various motors, lights, and gauges. The Arduino side of things isn't really an issue, as Ideally I'd do something similar to what I did with [url=http://youtu.be/fQ3OCSz6qYw]my music visualizer[/url], spitting values over serial as ascii, using letters to denote the beginnings and ends of data packets. My problem is that beyond knowing of the existance of [url=http://msdn.microsoft.com/en-us/library/ms680553(v=vs.85).aspx]ReadProcessMemory[/url] and being able to find [url=http://tpforums.org/forum/thread-8373.html]some small examples[/url], I haven't the slightest clue of where to begin. I'm fairly comfortable with the basics of [url=http://processing.org]Processing[/url], which is java, and [url=http://arduino.cc/]Arduino[/url], which is C, but I have no experience using either without the aforementioned IDEs and libraries. I haven't the slighest idea of how to break away from the IDEs successfully, or how to use libraries that aren't prepackaged for the IDEs.
I was using Visual C++ 2010 Express to compile the OpenTDD source code and I remembered a plug-in you could get for a code like scroll bar, I needed Visual Studio 2010 though. I downloaded it from DreamSpark and now when I try to compile the same project I'm getting errors in my stdafx.h file, it can't find any of these includes: [QUOTE]#include <cstdio> #include <cstddef> #include <cstring> #include <cstdlib> #include <climits> #include <cassert>[/QUOTE] I've searched Google but I haven't come across any fixes. EDIT: I solved this by reinstalling the Express version alongside it, I don't know if this had an affect or my PC is just retarded but it compiles fine again now.
[QUOTE=ZeekyHBomb;31493095]Well, if you want the UI to be responsive at all times, then you should not make blocking calls in the same thread as the UI thread for example. I don't think there's any wrong way to do it, just go ahead and write some code; if you encounter problems, rethink your current approach or ask more specific questions here. Anywhere really. Anything you can use without much dependencies. For example, if you were to write a Pong-clone, you could begin with the player-paddle, first making it draw, then making it move. Then you could isolate the player-only code, create a paddle base-class and create an enemy-paddle without movement so far. Then you could make the ball, draw it, move it, detect collisions and then make the enemy move. Or you could do the ball first and then the paddle. Then you could make a menu. You could also have done the menu first, then the actual game. Doesn't matter. If you were to create, say a top-down shooter, then you probably wouldn't start with the weapons. First you'd do the player, because without the player the weapons are practically useless. And before that you'd probably do level-stuff, because the player will be put inside the world, though it wouldn't be a problem to do the player first, then add levels and then take care about putting the player inside the world and doing collisions there.[/QUOTE] Not talking about like, with the player/weapons/menu and what not, of how to start the class, I know you have [code] class cTest { public: // How to make this part implement with the main.cpp or w/e its called private: // and how to use this to make it use with the class and other .cpp files like above. }; [/code] This is the stuff that i can't start, I don't know how to start it of what to use and how to implement it all with eachother.
A class is basically just a way of grouping related variables and functions together. The questions you need to ask yourself when creating a class are a) what data should it hold, and b) what functions should it provide for working with that data. The answers to those questions depend entirely on what the class is supposed to do. Can you give an example of something you think you need a class for, but you don't know where to start writing the class?
[QUOTE=Datsun;31496693]Well seems like I broke something. The program seems to be ignoring the T and P characters (except for the last P). It can read and distinguish S and E, with the respective numbers to its side but for some reason it is not reading T or P (except last P).[/QUOTE] Your file uses newlines ("\n") as a delimiter, but you don't have it in the strtok delimiters string. You've probably got newlines stuck to other tokens, or bunches of tokens stuck together with newlines.
Can anybody recommend a good editor besides Vim (doesn't let me do what I want, but I really like the modal and keybinds) and Emacs (I like my pinky too much)?
gedit?
gedit hides the trailing new line of the file, which really bothers me.
[QUOTE=Jookia;31498773]Can anybody recommend a good editor besides Vim (doesn't let me do what I want, but I really like the modal and keybinds) and Emacs (I like my pinky too much)?[/QUOTE] textmate
Doesn't work on Linux.
vim or emacs, pretty much. Also, you could possibly ask on the Linux forum?
Wait, what exactly is it that you want which vim doesn't do? [editline]3rd August 2011[/editline] I have a feeling this is going to end with somebody coding another text editor.
I dunno, Vim hides the trailing new line of Unix files and its autoindent converts 3 spaces to 2 tabs and 1 space since my tabstop is 2.
I've never observed this newline-hiding-phenomena you describe and I'm pretty sure you can configure vim to deal with just about any tab/space configuration. Relevant settings are ts (tabstop, as you're clearly aware), sts (softtabstop), sw (shiftwidth), and et (expandtab). Failing that, you've probably exhausted all your options. I could name more editors, but you'd surely find some nits to pick. :)
Has anyone ever worked with Office Communicator's API or something similar? I am trying to send and dispatch incoming messages but I have no idea where to start... I tried to use the COM Automation API but that didn't work out quite as I wanted.
[QUOTE=ROBO_DONUT;31503361]I've never observed this newline-hiding-phenomena you describe and I'm pretty sure you can configure vim to deal with just about any tab/space configuration. Relevant settings are ts (tabstop, as you're clearly aware), sts (softtabstop), sw (shiftwidth), and et (expandtab).[/QUOTE] I really have looked at ways around, but Vim doesn't seem to be cut out to do indenting.
[url=http://vimdoc.sourceforge.net/htmldoc/options.html#%27indentexpr%27]Tried messing with indentexpr yet[/url]? [editline]3rd August 2011[/editline] Wait, no, won't work. Autoindent is used for indenting so spaces automagically turn into tabs. [editline]3rd August 2011[/editline] However, there's only one issue I can see happening with this and that is comments being aligned improperly. Which usually shouldn't be a massive deal nor massively wrong as it's usually only a matter of one tab stop.
My issue is that I want to have Vim adapt to my indents, so if I type three spaces, next line will be three spaces, two tabs, two tabs. Simplest way to do things, yet Vim doesn't do it that way.
Vim handles indentation by width so it might require a total overhaul of the indentation system. cindent settings might accomplish what you want, though.
Having a challenge with a problem in my textbook... cannot seem to conceptualize a way to do this. I need to make a program that uses the formula to derive pi which is (pi / 4 = 1 - 1/3 + 1/5 - 1/7 + 1/9 ... etc) and approximates a value based on how many iterations of the formula that the user inputs. So for example if a user enters "3" it would do the formula "(1 - 1/3 + 1/5) * 4" and print that value. I'm writing this in Java, if anybody can give me some tips with the for loop that would be great thanks.
Im messing around with Irrlicht and so far its ok but I was just wondering, to clear the screen you use: [cpp] vidDriver->beginScene(true, true, irr::video::SColor(255,100, 149, 237)); [/cpp] But the SColor seems to be ARGB, so this is more for anyone that has some experience with Irrlicht, is there an format that is RGBA? I tried RGBA16 but the color wasnt right so im guessing I need an RGBA32
[QUOTE=W00tbeer1;31507764]Having a challenge with a problem in my textbook... cannot seem to conceptualize a way to do this. I need to make a program that uses the formula to derive pi which is (pi / 4 = 1 - 1/3 + 1/5 - 1/7 + 1/9 ... etc) and approximates a value based on how many iterations of the formula that the user inputs. So for example if a user enters "3" it would do the formula "(1 - 1/3 + 1/5) * 4" and print that value. I'm writing this in Java, if anybody can give me some tips with the for loop that would be great thanks.[/QUOTE] Should be pretty simple. Just store the number they input and then do something like this: [cpp] int sign = 1; float result = 0; for (int i = 0; i < numIterations; i++) { result += sign * 1.0 / (i * 2 + 1); sign = -sign; } result *= 4; [/cpp] Where numIterations is the number of iterations they inputted.
QuickQuestion: what does sfml 2.0 replace GetInput with? In my old code I used const sf::Input& Input = App.GetInput(); unsigned int MouseX = Input.GetMouseX(); unsigned int MouseY = Input.GetMouseY(); But the code I am using now has window->GetInput().GetMouseX(); window->GetInput().GetMouseY(); and I get these errors on compile Error: &#8216;class sf::RenderWindow&#8217; has no member named &#8216;GetInput&#8217; It should be in here somewhere [url]http://www.sfml-dev.org/documentation/2.0/classsf_1_1RenderWindow.php[/url] Would it be this? [url]http://www.sfml-dev.org/documentation/2.0/classsf_1_1Mouse.php[/url]
sf::Keyboard and sf::Mouse replace sf::Input in 2.0
Ok I have got [code] window = new sf::RenderWindow(sf::VideoMode(800,600,32), "The Legends Of Spektarris"); MousePosition = sf::Mouse::GetPosition(window); //include/SFML/Window/Mouse.hpp note: no known conversion for argument 1 from &#8216;sf::RenderWindow*&#8217; to &#8216;const sf::Window&&#8217; int x = camera->GetPosition().x + MousePosition.x; int y = camera->GetPosition().y + MousePosition.y; [/code] But it does not compile and gives me the error above.
[QUOTE=Sartek;31524976]Ok I have got [code] window = new sf::RenderWindow(sf::VideoMode(800,600,32), "The Legends Of Spektarris"); MousePosition = sf::Mouse::GetPosition(window); //include/SFML/Window/Mouse.hpp note: no known conversion for argument 1 from &#8216;sf::RenderWindow*&#8217; to &#8216;const sf::Window&&#8217; int x = camera->GetPosition().x + MousePosition.x; int y = camera->GetPosition().y + MousePosition.y; [/code] But it does not compile and gives me the error above.[/QUOTE] It's expecting a reference, you're giving it a pointer. Do: [cpp]MousePosition = sf::Mouse::GetPosition(*window);[/cpp]
Im trying to make my program luad using INI files with SimpleINI [url]http://code.jellycan.com/simpleini/[/url] But it seems when I get a value: [cpp] CSimpleIniA::TNamesDepend sections; ini.GetAllSections(sections); CSimpleIniA::TNamesDepend keys; ini.GetAllKeys("Window", keys); WindowSettings::WindowWidth = ini.GetValue("Window", "WindowWidth", NULL); WindowSettings::WindowHeight = ini.GetValue("Window", "WindowHeight", NULL); WindowSettings::FullScreen = ini.GetValue("Window", "FullScreen", NULL); WindowSettings::AntiAliasing = ini.GetValue("Window", "AntiAliasing", NULL); WindowSettings::VSync = ini.GetValue("Window", "VSync", NULL); [/cpp] It returns the values as Const Char*, is there anyway to convert these into ints and bools?
Does anyone have any useful links on audio programming (preferably with C#)? Things like writing waveforms to a buffer so sound can be synthesised in real time, the how to write low pass filters, etc.
Sorry, you need to Log In to post a reply to this thread.