Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

Debugging Scripts with SendMessageToPC function

Page: 1 of 1
 tk102
03-28-2004, 2:29 AM
#1
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 (http://www.lucasforums.com/showthread.php?s=&threadid=143290)
 beancounter
09-02-2004, 6:45 PM
#2
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:

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:

object oPC=GetFirstPC();
string cmMessage = GetName(OBJECT_SELF) + "-" + "This is a test";

SendMessageToPC(oPC, cmMessage);


Or if you want a 1-liner:

SendMessageToPC(GetFirstPC(),"OBJECT_SELF's name is: "+GetName(OBJECT_SELF));
I hope this helps.
Page: 1 of 1