![]() |
| ||
| Problem with DLL i'm coding for a game Hello, Usually I can find solutions to problems that seem to arise when I'm coding for this game, but I'm stumped on why this is happening.. So I found out how to get the text from the last line of the text box on this game, and I want to separate the player name and what they said and store them in different char arrays. So I made multiple variances of what I think would work, but they all seem to make the same thing happen; they make the last thing that was said disappear! I'm thinking that I'm misunderstanding something so I'm hoping one of you guys could help me out on this. Here is the source code: struct PlayerAnswer{Oh, and here's pictures on before and after what it looks like:http://i37.tinypic.com/11lr3hw.jpg http://i38.tinypic.com/rc91qw.jpg Is it a problem with pointers or something? I'm soo confused :( |
| ||
| Re: Problem with DLL i'm coding for a game Looks like you have some Assembly code mixed in with the GetLineCount ()and GetLastText ()functions. I have no idea whether those functions are correct or not. In addition, I'm not familiar enough with Windows functions and DWORD, plus I have to relearn mallocevery time I use it, which isn't often, so again, I can't comment on those two functions except to say that if there is not a good reason to use C and Assembly code, I would go with C++ code and use C++-strings rather than C-strings and use newrather than malloc. I rewrote your GetText ()function so I could use and try out the GetLastPlayerAnswer()function and as far as I can tell, it seems to work, at least if I understand correctly what it's supposed to do. Here is the program I tested: #include <string> I think your best step is to really narrow down where exactly the problem is. Put some debugging statements in after the call to the GetLastText ()function and make sure it is returning what you want it to. If not, put some debugging code in to make sure that the GetLineCount ()function does what it is supposed to do. Once you narrow down the exact function where the problem is located, go from there. Like I said, your GetLastPlayerAnswer ()function appears to work to me, or at least it did with my example. |
| ||
| Re: Problem with DLL i'm coding for a game ha silly me :P I forgot to point out that everything did work fine until i had made GetLastPlayerAnswer. Could it be because I'm directly working off of the char* returned? if so, how would I fix that? :( |
| ||
| Re: Problem with DLL i'm coding for a game Quote:
Run the program I posted and see if that function works correctly. It should split the string "Bob:Yes" into "Bob" and "Yes" and put it into a PlayerName variable, which I thought was the goal. Does it do that for you? Is that what you are looking for? If "Bob:Yes" works and some other string doesn't, list that string that doesn't work. |
| ||
| Re: Problem with DLL i'm coding for a game Quote:
http://i37.tinypic.com/11lr3hw.jpg http://i38.tinypic.com/rc91qw.jpg You see how the text after the char name is removed? I want it to stay there. |
| ||
| Re: Problem with DLL i'm coding for a game Quote:
Well, then my guess is that your problem is elsewhere, in code that you haven't posted. Note that this function: PlayerAnswer GetLastPlayerAnswer() doesn't display anything anywhere; it merely splits the string in two. So somewhere after the call to this function, if you want to actually display the two broken strings, you have to do so by appending it to the text box or however you do it. But it appears that GetLastPlayerAnswer () is not intended to display anything. It merely breaks the string in two and it appears to be working. If it's also supposed to append the text to the text box, you'll have to add that part. |
| All times are GMT -4. The time now is 6:54 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC