lfnetwork.com mark read register faq members calendar

Thread: String Help.
Thread Tools Display Modes
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Old 10-04-2005, 08:07 PM   #1
GangsterAngel
Rookie
 
GangsterAngel's Avatar
 
Join Date: May 2004
Posts: 139
String Help.

U have a small problem.

im making a model preview on the player selection window.
like the "Build A Jedi" model preview.

i have a problem. i dont know how to get the left of '/'
to get the model name.

thats the only thing stopping my code from working .

for example if i have

"stormtrooper/default" as the 'Model' Cvar.
strrchr(model,'/') would give me '/default'

and i need to know what would return "stormtrooper/".

Help appreciated.
GangsterAngel is offline   you may: quote & reply,
Old 10-05-2005, 06:11 PM   #2
razorace
Impressive, Terran!
 
razorace's Avatar
 
Join Date: May 2002
Posts: 9,172
char *point = strrchr(model,'/');
point++; //advances to the character after the '/'.
point = '\0'; //sets the char to be the end of life special char.

//At this point, your 'model' should read "stormtrooper/". I beleive this is how the rest of the code strips the strings like.


---Jedi Guardian of the Newbie Questions
---Masters of the Force Team Leader / Creator
---Open Jedi Project Lead Moderator / Co-Founder
razorace is offline   you may: quote & reply,
Old 10-05-2005, 09:40 PM   #3
GangsterAngel
Rookie
 
GangsterAngel's Avatar
 
Join Date: May 2004
Posts: 139
That seems to be returning (null) , thanx anyway though.
GangsterAngel is offline   you may: quote & reply,
Old 10-05-2005, 10:20 PM   #4
razorace
Impressive, Terran!
 
razorace's Avatar
 
Join Date: May 2002
Posts: 9,172
What is returning NULL? point or Model?


---Jedi Guardian of the Newbie Questions
---Masters of the Force Team Leader / Creator
---Open Jedi Project Lead Moderator / Co-Founder
razorace is offline   you may: quote & reply,
Old 10-06-2005, 12:34 AM   #5
GangsterAngel
Rookie
 
GangsterAngel's Avatar
 
Join Date: May 2004
Posts: 139
point.
and model is the same as the "Model" cvar.
GangsterAngel is offline   you may: quote & reply,
Old 10-06-2005, 03:14 AM   #6
razorace
Impressive, Terran!
 
razorace's Avatar
 
Join Date: May 2002
Posts: 9,172
Point should be null, but model should have been truncated like you wanted.


---Jedi Guardian of the Newbie Questions
---Masters of the Force Team Leader / Creator
---Open Jedi Project Lead Moderator / Co-Founder
razorace is offline   you may: quote & reply,
Old 10-06-2005, 03:57 PM   #7
ensiform
The Stig
 
ensiform's Avatar
 
Join Date: Nov 2004
Location: Sawtooth Cauldron
Posts: 1,241
Current Game: Borderlands 2
i believe he wants to see what model is not take out model.


iojamp project lead / coder
ensiform is offline   you may: quote & reply,
Old 10-06-2005, 04:29 PM   #8
razorace
Impressive, Terran!
 
razorace's Avatar
 
Join Date: May 2002
Posts: 9,172
Well, I told him who to do what he asked. Not sure exactly what his current problem is thou.


---Jedi Guardian of the Newbie Questions
---Masters of the Force Team Leader / Creator
---Open Jedi Project Lead Moderator / Co-Founder
razorace is offline   you may: quote & reply,
Old 10-06-2005, 08:04 PM   #9
GangsterAngel
Rookie
 
GangsterAngel's Avatar
 
Join Date: May 2004
Posts: 139
i have the skin name, i need the model name.

Quote:
//At this point, your 'model' should read "stormtrooper/". I beleive this is how the rest of the code strips the strings like.
thats what i need, i need to get the modelname. but the code dosent seem to be working.
GangsterAngel is offline   you may: quote & reply,
Old 10-07-2005, 02:18 AM   #10
razorace
Impressive, Terran!
 
razorace's Avatar
 
Join Date: May 2002
Posts: 9,172
What is model outputing after my code?


---Jedi Guardian of the Newbie Questions
---Masters of the Force Team Leader / Creator
---Open Jedi Project Lead Moderator / Co-Founder
razorace is offline   you may: quote & reply,
Old 10-07-2005, 04:42 AM   #11
GangsterAngel
Rookie
 
GangsterAngel's Avatar
 
Join Date: May 2004
Posts: 139
same as the "Model" cvar.

stormtrooper/default
GangsterAngel is offline   you may: quote & reply,
Old 10-07-2005, 12:04 PM   #12
razorace
Impressive, Terran!
 
razorace's Avatar
 
Join Date: May 2002
Posts: 9,172
hmm, could have sworn that that worked. try poking around in the code a bit more. I'm sure it's in there somewhere.


---Jedi Guardian of the Newbie Questions
---Masters of the Force Team Leader / Creator
---Open Jedi Project Lead Moderator / Co-Founder
razorace is offline   you may: quote & reply,
Old 10-13-2005, 08:11 PM   #13
GangsterAngel
Rookie
 
GangsterAngel's Avatar
 
Join Date: May 2004
Posts: 139
Got it working.

Code:
	//*******************************
		strcpy(modelStr,model);
		if ( ( skins = strchr( modelStr, '/' ) ) == NULL) {
			skins = "default";
		} else {
			*skins++ = 0;
		}
		strcpy(skin,skins);
	//*******************************
http://img299.imageshack.us/img299/5...preview0po.jpg



Last edited by GangsterAngel; 10-13-2005 at 08:50 PM.
GangsterAngel is offline   you may: quote & reply,
Old 10-13-2005, 10:08 PM   #14
razorace
Impressive, Terran!
 
razorace's Avatar
 
Join Date: May 2002
Posts: 9,172
Ah, my bad. I missed the pointer reference when setting the end of file character. IE my sample code should have been....

Code:
char *point = strrchr(model,'/');
point++; //advances to the character after the '/'.
*point = '\0'; //sets the char to be the end of life special char.'
Good job figuring it out.


---Jedi Guardian of the Newbie Questions
---Masters of the Force Team Leader / Creator
---Open Jedi Project Lead Moderator / Co-Founder
razorace is offline   you may: quote & reply,
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Go Back   LucasForums > Network > JediKnight Series > Editing Central > JA Coding > String Help.

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:24 PM.

LFNetwork, LLC ©2002-2011 - All rights reserved.
Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.