Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Getting information from limbs?

Author
Message
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 14th Apr 2009 00:49 Edited at: 14th Apr 2009 01:48
Hi! I added entities in 3DWS and added a class named Turn then i added 4 key values (up, right, down, left) then gave each key value a value depending on where it was on the map. Now i want to read these values in Dark GDK. I already have found the limb i just have to get the values from the limb. So how do i do this?

P.S. i tried reading through the documentation but i can't find anything that'll help

EDIT: I made a little program to view information from limbs and the name of limb 1 is displaying as:
Quote: "Classname=turn
left=1
right=1
up=1
down=0
objecttype=entity"

That is what i entered on 3DWS so, how do I get this information so i can do decision structures and such with it?

I'm poetry in motion
prasoc
16
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 14th Apr 2009 02:16 Edited at: 14th Apr 2009 02:21
You split it with "n" and then you got each line, then you split it further using "=" and you can then check the value and name of the limb keys. Well that's what I do anyway, not too sure if theres an easier way...
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 14th Apr 2009 02:29
I see what you mean but i never had to split a string so could you give just a small sample please? Thanks!

I'm poetry in motion
prasoc
16
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 14th Apr 2009 02:54
Very simple code to split a string into lines: (this is the code I use)
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 14th Apr 2009 03:14
Is there an include file that goes along with that? Because string isn't showing up as a variable type.

I'm poetry in motion
prasoc
16
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 14th Apr 2009 03:17
try std::string instead...
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 14th Apr 2009 03:18
Ahh ok thanks i got that bit fixed now for the rest of it I'll let you know how it turns out!

I'm poetry in motion
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 14th Apr 2009 03:59 Edited at: 14th Apr 2009 04:00
Well i keep getting this:

Quote: "1>------ Build started: Project: Zombie Attack!, Configuration: Debug Win32 ------
1>Compiling...
1>Main.cpp
1>c:documents and settingsadministratormy documentsvisual studio 2008projectszombie attack!zombie attack!main.cpp(165) : warning C4700: uninitialized local variable 'runs' used
1>Linking...
1>LINK : DebugZombie Attack!.exe not found or not built by the last incremental link; performing full link
1>libcpmtd.lib(xdebug.obj) : warning LNK4098: defaultlib 'libcmt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
1>libcpmtd.lib(stdthrow.obj) : error LNK2019: unresolved external symbol __CrtDbgReportW referenced in function "void __cdecl std::_Debug_message(wchar_t const *,wchar_t const *,unsigned int)" (?_Debug_message@std@@YAXPB_W0I@Z)
1>libcpmtd.lib(xdebug.obj) : error LNK2019: unresolved external symbol __malloc_dbg referenced in function "void * __cdecl operator new(unsigned int,struct std::_DebugHeapTag_t const &,char *,int)" (??2@YAPAXIABU_DebugHeapTag_t@std@@PADH@Z)
1>libcpmtd.lib(xdebug.obj) : error LNK2019: unresolved external symbol __free_dbg referenced in function "void __cdecl operator delete(void *,struct std::_DebugHeapTag_t const &,char *,int)" (??3@YAXPAXABU_DebugHeapTag_t@std@@PADH@Z)
1>DebugZombie Attack!.exe : fatal error LNK1120: 3 unresolved externals
1>Build log was saved at "file://cocuments and SettingsAdministratorMy DocumentsVisual Studio 2008ProjectsZombie Attack!Zombie Attack!DebugBuildLog.htm"
1>Zombie Attack! - 4 error(s), 2 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
"


And i have no clue how to fix that, so any help on this problem is greatly appreciated!

I'm poetry in motion
prasoc
16
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 14th Apr 2009 13:53
That is a weird error Try right clicking your project name in vc++ and click properties, go to "linker" and then "input" under "ignore specific libraries" add to it "libcmt". that should work
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 14th Apr 2009 22:54
I tried it but now i got 141 unresolved external errors, could anything else be causing this?

I'm poetry in motion
prasoc
16
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 14th Apr 2009 23:01
try putting "libcpmtd" instead of "libcmt" them
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 14th Apr 2009 23:04
I would but that one is already in the list along with "msvcrt" and "atls". I'll try removing the libcmtd one

I'm poetry in motion
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 14th Apr 2009 23:06
It seems the linker is missing the debug versions of some standard library functions: malloc_dbg, free_dbg... Even if you are compiling in debug mode, set the runtime libraries to non-debug:

Project properties, configuration, C++, code generation, then set the runtime library to MT instead of MTd. This fixed similar errors for me. If you already did this, then I don't know what the problem is.
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 14th Apr 2009 23:15
Ahh thanks Mireben that fixed that problem now to get to the original issue of splitting the limbs

I'm poetry in motion
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 15th Apr 2009 00:26 Edited at: 15th Apr 2009 00:30
First off i want to thank you prosac for all the help so far, definitely couldn't do this without you. But, i'm fully understanding the way of doing this but these functions are so specific on the strings and such that i just can't get it to work with my knowledge of C++. Here is what i'm using as the process to setup each turn on a map (turn as in a corner on a sidewalk).

After i have made entities for each turn (11 total) with the values: left,right,up,down all set to 1 or 0 depending on their location in 3DWS I export it as .dbo. Then i load it up and i make a struct for the turns:


now i want to setup the values for each variable in the struct. So i use a for loop with this setup:


So as you can see i understand the process in which i want to do this but i just can't seem to understand the code. My knowledge of dealing with strings in C++ is quite limited as you can see. So please any code that would fit into the above format would be greatly appreciated! Keep in mind that i can program and i'm not some complete noob asking for code without a clue of what i'm doing. (i've got the shooting, collisions, moving, reloading, full animations, and the entire AI except for setting up the turns)

P.S. Sorry for another double post, i'm still not sure what the rules are about it.

I'm poetry in motion
prasoc
16
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 15th Apr 2009 01:02 Edited at: 15th Apr 2009 01:05


In theory that should work, but I don't have access to a compiler atm so I cant test it for you soz.
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 15th Apr 2009 01:10 Edited at: 15th Apr 2009 01:13
Ok well i got this:
Quote: "1>c:documents and settingsadministratormy documentsvisual studio 2008projectszombie attack!zombie attack!main.cpp(567) : error C2065: 'temper' : undeclared identifier
1>c:documents and settingsadministratormy documentsvisual studio 2008projectszombie attack!zombie attack!main.cpp(568) : error C2065: 'temper' : undeclared identifier
1>c:documents and settingsadministratormy documentsvisual studio 2008projectszombie attack!zombie attack!main.cpp(568) : error C2228: left of '.find' must have class/struct/union
1> type is ''unknown-type''"

repeated a couple of times so what do i declare temper as to fit with the class/struct/union thing? (Let me guess std::string?)

I'm poetry in motion
prasoc
16
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 15th Apr 2009 01:12
change

to
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 15th Apr 2009 01:15 Edited at: 15th Apr 2009 01:18
That's what i thought too so i changed it and i got:

maybe it's something like my previous lib problem... take that back now i see the conversion part of the error message

I'm poetry in motion
prasoc
16
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 15th Apr 2009 01:21
can you show whats on line 571, etc please
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 15th Apr 2009 01:25 Edited at: 15th Apr 2009 01:29
Umm,

570:

574:

578:

582:


I'm almost 100% positive that the problem is that up,down,left,right were declared as int and i'm trying to put a std::string into it so i'm messing around with that now.

EDIT: When ever i make the declaration of the struct variables to std::string then i compare values using "==" it says:

and when i try to convert temper it says:


I'm poetry in motion
prasoc
16
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 15th Apr 2009 01:28 Edited at: 15th Apr 2009 01:29
"turns[foundCount].down = temper.substr( temper.find( "=" )+1,temper.size ( ) );"

was older code (I updated it since):

try what I put in the code post with the atoi().

ie:
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 15th Apr 2009 01:30 Edited at: 15th Apr 2009 01:33
Ok i'll try it out

Ugh this is why i'm trying to refrain from these strings lol. I got:


I'm poetry in motion
prasoc
16
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 15th Apr 2009 01:46


are you sure you put that in? WITH the c_str() bit on the end of them?
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 15th Apr 2009 01:51 Edited at: 15th Apr 2009 01:52
Woops missed the .c_str() but when i run it i get a run time error of:

(oops forgot to change the name of my game too)
This might be something that i did though.

EDIT: Now i know it's something with the above code because i removed it from the program and it ran without any errors

I'm poetry in motion
prasoc
16
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 15th Apr 2009 01:57
Some debugging here: put at the top where you load your variables:



and then change the "turns[foundCount].up" to "testInt" and see what happens...
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 15th Apr 2009 02:01
same error

I'm poetry in motion
prasoc
16
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 15th Apr 2009 02:04
hold on, ill debug it now (I have access to vc++)
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 15th Apr 2009 02:05 Edited at: 15th Apr 2009 02:18
Ah ha! I found out it's something with:

so i'm reviewing my object information now

YAY! I got it to run without syntax or any errors. the problem was that it was running the for loop from 0 to 11 but the first limb was 1. Now to test if it works

Thank you very much! I'm still making it work but it's closer then i was

I'm poetry in motion
prasoc
16
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 15th Apr 2009 02:14
change to:



That stops the access violation
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 15th Apr 2009 02:18
thanks!

I'm poetry in motion
prasoc
16
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 15th Apr 2009 02:20
Does it work?
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 15th Apr 2009 02:21
Well error wise yes but i'm checking the values of each turn by pasting it on the screen but everyone is 0.

I'm poetry in motion
prasoc
16
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 15th Apr 2009 02:42
try putting on "if(temper.find("up")){" if function this:



that should show you what values are being returned
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 15th Apr 2009 02:58 Edited at: 15th Apr 2009 03:03
Ahhhh i'm sad to say this but it's returning the wrong things
It returns:
-Root
-Class
-Tur
-1
right=1
up=1
dow
-0
objecttype=e
-(the last 4 letters of entity... i will a slap on the head for typing it lol)

then it repeats with the next limb

If you don't want to help anymore i understand, i'm thinking of just trying a different way, thanks for all your help already though!

EDIT EDIT EDIT EDIT EDIT EDIT EDIT EDIT!!
Yay! Lol i added "\" before the "n" the
type of lines and it returned the right values. Now to get it to work right with my AI! Thank you very much!

I'm poetry in motion
prasoc
16
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 15th Apr 2009 03:01
im just curious as to why it is returning the wrong thing...
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 15th Apr 2009 03:04 Edited at: 15th Apr 2009 04:54
I got it semi working... not really. I have this:

but when i run it, the game keeps returning the up values and when i test the up values it returns everything but the up values, then the right and down decision structures don't return anything...

I'm poetry in motion

Login to post a reply

Server time is: 2024-11-25 14:34:18
Your offset time is: 2024-11-25 14:34:18