Aller au contenu

Photo

Compiling Error!


  • Veuillez vous connecter pour répondre
7 réponses à ce sujet

#1
champion-one

champion-one
  • Members
  • 17 messages
Hey There,
I started to made my first own quest. I'd managed to activate it via a dialog. But when I try to expand it (getting to the next Plot flag) it won't work.
I made up this script basing on someone elses. I'd just changed everything correctly.
Now the Problem: Every time I try to compile the script I get an Error in the Log Window:

E: 23:13:16 - plot01.nss - plot01.nss(42): No right bracket on expression

This is the script:


#include "log_h"
#include "utility_h"
#include "wrappers_h"
#include "plot_h"
#include "plt_quest01"
int StartingConditional()
{
    event eParms = GetCurrentEvent();                // Contains all input parameters
    int nType = GetEventType(eParms);               // GET or SET call
    string strPlot = GetEventString(eParms, 0);         // Plot GUID
    int nFlag = GetEventInteger(eParms, 1);          // The bit flag # being affected
    object oParty = GetEventCreator(eParms);      // The owner of the plot table for this script
    object oConversationOwner = GetEventObject(eParms, 0); // Owner on the conversation, if any
    int nResult = FALSE; // used to return value for DEFINED GET events
    object oPC = GetHero();
    plot_GlobalPlotHandler(eParms); // any global plot operations, including debug info
    if(nType == EVENT_TYPE_SET_PLOT) // actions -> normal flags only
    {
        int nValue = GetEventInteger(eParms, 2);        // On SET call, the value about to be written (on a normal SET that should be '1', and on a 'clear' it should be '0')
        int nOldValue = GetEventInteger(eParms, 3);     // On SET call, the current flag value (can be either 1 or 0 regardless if it's a set or clear event)
        // IMPORTANT: The flag value on a SET event is set only AFTER this script finishes running!
        switch(nFlag)
        {
            case HURL_MONSTER_KILLED:
{
if (WR_GetPlotFlag(PLT_QUEST01,HURL_MONSTER_KILLED)       
)
UT_AddItemToInventory(GEN_IM_WEP_MEL_LSW_WAR_R);
break;
}
}
case HURL_QUEST_DONE:
{
UT_RemoveItemFromInventory(GEN_IM_WEP_MEL_LSW_WAR_R);
break;
}
}
}
plot_OutputDefinedFlag(eParms, nResult);       

return nResult;                                                           = This is the "Error Line".

}

Hope you guys can help me. Posted Image

Modifié par champion-one, 25 novembre 2009 - 05:25 .


#2
Astorax

Astorax
  • Members
  • 324 messages
There's an exclamation point in there that shouldn't be I think...



Shouldn't WR!_GetPlotFlag() be WR_GetPlotFlag() ?



Do you mean !WR_GetPlotFlag() ?

#3
champion-one

champion-one
  • Members
  • 17 messages
Thanks alot Astorax! Posted Image
I deleted the "!" end changed the bracket beneath.

But now another error occured:
E: 18:01:29 - plot01.nss - plot01.nss(57): Invalid declaration type

I marked the line in my old bost above.

#4
champion-one

champion-one
  • Members
  • 17 messages
Ok fixed it Posted Image
The toolset showed me how the line had to look like.
But now another issue -.-

E: 18:20:59 - plot01.nss - plot01.nss(60): Invalid declaration type

This time the toolset shows me nothing.

Line is marked. Hope someone can help

#5
imgettingpissedoff

imgettingpissedoff
  • Members
  • 9 messages

champion-one wrote...
1 #include "log_h"
2 #include "utility_h"
3 #include "wrappers_h"
4 #include "plot_h"
5 #include "plt_quest01"
6 int StartingConditional()
7 {
8     event eParms = GetCurrentEvent();
9     int nType = GetEventType(eParms);
10   string strPlot = GetEventString(eParms, 0);
11   int nFlag = GetEventInteger(eParms, 1);
12   object oParty = GetEventCreator(eParms);
13   object oConversationOwner = GetEventObject(eParms, 0);
14   int nResult = FALSE;
15   object oPC = GetHero();
16   plot_GlobalPlotHandler(eParms);
17   if(nType == EVENT_TYPE_SET_PLOT)
18   {
19       int nValue = GetEventInteger(eParms, 2); 
20       int nOldValue = GetEventInteger(eParms, 3);
21
22       switch(nFlag)
23       {
24           case HURL_MONSTER_KILLED:
25           {
26               if ( WR_GetPlotFlag(PLT_QUEST01,HURL_MONSTER_KILLED) )
27                   UT_AddItemToInventory(GEN_IM_WEP_MEL_LSW_WAR_R);
28               break;
29           }
30       }
31       case HURL_QUEST_DONE:
32       {
33           UT_RemoveItemFromInventory(GEN_IM_WEP_MEL_LSW_WAR_R);
34           break;
35       }
36   }
37 }
38 plot_OutputDefinedFlag(eParms, nResult);
39
40 return nResult;                                                           = This is the "Error Line".
41
42 }


After indenting the script properly I've noticed a couple of issues, mostly involving the improper usage of brackets.

Remove the bracket on line 30. It's closing the switch statement prematurely. The bracket on line 36 should be closing it but right now, because of line 30, it's closing the if check started on line 17. The bracket on line 37 is closing the entire StartingConditional function so everything below it is just kinda floating off in space all by itself. This is not good.

Also, the brackets inside the case's are not, strictly speaking, necessary.
24           case HURL_MONSTER_KILLED:
25               if ( WR_GetPlotFlag(PLT_QUEST01,HURL_MONSTER_KILLED) )
26                   UT_AddItemToInventory(GEN_IM_WEP_MEL_LSW_WAR_R);
27               break;
This works just the same as what you already have written. The brackets don't hurt but leaving them out saves you some typing. This is just a little heads up to save you some time and effort.

These forums need a preview option for posts...

#6
champion-one

champion-one
  • Members
  • 17 messages
Thanks alot for the good explication.

One last thing.... when this won't work I'm going to give it up.



Toolset says:E: 21:47:48 - plot01.nss - plot01.nss(41): Unexpected end compound statement



It's the last line where the last bracket is. (number 42 in imgettingpissedoff's post)

#7
imgettingpissedoff

imgettingpissedoff
  • Members
  • 9 messages
Try this. It won't work for me because I don't have a plot for it but hopefully it'll get you up and running.

#include "log_h"
#include "utility_h"
#include "wrappers_h"
#include "plot_h"
#include "plt_quest01"

int StartingConditional()
{
    event eParms = GetCurrentEvent();
    int nType = GetEventType(eParms);
    string strPlot = GetEventString(eParms, 0);
    int nFlag = GetEventInteger(eParms, 1);
    object oParty = GetEventCreator(eParms);
    object oConversationOwner = GetEventObject(eParms, 0);
    int nResult = FALSE;
    object oPC = GetHero();
    plot_GlobalPlotHandler(eParms);
    if(nType == EVENT_TYPE_SET_PLOT)
    {
        int nValue = GetEventInteger(eParms, 2);
        int nOldValue = GetEventInteger(eParms, 3);
        switch(nFlag)
        {
            case HURL_MONSTER_KILLED:
                if (WR_GetPlotFlag(PLT_QUEST01,HURL_MONSTER_KILLED))
                    UT_AddItemToInventory(GEN_IM_WEP_MEL_LSW_WAR_R);
                break;

            case HURL_QUEST_DONE:
                UT_RemoveItemFromInventory(GEN_IM_WEP_MEL_LSW_WAR_R);
                break;
        }
    }
    plot_OutputDefinedFlag(eParms, nResult);
    return nResult;
}

Ack! Double post. First submission didn't show up even after refreshing the page. :(

Modifié par imgettingpissedoff, 25 novembre 2009 - 09:17 .


#8
champion-one

champion-one
  • Members
  • 17 messages
Thank you for all your efforts but its still not working.



I give it up. Guess this script thingy is too hard for me. I'm going to try something else....

Thanks again