Visit the Ironworks Gaming Website Email the Webmaster Graphics Library Rules and Regulations Help Support Ironworks Forum with a Donation to Keep us Online - We rely totally on Donations from members Donation goal Meter

Ironworks Gaming Radio

Ironworks Gaming Forum

Go Back   Ironworks Gaming Forum > Ironworks Gaming Forums > Neverwinter Nights 1 & 2 Also SoU & HotU Forum
FAQ Calendar Arcade Today's Posts Search

Reply
 
Thread Tools Search this Thread
Old 04-04-2003, 11:37 AM   #1
Son of Osiris
Guest
 

Posts: n/a
I need some assisstance. The Bioware Website is down and I need to know about Scripting. How do you do it? It would be nice if you guys could tell me what you know about Scripting.
  Reply With Quote
Old 04-05-2003, 08:34 AM   #2
Legolas
Jack Burton
 

Join Date: March 31, 2001
Location: The zephyr lands beneath the brine.
Age: 39
Posts: 5,459
Now there's a tough question. I'll try my best to answer [img]smile.gif[/img]

Basic scripting...
Lots of things can make use of scripts. If you don't change anything, NWN will use the same basic scripts you see in the official campaign, but only the more general ones. You make a script because you want something to happen which would not normally take place. Because you can do a great many things with scripts, there's no golden rule here, no one script you can use for everything.
Depending on what you want to have happening, you will have to make many different scripts. If you've any specific questions I can do my best to help out, although I'm no true expert yet.

Scripts make use of commands in the bar on the right-hand side of the screen. You can use any of these. They'll require some input, and get some output. Input is usually in the form of objects(lit. any object), ints (whole numbers like 1 and 12), floats(numbers with decimals like 1.2 or 12.0) and strings (lines of text and numbers without any meaning to the script, beginning with " and ending with " so the script knows what not to view as code).
Output depends on the command. You'll soon figure out what the different commands do if it is not obvious from their names.

Aside from the given commands, there are those like "if" and "else". These are conditions you can use, and work together with "TRUE" and "FALSE". You'll be using these a lot.

There are some rules on how you write things down. I'll illustrate these with some common lines you may be using.

-every statement except checks with "if" must end with a ";". Otherwise, the script will think the next line is also part of the same command even when it isn't. For example,
object oPC = GetFirstPC();
(this is useful BTW, as it means that whenever you want to get the first PC from now on, you just use oPC instead of GetFirstPC(). This works for strings, ints, floats, locations and so on in just the same way. The "o" before PC doesn't have to be there, but makes it clear for yourself that you are using the object PC, rather than the location of the PC (which might be lPC, according to
location lPC = GetLocation(oPC);
))

-if-checks are a little different. Here you can check if the object running the script is the PC, for example, using
if(GetObject(OBJECT_SELF) == oPC)
.
You'll note several things here. One, there is no ; at the end. This is because if lines are followed by actions, rahter than being actions of their own. if's are followed by a { and a }, and as long as the if is true the script will follow the commands between the brackets.
Also, you are using a == instead of an =. "=" means set whatever's on the left side to match whatever's on the right. "==" means check if what's on the left side is exactly the same as what's on the right.
Other commands used are <, <=, >, >= and !=, meaning smaller than, equal to or smaller than, greater than, equal to or greater than and not equal to respectively. If lines can also contain two or more statements, where && means and, and || means or.
You can use "else" and "else if" to assign actions ot other outcomes of the if statement following
"{
if(...)
{...}
else if(...)
{...}
else
{...}
}"
Always make sure to close opened brackets, both the {} and () kind.

-Scripts are case-sensitive. Make sure you use capital letters only where you need them, and to use only capital letters where you need them.
GetFirstPC() works, GetfirstPC does not, and neither does GEtFirstPC().

Finally, you need to distinguish between two different scripts. One starts with void main(), and is the script you use for actions. The other begins with int StartingConditional(), and merely checks whether or not to start something. You will use these almost exclusively for the TextAppearsWhen scripts in conversations. The other can be used for everything else.

If a script doesn't work, try using the PrintString() command. This puts text in the nwclientlog1.txt file in your NWN logs folder, so you can determine the reason behind it's not working through testing. Often you'll need to change the position of brackets or use a different command somewhere, and that'll solve it.
Sometimes the script won't save and you'll get a highlighted line with a cryptical error message. Here too you often need to balance brackets or add a ; in the line above. Or perhaps you are trying to compare floats and strings instead of floats and floats?
In any case, there's a lot of trial and error involved.

It's probably best if at first you stick to the scripts the script wizard conjures forth, and learn from these and other readymade scripts. The wizard sves a lot of time when it comes to using the less ambitious scripts.

Hope it helps somewhat
Legolas is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

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 On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Scripting Help robertthebard Neverwinter Nights 1 & 2 Also SoU & HotU Forum 5 11-29-2004 08:44 PM
Need some help scripting again robertthebard Neverwinter Nights 1 & 2 Also SoU & HotU Forum 6 10-22-2003 07:31 AM
Please aid me in my scripting theholyavenger Neverwinter Nights 1 & 2 Also SoU & HotU Forum 0 07-22-2002 12:55 PM
Would like some help... scripting again... Calaethis Dragonsbane Neverwinter Nights 1 & 2 Also SoU & HotU Forum 2 07-22-2002 07:28 AM
AI scripting Sharak Baldurs Gate & Tales of the Sword Coast 0 11-28-2000 07:10 PM


All times are GMT -4. The time now is 08:10 PM.


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
©2024 Ironworks Gaming & ©2024 The Great Escape Studios TM - All Rights Reserved