Jump to content

skse plugin


Recommended Posts

Hi folks,

does anybody have a little knowledge on skse plugins?

 

Im trying to add 3 get functions for papyrus to access to get:

weapon.VatsChance

weapon.SightFOV

Potion.AddictionChance

 

I figured this would be relatively simple for me to handle but I have run into a snag that I suspect is a result of my lack of c++ experience and probably simple to fix

 

My method for tackling this was to essentially copy PapyrusWeapon.cpp & h and PapyrusPotion.cpp & h

merge their code into My.cpp & h

then replace all the functions and registering code with what I need,

copying from skse code and referring to GameObjects.h for the integers & floats I require the functions to get

 

I figured I should get My.cpp 's to compile before building .sln

but VS outputs errors relating to PapyrusFunctionDefBase.ini & PapyrusArgs.h

 

Im using VS2008 as I had errors all over the place in VS2013 I was suspicious this may have had something to do with the update procedure, I read somewhere skse was written in VS2008 so I followed suit

 

I appreciate replies like you would never understand Im so stuck :wallbash:

regards Lee

Link to comment
Share on other sites

Ive tried so many things now but I dont fully understand whats going on,

but keep coming back to these same problems:

 

# papyrusargs.h(195) : error C2825: 'BaseType': must be a class or namespace when followed by '::'

 

# papyrusnativefunctiondef_base.inl(231) : see reference to function template instantiation 'UInt32 GetTypeID<T_Result>(VMClassRegistry *)' being compiled with [ T_Result=UInt8 ]

 

# papyrusnativefunctiondef_base.inl(196) : while compiling class template member function 'void NativeFunction0<T_Base,T_Result>::InitParams(VMClassRegistry *)' with [ T_Base=TESObjectWEAP, T_Result=UInt8 ]
# leessourceplugin.cpp(42) : see reference to class template instantiation 'NativeFunction0<T_Base,T_Result>' being compiled with
[ T_Base=TESObjectWEAP, T_Result=UInt8]
# papyrusargs.h(195) : error C2039: 'kTypeID' : is not a member of '`global namespace''
# papyrusargs.h(195) : error C2275: 'BaseType' : illegal use of this type as an expression
# papyrusargs.h(193) : see declaration of 'BaseType'
# papyrusargs.h(195) : error C2146: syntax error : missing ')' before identifier 'kTypeID'
# papyrusargs.h(195) : error C2059: syntax error : ')'
# papyrusargs.h(197) : error C2825: 'BaseType': must be a class or namespace when followed by '::'
# papyrusargs.h(197) : error C2039: 'kTypeID' : is not a member of '`global namespace''
# papyrusargs.h(197) : error C2275: 'BaseType' : illegal use of this type as an expression
# papyrusargs.h(193) : see declaration of 'BaseType'
# papyrusargs.h(197) : error C2146: syntax error : missing ')' before identifier 'kTypeID'
# papyrusargs.h(197) : error C2059: syntax error : ')'
ANYONE SPOT THE LIKELY SCHOOL BOY ERROR THAT IM HUNG UP ON?
regards
lee
Link to comment
Share on other sites

Ok been at this a while now but its all learning :facepalm:

I have now effectively started over trying to discover where it went wrong through process of elimination,

problem is I dont really know what to eliminate nor how.

 

Going through bookmarked google searches that I saved now I understand a tiny bit more than I did when I first read through I believe that

I may have missed some environment setups, even after going through these I still get errors in VS2013express, maybe see what VS2008express says about the same setup but I suspect it will be the same.

 

1) Open skse.sln in VS

 

2) highlight & delete all projects only leaving skse, example_project & common_VC9

 

3) In Example_Plugin, "add new item" .cpp and a .h

copy & paste, main.cpp, MyPlugin.h, MyPlugin.cpp from https://forums.nexusmods.com/index.php?/topic/863175-can-someone-explain-skse-plugins-to-me/ thread "eventHandler's post #9", exactly into the respective files in example_plugin

 

4) add to example_project, all corresponding files from skse that are marked as "#include" in MyPlugin.h & .cpp & main.cpp (this means both .cpp & .h files need to be added)

 

5) in the solution explorer in VS, right click the skse project, "properties\configuration properties\general\configuration type" change it to

"static library (.lib)" & ensure the same for commonVC9 I think

 

6) right click example_plugin "properties\common properties\referances" if there is no referance to skse, click "add new referance" & select "skse"

 

Im now met with 1 warning & 5 errors:

 

# warning C4996: 'GetVersionExA': was declared deprecated \utilities.cpp 183 1 skse

 

# error C2039: 'min' : is not a member of 'std' \papyrusobjects.cpp 165 1 skse

 

# error C2065: 'min' : undeclared identifier \papyrusobjects.cpp 165 1 skse

 

# IntelliSense: namespace "std" has no member "min" \PapyrusObjects.cpp 165 24 skse

 

# IntelliSense: this operator is not allowed in a constant expression \PapyrusVM.h 537 1 skse

 

# IntelliSense: this operator is not allowed in a constant expression \PapyrusVM.h 646 1 skse

 

I'll keep trying but :wallbash:

regards

lee

Link to comment
Share on other sites

OK a great deal of messing around but I seem to have Common_vc9 & skse projects compiling ok

However, I have also (I think ...) narrowed down my plugin_example project to what causes errors, by first compiling my main.cpp (no problems)

and then compiling my Source.cpp (errors)

I then removed parts until the code compiled and bingo, this is the problematic part:

			registry->RegisterFunction(
			new NativeFunction0 <TESObjectWEAP, UInt8>("GetVatsChance", "Weapon", LeesPluginSource::GetVatsChance, registry));

I can't see what the problem is as those lines are identical in layout to 2 other native functions that compile fine, the only difference being the typedef (UInt8) as you can see

		registry->RegisterFunction(
			new NativeFunction0<AlchemyItem, UInt32>("GetAddictionChance", "Potion", LeesPluginSource::GetAddictionChance, registry));
		registry->RegisterFunction(
			new NativeFunction0 <TESObjectWEAP, UInt8>("GetVatsChance", "Weapon", LeesPluginSource::GetVatsChance, registry));
		registry->RegisterFunction(
			new NativeFunction0 <TESObjectWEAP, float>("GetSightFOV", "Weapon", LeesPluginSource::GetSightFOV, registry));

without the mentioned lines it compiles fine ??

Any ideas?

Edited by badlander00
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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