Server Totals
Deglos - (1)
Mikona - (1)
Le'Or - (1)
Ferrell - (0)
Elysia - (0)
M'Chek - (0)
Underdark - (0)
Wilderness - (0)
Visimontium - (0)
Total players: 3
Gallery

Links Menu

return command?

Moderators: Nighthawk4, Dungeon Masters

return command?

PostAuthor: Jeffi0 » Mon Sep 01, 2003 1:19 am

I can't figure out how to use this one. I learned the toolset by experimenting with it, but I can't find a way to get this to work. All I know is that int StartingConditional() is needed at the top, and the return is used to return a value. It's very important for conversations which is why I need it. I assumed that it would return a variable and depending on that variable a conversation line may or may not be said- will not be said if 0 and will be said if 1. Or the return TRUE and return FALSE thing. Can anyone clarify the use of this statement for me? It is pretty much essential for my quests, and I don't like the plot wizard.
User avatar
Jeffi0
Apprentice Scholar
 
Posts: 567
Joined: Fri Apr 04, 2003 12:57 am

PostAuthor: Jordicus » Mon Sep 01, 2003 2:43 am

sample code from a previous script example:

Code: Select all
int HasItem(object oPlayer, string sItemTag)
{
    int bReturnValue = FALSE;
    object oItem = GetItemPossessedBy(oPlayer, sItemTag);
    if (GetIsObjectValid(oItem)==TRUE){
        bReturnValue = TRUE;
    }
    return bReturnValue;
}

void main()
{
    object oPC = GetEnteringObject();
    string sItem1 = "XYZ1";  // tag of first key

    if (HasItem(oPC, sItem1))
    {
        SendMessageToPC(oPC, "You may pass");
    }else
    {
        SendMessageToPC(oPC, "This area is restricted");
    }
}

       
User avatar
Jordicus
Team Member; Retired with Honors
 
Posts: 8048
Joined: Tue Jan 21, 2003 3:46 pm
Location: Whitehall, PA (GMT -4)

PostAuthor: maxinion » Mon Sep 01, 2003 9:04 pm

Here you go.

1- presence of something. 0- absense. Its so, so its nothing. Therefore, 1=true, 0=false. In the int StartingConditional, you're creating a funcion that returns an int. The conversation editor checks this script- if it returns a 1, and therefore true, that leg is displayed, or whatnot. Otherwise, it isn't. return is used in all other methods that aren't voids- voids need 'void'-nothing- to return, to be complete, while other functions, like int, string, etc., need a data-type of their own to be returned to compile succesfully.

Does that make sense?
User avatar
maxinion
Team Member; Retired with Honors
 
Posts: 2779
Joined: Mon Mar 17, 2003 7:44 pm
Location: Bay Area, CA
DM Avatar: Andrinor

PostAuthor: Jeffi0 » Tue Sep 02, 2003 2:15 am

I found my old computer class notes from when we did C. Amazing how much you forget once the class is over and the exam is written. :) Those helped a lot too, but it still doesnt show the line of conversation even though the Text Appears When is set to the script and all that. BTW, does it have to be StartingConditional, or can it be any int function? Thanks :)
User avatar
Jeffi0
Apprentice Scholar
 
Posts: 567
Joined: Fri Apr 04, 2003 12:57 am


Return to NWN Scripting

Who is online

Registered users: Bing [Bot], Google [Bot], NCGrimbo