tk102 Posted March 28, 2004 Share Posted March 28, 2004 Hey all, Has anyone found a simple function (like a one or two-liner) that can be used for debugging scripts during the game? So far I've tried the following functions to no avail: PrintString DebugString SpeakString AurPostString I'm sure somebody out there has a clever debug technique. Link to comment Share on other sites More sharing options...
greymeister Posted March 28, 2004 Share Posted March 28, 2004 I'm not sure if you've already looked here, but I saw this in the uncompiled scripts area: //:: k_act_canderadd /* adds canderous to the party */ //:: Created By: Jason Booth //:: Copyright © 2002 Bioware Corp. #include "k_inc_debug" void main() { AddAvailableNPCByObject(NPC_CANDEROUS,GetObjectByTag("canderous")); AddPartyMember(NPC_CANDEROUS,GetObjectByTag("canderous")); } Have you tried including for logging? Link to comment Share on other sites More sharing options...
tk102 Posted March 28, 2004 Author Share Posted March 28, 2004 I've seen that script, but what if you already have Canderous in your party? What do you mean "including for logging"? Link to comment Share on other sites More sharing options...
Helodermatid Posted March 28, 2004 Share Posted March 28, 2004 Actually I would like to know this as well. I have tried most of the SpeakString type functions listed in nwscript but none of them seems to do anything. Maybe Bioware disabled these in the release version? In any case, right now I am using object oPC = GetFirstPC(); AssignCommand(oPC,PlayAnimation(26,1.0,5.0)); I use different animations if there are more than one line or branch which I need to test. I am sure there are more efficient methods out there, so let us know if you find anything. Link to comment Share on other sites More sharing options...
tk102 Posted March 28, 2004 Author Share Posted March 28, 2004 H -- glad you're still here. I saw the ShipBuild function is used to turn off debug functions in the k_inc_debug.nss script. Maybe Bioware decided to go one step further and integrate that function into the debug functions themselves. So we have these debug methods. Spawn Characters Play animations I was looking for writing something to the Feedback screen or show a "Credits Earned" or "Darkside Points Gained" icon at the top of the screen. Link to comment Share on other sites More sharing options...
tk102 Posted March 28, 2004 Author Share Posted March 28, 2004 Here's another: SetGlobalFadeIn(); I suppose you could vary the color and the timing to mean different things during debugging. Link to comment Share on other sites More sharing options...
tk102 Posted April 11, 2004 Author Share Posted April 11, 2004 Here's one more way: First give yourself a global variable to work with by adding a new row to globalcat.2da and saving it in the override folder. Call it something like DEBUG_NUM and make it a Number. Then in your script you can simply call: SetGlobalNumber("DEBUG_NUM",55); to set the number to 55 or whatever. After your script fires during the game, save the game and use Global Variable Comparison Tool to see what the value of DEBUG_NUM has changed to. There are such things as Global Strings as well, but the comparison tool doesn't support them (yet). Link to comment Share on other sites More sharing options...
tk102 Posted April 11, 2004 Author Share Posted April 11, 2004 Okay the Global Comparison Tool has been updated to include String comparisons so you can now add a new string to the globalcat.2da and then invoke SetGlobalString("DEBUG_STR","My debug string"); . Then the comparison tool will show you what the value is. GFF Editor will too if you prefer. That is probably the closest we'll get to the coveted "PrintString" command. Edit: After reading the hoopla in nwscript.nss about 'don't use this function [setGlobalString] without permission', I thought I'd better try it. It works fine. Link to comment Share on other sites More sharing options...
shosey Posted April 12, 2004 Share Posted April 12, 2004 is there a way for the little text bubble to be displayed on screen. Like when you talk to npc's that don't really start a dialog with you - just have a bubble say something? Link to comment Share on other sites More sharing options...
tk102 Posted April 12, 2004 Author Share Posted April 12, 2004 Wouldn't that be sweet? There are functions that are supposed to do that like SpeakString etc. However, it seems that Bioware in their infinite wisdom disabled all of those functions when they distributed the game. NWN has the functions available evidently. Link to comment Share on other sites More sharing options...
beancounter Posted September 2, 2004 Share Posted September 2, 2004 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); I hope this helps. Link to comment Share on other sites More sharing options...
shosey Posted September 2, 2004 Share Posted September 2, 2004 thats pretty cool, good find! Link to comment Share on other sites More sharing options...
tk102 Posted September 3, 2004 Author Share Posted September 3, 2004 I'm glad you found this thread and reposted that beancounter. I have this thread bookmarked. Link to comment Share on other sites More sharing options...
Darth333 Posted September 3, 2004 Share Posted September 3, 2004 Originally posted by tk102 I have this thread bookmarked. T7nowhere took care of that long ago: it is stickied in his tutorial sticky ( don't tell me you don't read the stickies tk102 ) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.