Jump to content

Toolset: Script must contain either a main or StartingConditional


Recommended Posts

I have been taking a break from scripts in the Toolset due to frustration (for those he have seen my posts my creating a class struggles). But now that I am looking at it again it is because even unedited Toolset Scripts have errors even before edits?

 

I am talking about the "Script must contain either a main or StartingConditional" error I tried to look up how to fix it but maybe it is just because I don't get script talk but I do not see how to fix these errors if they error out before I even edit them.

 

Example sys_rewards_h even without edits gets the above error message, so does that mean this script cannot be edited? Or what needs to be done so it can. I came across this script when investigating XP Plot rewards not giving the correct amount of XP compared to the Rewards.xml then I saw:

 

 

// reward XP

nXP = FloatToInt(nXP * 0.5); // half of total XP reward
RewardXPParty( nXP, XP_TYPE_PLOT );

 

Nice to finally realize why it didn't match up and gave me an idea but when adjusting values and attempting to compile script I got the error, then I tried with out editing and it still got the error. This is a simple script compared to the ones I actually have been trying to do so I figure this is a easier example to start with and get help on.

 

I know some people have had success with script editing but for those self taught how do I work with this?

Edited by HollownessDevoured
Link to comment
Share on other sites

sys_rewards_h.nss cannot be compiled as it's just a included NSS file that contains some constants and routines to be used by other NSS files.

The error message itself explain it, only NSS files with a main routine or startingconditional routine can be compiled.

Edited by dunde
Link to comment
Share on other sites

sys_rewards_h.nss cannot be compiled as it's just a included NSS file that contains some constants and routines to be used by other NSS files.

The error message itself explain it, only NSS files with a main routine or startingconditional routine can be compiled.

 

Really, because I get the same error on a scripts (example sys_chargen_h) that is required to create a new class, yet people have created new classes... it is in the toolset tutorial.

Link to comment
Share on other sites

Once you've made changes to a "_h" file, just save it (CTRL+S). Ignore the "Compile failed" error report - header scripts are not meant to be compiled; you only need to care about the top message that says "The resource has been saved". Once it's saved, you're done (with that file, that is).

 

For changes to a header script to actually be registered, though, you have to recompile any script that makes use of the section you've just made changes to.

 

For example, I'm modifying a function called Combat_GetAttackResult, which calculates your attack roll based on a number of factors. This function is in the header script combat_h. After I've made my changes, I hit CTRL+S to save combat_h. This Combat_GetAttackResult function is used by a bunch of ability scripts, such as talent_singletarget. So now I need to recompile these scripts for them to register the changes I've just made in combat_h. Without recompiling these scripts, they will keep using the old Combat_GetAttackResult function. So now I open up talent_singletarget and hit Compile (if I'm not making any other changes to this script itself).

Edited by DLuf
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...