Here’s what I spotted in your Papyrus scripts when matched up against your C++ registration (in PapyrusInterface.cpp/h) and overall design:
1. Script-name & type mismatches
-
Formula script internal name is
Scriptname PrintScreen_Formula_Script extends Questand your C++ does
const char* scriptName = "PrintScreen_Formula_Script"; vm->RegisterFunction("TakePhoto", scriptName, TakePhoto); vm->RegisterFunction("Get_Result", scriptName, Get_Result); vm->RegisterFunction("Cancel", scriptName, Cancel); vm->RegisterFunction("CheckPath", scriptName, CheckPath); -
But in Printscreen_MainQuest_script.psc you declare your property with a different casing:
Printscreen_Formula_script Property Formula autoThat type name (
Printscreen_Formula_script) does not exactly match"PrintScreen_Formula_Script". Papyrus is case- and underscore-sensitive here—so yourFormulaproperty will never bind to the native functions.
2. Property vs. type vs. variable confusion
-
You’ve named an int property
TakePhoto(to hold your keycode) in the MainQuest script:int Property TakePhoto autoand you’re trying to call your native function of the same name. That shadowing will confuse the VM and your own code.
-
Likewise, you declared
String Property Result autothen later do
Result = Formula.Get_Result()(which is fine) but be sure you’re not accidentally setting the wrong
Result(local vs. property).
3. Native-call syntax errors
-
Because you named your script-instance property
Formula, all your native calls should be in the formFormula.TakePhoto(Path, ImageType, Jpg_Compression, Mode, GIF_MultiFrame_Duration) Formula.Get_Result() Formula.Cancel() Formula.CheckPath(Path) -
Instead, your code still says:
String startResult = Printscreen_Formula_script.TakePhoto(…) bResult = Printscreen_Formula_script.CheckPath(TestPath) Result = Printscreen_Formula_script.Get_Result()You need to replace every
Printscreen_Formula_script.withFormula.(and after you correct the property’s type name).
4. Event handlers vs. polling model
-
Your C++ polling implementation never fires a ModEvent
"PrintScreenComplete"—it simply sets a flag thatGet_Result()reads . -
Yet in MainQuest you still have:
Event OnPrintScreenComplete(String eventName, String result, Float numArg, Form sender) … EndEventThat will never run. Either remove/repurpose it, or switch back to an event-based callback in your C++ thread (
SendModEvent) instead of polling.
5. Quick fixes
-
Align your Formula property type with your scriptName. At the top of Printscreen_MainQuest_script.psc, change:
- Printscreen_Formula_script Property Formula auto + PrintScreen_Formula_Script Property Formula auto -
Rename your key-binding property to avoid colliding with your native function name:
- int Property TakePhoto auto + int Property Key_TakePhoto autoThen register for that key and call
Formula.TakePhoto(...)inside your key event. -
Fix all native calls to use your
Formulaproperty:; Before String r = Printscreen_Formula_script.TakePhoto(…) ; After String r = Formula.TakePhoto(…) -
Clean up unused events or reintroduce a ModEvent emitter in your C++ worker if you want event-driven completion.
Once you’ve made those changes, your Papyrus and C++ sides should line up perfectly. Let me know if anything still feels out of sync!