lfnetwork.com mark read register faq members calendar

Thread: Text Output in HUD
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 11-18-2004, 08:25 AM   #1
mad mapper
Rookie
 
Join Date: Aug 2004
Location: Germany
Posts: 25
Text Output in HUD

Hello,

i added a PERSISTANT variable.
The Scores are shown in MP in the lower right like that:
"Scores: 15"

I want to show the Variable I added in the lower left, so I edited the hud.menu in the ui Folder:

Code:
menuDef 
	{
		name					"lefthud"
		fullScreen				0						// MENU_FALSE
		rect					0 368 112 112				// Size and position of the menu
		visible				1						// Visible on open


		// Tells current credits of game*****************************************************
		itemDef       
		{
			name				credit_line
			forecolor			1 1 1 1
			rect				20 20 6 12				// (these positions are relative to the initial position of the menu) 
												// X pos, Y pos, char size, char height
		}
[...]
Afterwards I added this code to CG_DrawHud
Code:
const char *creditStr = NULL;
creditStr = va("Credits: %i", cg.snap->ps.persistant[PERS_CREDITS]);
	focusItem = Menu_FindItemByName(menuHUD, "credit_line");
			if (focusItem)
			{
				UI_DrawScaledProportionalString(
					focusItem->window.rect.x, 
					focusItem->window.rect.y, 
					creditStr, 
					UI_RIGHT|UI_DROPSHADOW, 
					focusItem->window.foreColor, 
					0.7);
			}
It doesn't work. But if I type this:
Code:
char *creditStr = "Credits: ";
It works. I really don't know why.


Excuse my bad English please.
mad mapper is offline   you may: quote & reply,
Old 11-18-2004, 08:50 AM   #2
razorace
Impressive, Terran!
 
razorace's Avatar
 
Join Date: May 2002
Posts: 9,171
The problem is definately with how you implimented persistant[PERS_CREDITS]);. You're going to have to detail what you did.


---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 11-18-2004, 09:26 AM   #3
mad mapper
Rookie
 
Join Date: Aug 2004
Location: Germany
Posts: 25
I think the bug is there because of the Output function because when I try this code
Code:
creditStr = va("%s: %i", "Credits", 0);
	focusItem = Menu_FindItemByName(menuHUD, "credit_line");
			if (focusItem)
			{
				UI_DrawScaledProportionalString(
					focusItem->window.rect.x, 
					focusItem->window.rect.y, 
					creditStr, 
					UI_RIGHT|UI_DROPSHADOW, 
					focusItem->window.foreColor, 
					0.7);
			}
nothing happens as well


Excuse my bad English please.
mad mapper is offline   you may: quote & reply,
Old 11-18-2004, 10:13 AM   #4
razorace
Impressive, Terran!
 
razorace's Avatar
 
Join Date: May 2002
Posts: 9,171
hmmm. Well, my guess is that va doesn't like it when you use unnessisary alases for testing like that. You got a debugger?


---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 11-19-2004, 09:33 AM   #5
mad mapper
Rookie
 
Join Date: Aug 2004
Location: Germany
Posts: 25
Sorry, alases???
Don't know what that is


Excuse my bad English please.
mad mapper is offline   you may: quote & reply,
Old 11-19-2004, 10:45 AM   #6
razorace
Impressive, Terran!
 
razorace's Avatar
 
Join Date: May 2002
Posts: 9,171
Err, I've never seen va used with static varibles for input like that.


---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 11-20-2004, 01:20 AM   #7
mad mapper
Rookie
 
Join Date: Aug 2004
Location: Germany
Posts: 25
Well,
const char *creditStr is no static variable but a pointer.

Look into the source of CG_DrawMenu. They use const char *scoreStr = va (...)
to print the scores into an AnsiString

Afterwards the output is made with CG_DrawProportionalString (...)


Excuse my bad English please.
mad mapper is offline   you may: quote & reply,
Old 11-20-2004, 07:35 AM   #8
razorace
Impressive, Terran!
 
razorace's Avatar
 
Join Date: May 2002
Posts: 9,171
Yeah, but you're using two constant values for inputs onto the va. I beleive the easiest way to check this is to see what's in creditStr before the UI_DrawScaledProportionalString is called.


---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 > Text Output in HUD

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 02:46 AM.

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