Where am I going wrong? I know I've made some kind of syntax error.
I'm calling a function from two places. I just need to know what i'm doing wrong exactly. I'm crossing over to C++ from VB.NET
void main()
{
event ev = GetCurrentEvent();
int nEventType = GetEventType(ev);
object oOwner = GetEventCreator(ev);
//watch for events
switch ( nEventType )
{
// This event happenes every time the module load. Loading save or new game.
case EVENT_TYPE_MODULE_LOAD:
{
HandleAction_GiveCompanionItems();
break;
}
case EVENT_TYPE_CHAR_RECORD_OPENED:
{
HandleAction_GiveCompanionItems();
break;
}
default:
break;
}
void HandleAction_GiveCompanionItems()
{
}
}
Need help adding a function to a script.
Débuté par
JackFuzz
, janv. 16 2010 03:15
#1
Posté 16 janvier 2010 - 03:15
#2
Posté 16 janvier 2010 - 03:45
So, does it compile without errors? If not, what's the error message?
At first glance it looks ok. The only thing that comes to mind is that maybe you should move your function definition up (before main()), so it's defined before the event handlers call it.
At first glance it looks ok. The only thing that comes to mind is that maybe you should move your function definition up (before main()), so it's defined before the event handlers call it.
#3
Posté 16 janvier 2010 - 04:01
Lady Olivia wrote...
So, does it compile without errors? If not, what's the error message?
At first glance it looks ok. The only thing that comes to mind is that maybe you should move your function definition up (before main()), so it's defined before the event handlers call it.
*smacks forehead*... really?
.... Man I can't believe that worked.... Thanks
Uggh that is so ugly now. I have to always scroll down to see my starting point.. Oh wel.
Modifié par JackFuzz, 16 janvier 2010 - 04:03 .
#4
Posté 16 janvier 2010 - 04:09
It doesn't have to be ugly. Look for examples in, say, utility.h. You can declare the functions in the beginning of the script, and then define them wherever you like.
#5
Posté 16 janvier 2010 - 07:01
oh wait it's not working when I add code.
#include "utility_h"
#include "wrappers_h"
#include "events_h"
#include "plt_my_plot"
#include "plt_gen00pt_party"
void HandleAction_GiveCompanionItems()
{
//=========================================
//Give PC, Leliana, Morrigans Undergarments
//=========================================
//if we haven't given player brapanty
if (WR_GetPlotFlag(PLT_MY_PLOT, GIVE_PLAYER_SWORD) == FALSE)
.....
I get an error on that line... Not sure why? As soon as I put the void Handle over the void Main it caused a problem..
#include "utility_h"
#include "wrappers_h"
#include "events_h"
#include "plt_my_plot"
#include "plt_gen00pt_party"
void HandleAction_GiveCompanionItems()
{
//=========================================
//Give PC, Leliana, Morrigans Undergarments
//=========================================
//if we haven't given player brapanty
if (WR_GetPlotFlag(PLT_MY_PLOT, GIVE_PLAYER_SWORD) == FALSE)
.....
I get an error on that line... Not sure why? As soon as I put the void Handle over the void Main it caused a problem..
Modifié par JackFuzz, 16 janvier 2010 - 07:06 .
#6
Posté 16 janvier 2010 - 07:36
What's the error?





Retour en haut






