Jump to content

Help understanding user-created function in script


WarMachineDD7

Recommended Posts

I'm looking at the "JIP Companions Command & Control" mod and the script has zero comments, so it's kind of annoying to figure out how it's working. Anyway, there's a few custom functions that I don't quite know where they're coming from or what they are doing (besides the hint in their name). All I know is that they don't use the Call command, so they're not regular User-Defined Functions.

 

In the next code snippet, there's a function called "CCCSetFloat", but I have no idea where that function was defined or what it exactly is (it's not part of any script extender either):

scn	JIPCCCMainScript

[a bunch of instance variables are here]

begin MenuMode

	if iJIPCCCStartup == -1
		set iJIPCCCStartup to 0
		SetStage JIPCCCMain 0
	endif

	if bJIPCCCActivated
		SetStage JIPCCCMain 1
	elseif bRecruitPressed
		set bRecruitPressed to 0
		SetNumericGameSetting fAutoAimMaxDistance fJIPCCCAAMDDefault
		CCCSetFloat 111 0 ;<--- This line here. I don't know where this function came from, it seem user-defined with the CCC prefix, but it's not a regular UDF because I can't find a script defining it, and it doesn't use the Call command either.
		if rForced
			rForced.SMS JIPCCCForceRecruitFX
		endif
	endif

	if bCompBarVisible
		set bCompBarVisible to 0
		CCCSetFloat 9 0
		SetStage JIPCCCMain 2
	endif

end
Link to comment
Share on other sites

Doing a google search for CCCSetFloat I found someone's NVSElog that has this in it:

 

checking plugin C:\Program Files (x86)\Steam\steamapps\common\Fallout New Vegas\Data\NVSE\Plugins\\ccc_plugin.dll
SetOpcodeBase 00002400
RegisterCommand CCCVersion (2400)
RegisterCommand CCCAvatarExists (2401)
RegisterCommand CCCGetCreatureDamage (2402)
RegisterCommand CCCGetCreatureReach (2403)
RegisterCommand CCCItemPlayable (2404)
RegisterCommand CCCSetVariable (2405)
RegisterCommand CCCSetAction (2406)
RegisterCommand CCCSetFloat (2407)

 

So, it would appear to be a command added by ccc_plugin.dll, what ever that is. It isn't in the main file of JIP Companions Command and Control.

 

Found it in my nvselog! It's in the JIP NVSE plugin now. Apparently they never updated the documentation for us.

Edited by GamerRick
Link to comment
Share on other sites

Yup, I just looked at the JIP LN NVSE source code and look what I found:

REG_CMD(CCCOnLoad)
REG_CMD(CCCSetFloat)
REG_CMD(CCCSetString)
REG_CMD(CCCSetTrait)
REG_CMD(CCCGetDistance)
REG_CMD(CCCTaskPackageFlags)
REG_CMD(CCCSetEquipped)
REG_CMD(CCCInFaction)
REG_CMD(CCCSetNCCS)
REG_CMD(GetEncumbranceRate)
REG_CMD(CCCLoadNCCS)
REG_CMD(CCCSavedForm)
REG_CMD_STR(CCCLocationName)
REG_CMD(CCCGetReputation)

Apparently we got some functions that they forgot to add to the wiki and they've been there since version 15. Wow. Thanks for the help.

 

As for what they do exactly, I'm gonna have to read them carefully and follow through, cause there's zero comments in the JIP LN source code (why?).

Link to comment
Share on other sites

Why zero comments?

 

"Because leet programmers don't need comments. It's obvious from the code."

 

In my experience "programmers" hate to write documentation (which includes "comments"), in part because things are usually "in flux" so they intend to document when the project is finished. But long before then the next project has already come along so they never get around to that boring stuff. "That's what tech writers are for."

 

-Dubious-

Link to comment
Share on other sites

Alright, I did that and I just got an answer. I'm posting jazzisparis' exact words:

 

 

Functions included JIP LN that aren't documented in the wiki were not documented for a reason. Most of them are ad-hoc functions that were tailored for, and are intended to be used exclusively by a certain mod (JIP CC&C, for example). It is my wish that they remain undocumented.

 

So yeah, those functions aren't safe to use as they might be incomplete and will probably have bugs for cases that aren't handled.

 

Assuming I convince jazzisparis to post them, do you guys think it's worth mentioning them in the wiki with the caveat that you shouldn't use them? Or do you think this forum post is enough for anyone else that might find them like I did?

Edited by WarMachineDD7
Link to comment
Share on other sites

  • Recently Browsing   0 members

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