lfnetwork.com mark read register faq members calendar

Thread: Debugging Scripts with SendMessageToPC function
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 03-28-2004, 02:29 AM   #1
tk102
Well past expiration date
 
tk102's Avatar
 
Join Date: Jan 2004
Posts: 5,766
Current Game: Fallout 2
Forum Veteran Helpful! Notable contributor 
Post Suggestions for Debugging Scripts

Has anyone found a simple function (like a one or two-liner) that can be used for debugging scripts during the game?

I'm sure somebody out there has a clever debug technique.

Original thread



Last edited by tk102; 01-23-2005 at 02:48 PM.
tk102 is offline   you may: quote & reply,
Old 09-02-2004, 06:45 PM   #2
beancounter
Rookie
 
Join Date: Jul 2004
Posts: 169
I posted this a month or so ago, but I figured I would add it to the sticky post to help anyone new to scripting KOTOR.

The command SendMessageToPC will print a message to the ingame feedback screen. The proper syntax is:
Code:
object  oPC=GetFirstPC();
string cmMessage = "This is a test";
SendMessageToPC(oPC, cmMessage);
This script will print out "This is a test" in the Feedback screen. You can also print out variables, as long as you convert them to a string. It is also helpful to include the creatures name in your debug string so you know what creature is firing the script. Try the following:
Code:
object  oPC=GetFirstPC();
string cmMessage = GetName(OBJECT_SELF) + "-" + "This is a test";

SendMessageToPC(oPC, cmMessage);
Or if you want a 1-liner:
Code:
SendMessageToPC(GetFirstPC(),"OBJECT_SELF's  name is: "+GetName(OBJECT_SELF));
I hope this helps.

Last edited by Darth InSidious; 08-02-2009 at 02:27 PM. Reason: Removed size tags.
beancounter 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 > Knights of the Old Republic > Editing / Modding > Holowan Laboratories > Tutorials: Scripting > Debugging Scripts with SendMessageToPC function

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 On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:02 AM.

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