Aller au contenu

Photo

call to function from a stock include not working.


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

#1
kamal_

kamal_
  • Members
  • 5 260 messages
I am trying to call a function from a SoZ stock include, ginc_overland. The include compiles without error, and my script calling it also compiles without error. My script hangs up when calling the SoZ include function, a debug message the line before the function runs, but the debug message after the function does not run. Testing, I inserted a debug message as the first thing that happens in the function itself. This also does not run, so I am wondering what could be causing this behavior?

ginc_overland includes the following includes in it. The ginc functions that are part of SoZ I have copied over (overland_constants, combat and time). All of the gincs copied over compiled without error.
#include "ginc_debug"
#include "ginc_math"
#include "ginc_group"
#include "ginc_cutscene"
#include "ginc_item"
#include "ginc_vars"
#include "ginc_2da"
#include "ginc_overland_constants"
#include "ginc_param_const"
#include "ginc_combat"
#include "ginc_time"

#2
kevL

kevL
  • Members
  • 4 078 messages
what function are you calling, kam_?

And can we see the code that calls it?

#3
kamal_

kamal_
  • Members
  • 5 260 messages
my function, there's more but I get the same behavior with just this, so the problem is definitely here:

// OnClient Enter
#include "ginc_overland"
#include "ginc_overland_constants"
#include "ginc_cutscene"
#include "kinc_trade_kamal"

void main()
{
        SendMessageToPC(GetFirstPC(), "Debug: before pc");
        object oPC = GetFirstEnteringPC();

    if(!IsMarkedAsDone())
    {
    SendMessageToPC(GetFirstPC(), "Debug: before neutral");
        InitializeNeutralEncounter(oPC);
        SendMessageToPC(GetFirstPC(), "Debug: after neutral");

        MarkAsDone();
        }
       
}

InitializeNeutralEncounter is part of ginc_overland. Since I wasn't seeing the "after neutral" message, I added a debug message into the function, but never see it either. InitializeNeutralEncounter() technically takes 2 arguments, the second being the area and that being coded into the function as OBJECT_SELF, but SoZ uses it exactly as shown as part of the OnClient Enter script for the overland maps.

Modifié par kamal_, 23 avril 2013 - 09:56 .


#4
kamal_

kamal_
  • Members
  • 5 260 messages
Really strange: I made a duplicate of the ginc_overland script, and changed my script to use that as the include, and it ran and showed me the debug statements I'd scattered through the stock function..

Think I may have solved this, the function at one point refers to a local variable on the area, which I did not have. Testing now.

Modifié par kamal_, 23 avril 2013 - 11:10 .


#5
kevL

kevL
  • Members
  • 4 078 messages
that's quite the function ... o.O