lfnetwork.com mark read register faq members calendar

Thread: Suggestions for Debugging Scripts
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: Dragon Age: Origins
Forum Veteran Helpful! Notable contributor 
Post Suggestions for Debugging Scripts

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.


tk102 is offline   you may: quote & reply,
Old 03-28-2004, 04:00 AM   #2
greymeister
 
greymeister's Avatar
 
Join Date: Jun 2002
Posts: 29
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 (c) 2002 Bioware Corp.

#include "k_inc_debug"

void main()
{
AddAvailableNPCByObject(NPC_CANDEROUS,GetObjectByT ag("canderous"));
AddPartyMember(NPC_CANDEROUS,GetObjectByTag("cande rous"));
}


Have you tried including for logging?
greymeister is offline   you may: quote & reply,
Old 03-28-2004, 04:14 AM   #3
tk102
Well past expiration date
 
tk102's Avatar
 
Join Date: Jan 2004
Posts: 5,766
Current Game: Dragon Age: Origins
Forum Veteran Helpful! Notable contributor 
I've seen that script, but what if you already have Canderous in your party?

What do you mean "including for logging"?


tk102 is offline   you may: quote & reply,
Old 03-28-2004, 04:26 AM   #4
Helodermatid
Rookie
 
Helodermatid's Avatar
 
Join Date: Feb 2004
Posts: 30
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.
Helodermatid is offline   you may: quote & reply,
Old 03-28-2004, 04:42 AM   #5
tk102
Well past expiration date
 
tk102's Avatar
 
Join Date: Jan 2004
Posts: 5,766
Current Game: Dragon Age: Origins
Forum Veteran Helpful! Notable contributor 
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.


tk102 is offline   you may: quote & reply,
Old 03-28-2004, 05:36 AM   #6
tk102
Well past expiration date
 
tk102's Avatar
 
Join Date: Jan 2004
Posts: 5,766
Current Game: Dragon Age: Origins
Forum Veteran Helpful! Notable contributor 
Here's another:
Quote:
SetGlobalFadeIn();
I suppose you could vary the color and the timing to mean different things during debugging.


tk102 is offline   you may: quote & reply,
Old 04-11-2004, 04:38 PM   #7
tk102
Well past expiration date
 
tk102's Avatar
 
Join Date: Jan 2004
Posts: 5,766
Current Game: Dragon Age: Origins
Forum Veteran Helpful! Notable contributor 
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:
Code:
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).


tk102 is offline   you may: quote & reply,
Old 04-11-2004, 05:18 PM   #8
tk102
Well past expiration date
 
tk102's Avatar
 
Join Date: Jan 2004
Posts: 5,766
Current Game: Dragon Age: Origins
Forum Veteran Helpful! Notable contributor 
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
Code:
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.



Last edited by tk102; 04-11-2004 at 05:37 PM.
tk102 is offline   you may: quote & reply,
Old 04-12-2004, 05:50 PM   #9
shosey
Junior Member
 
shosey's Avatar
 
Join Date: Feb 2004
Location: Earth
Posts: 380
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?
shosey is offline   you may: quote & reply,
Old 04-12-2004, 05:53 PM   #10
tk102
Well past expiration date
 
tk102's Avatar
 
Join Date: Jan 2004
Posts: 5,766
Current Game: Dragon Age: Origins
Forum Veteran Helpful! Notable contributor 
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.


tk102 is offline   you may: quote & reply,
Old 09-02-2004, 06:45 PM   #11
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:

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.
beancounter is offline   you may: quote & reply,
Old 09-02-2004, 06:56 PM   #12
shosey
Junior Member
 
shosey's Avatar
 
Join Date: Feb 2004
Location: Earth
Posts: 380
thats pretty cool, good find!


Hosey's KotOR Mods [Ebon Hawk Basement] [High Stakes Pazaak] [I am Jedi!] [Skip Endire Spire]
More to come
shosey is offline   you may: quote & reply,
Old 09-02-2004, 08:11 PM   #13
tk102
Well past expiration date
 
tk102's Avatar
 
Join Date: Jan 2004
Posts: 5,766
Current Game: Dragon Age: Origins
Forum Veteran Helpful! Notable contributor 
I'm glad you found this thread and reposted that beancounter. I have this thread bookmarked.


tk102 is offline   you may: quote & reply,
Old 09-02-2004, 08:20 PM   #14
Darth333
Administraterror
 
Darth333's Avatar
 
Status: Administrator
Join Date: Feb 2004
Location: In my secret dungeon...
Posts: 8,295
Quote:
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 )

Last edited by Darth333; 09-02-2004 at 08:37 PM.
Darth333 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 > Suggestions for Debugging Scripts

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

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