Jump to content

checking owning quest name question


Recommended Posts

that works too :)) more than one way to skin a cat... or to get the pointer you need, in this case, it object orientation thingy as a Quest Script is 

This quest as This script, so all you need is "Self" regarding the the sender, Game.getform is over kill,, Your script for example 

 

Quest Property BQ01 Auto
Quest Property BQ02 Auto
Quest Property BQ03 Auto
Quest Property BQ04 Auto
 
Function runmyfunction(form sender)
    If sender == BQ01
 
    Elseif sender == BQ02
 
    Elseif sender == BQ03
 
    Elseif sender == BQ04
 
    Endif
EndFunction

;another script another function 
aboveQuest.runmyfunction(Self)

in this regard, @csbx was 100% correct, only this implementation was questionable, you do not have ask your self who you are as the sender or the receiver 

LOL I used form and sender in imitation SKSE modEvent of the object sending the request 

https://ck.uesp.net/w/index.php?title=Create_-_ModEvent&action=edit&redlink=1

Spoiler
Scriptname ModEvent Hidden

; ModEvent allows sending mod events with any number/type of arguments, unlike the more limited Form.SendModEvent.
;
; Example:
;
;	(Sender)
;
;	 	int handle = ModEvent.Create("MYPREFIX_myCustomEvent")
;		if (handle)
;			ModEvent.PushForm(handle, self)
;			ModEvent.PushForm(handle, someOtherForm)
;			ModEvent.PushInt(handle, 1000)
;			ModEvent.PushString(handle, "It worked!")
;			UIDelegate.Send(handle)
;		endIf
;
;	(Receiver)
;
;		function OnInit()
;			RegisterForModEvent("MYPREFIX_myCustomEvent", "OnMyCustomEvent")
;		endFunction
;	
;		event OnMyCustomEvent(Form sender, Form theForm, int theInt, string theString)
;			; sender == (Sender)
;			; theForm == someOtherForm
;			; theInt == 1000
;			; theString == "It worked!"
;		endEvent

; Creates a new ModEvent and returns the handle.
int Function Create(string eventName) global native

; Sends the ModEvent and releases it.
; Returns true, if it was sent successfully, false if an error happened.
bool Function Send(int handle) global native
	
; Releases the ModEvent without sending it.
Function Release(int handle) global native

; Push single parameter.
;
; For arguments 1 .. N, the signature of the receiving event callback has to look like this:
;
;	event MyCallback(TYPE_1 PARAM_1, ... , TYPE_N PARAM_N)
;
Function PushBool(int handle, bool value) global native
Function PushInt(int handle, int value) global native
Function PushFloat(int handle, float value) global native
Function PushString(int handle, string value) global native
Function PushForm(int handle, Form value) global native

 

@dylbill in your script the Sender is Self compare to Quest properties 

in

@csbx script the Receiver is self as String quest name  to string quest name

two different ways to skin a cat, one more memory, the other is more CPU

the art of writing code is striking a balance, btw, since this is a Skyrim Game,  the  CPU is less save bloat, so I will always be against unnecessary properties and variables, in favour of functions

 

 

 

Link to comment
Share on other sites

JaySerpa kills the vanilla BQ01-BQ04 main (unique) scripts to create a new one that he then uses across the 4 different bounty quests (am I meddling compared to that ?). I can't run parallel because I have to kill the mapmarker.addtomap in addition to the function call. Even pulling the marker back in code ex post facto wouldn't work because I wouldn't know what initially added it.

I would be adding a script that combines his changes and mine as a patch in my mod. Is that not a responsible approach ?

I wasn't able to think through dylbill's solution but that's for me to do.

@petermartyr - I peeked, but I'm just going to be honest and say I've never even heard of that function--skse functions aren't even in the orbit of my thinking so it's not so much a puzzle for me if my box is missing an abundance of pieces.

Your solution looks interesting to me. I'm already requiring skse so should be good. I can say definitively that your code works 100% Brilliant approach that, again, I wasn't even sufficiently educated to dream about. Thanks a lot !

 

Link to comment
Share on other sites

Just commenting...

What bothers me most with overriding existing scripts is that the result is mod-order dependent.  Where I have no choice but to override, I add a check in a safe part of my mod and raise a messagebox to complain that my new script is not in place:

  • Add a csbxModIsEffective() global function, that returns a non zero value, in order to perform the check (in each of your overriding scripts)
  • Use a new script to call this and check the return is not zero, otherwise show the messagebox

Also, rather than delivering your patch script as a separate mod/7zip, consider making a variant of JaySerpa's version that makes his changes conditional on his esp being loaded (with Game.getModByName).

Link to comment
Share on other sites

11 minutes ago, xkkmEl said:

Just commenting...

What bothers me most with overriding existing scripts is that the result is mod-order dependent.  Where I have no choice but to override, I add a check in a safe part of my mod and raise a messagebox to complain that my new script is not in place:

  • Add a csbxModIsEffective() global function, that returns a non zero value, in order to perform the check (in each of your overriding scripts)
  • Use a new script to call this and check the return is not zero, otherwise show the messagebox

Also, rather than delivering your patch script as a separate mod/7zip, consider making a variant of JaySerpa's version that makes his changes conditional on his esp being loaded (with Game.getModByName).

Correct me if I'm wrong here: Headhunter mod places the script in a .bsa. Mine is loose. Order is irrelevant, no ? My loose script will over-ride.

I'm using a fomod that does check to see if HH mod is loaded and only then are my versions of the scripts installed.

re: the check you're suggesting: If my mod is uninstalled, that will uninstall my version of the BQ script. But, yeah, if someone unchecks the esp for my mod but leaves the script dangling there--good point. Is that what you mean ?

 

Link to comment
Share on other sites

1 hour ago, xkkmEl said:

Just commenting...

What bothers me most with overriding existing scripts is that the result is mod-order dependent.  Where I have no choice but to override, I add a check in a safe part of my mod and raise a messagebox to complain that my new script is not in place:

  • Add a csbxModIsEffective() global function, that returns a non zero value, in order to perform the check (in each of your overriding scripts)
  • Use a new script to call this and check the return is not zero, otherwise show the messagebox

Also, rather than delivering your patch script as a separate mod/7zip, consider making a variant of JaySerpa's version that makes his changes conditional on his esp being loaded (with Game.getModByName).

Copy on the global function - I'll work on that. Until then I have:

;BEGIN FRAGMENT Fragment_0 stage10 start
Function Fragment_10()
;BEGIN CODE
;player has recieved quest
Alias_Letter.TryToEnable()
Alias_Player.getRef().AddItem(Alias_Letter.GetReference())
SetObjectiveDisplayed(10)
;=============================================================================================================================
; Below added by mod blahblahblah. Only call functions in the mod if the mod is actually loaded, otherwise exhibit default behavior
;=============================================================================================================================
If Game.GetFormFromFile(0x02002DC8, "blahblahblah.esp") != NONE
	csbmaglocationsquestscript myscript = (game.getformfromfile(0x02027A2F, "blahblahblah.esp") as quest) as csbmaglocationsquestscript

	If StringUtil.Substring( StringUtil.Split(Self, StringUtil.AsChar(32))[1], 1) == "BQ01"
    		myscript.FindTheAliasMarkerMatch(0)                    ;my function, located in script "csbmaglocationsquestscript" of a quest in my mod
	Elseif StringUtil.Substring( StringUtil.Split(Self, StringUtil.AsChar(32))[1], 1) == "BQ02"
    		myscript.FindTheAliasMarkerMatch(1)
	Elseif StringUtil.Substring( StringUtil.Split(Self, StringUtil.AsChar(32))[1], 1) == "BQ03"       
    		myscript.FindTheAliasMarkerMatch(2)
	Elseif StringUtil.Substring( StringUtil.Split(Self, StringUtil.AsChar(32))[1], 1) == "BQ04"
    		myscript.FindTheAliasMarkerMatch(3)
	Endif
Else
	Alias_MapMarker.GetReference().AddToMap()
Endif
;============================
; End of edit by blahblahblah mod
;============================
;END CODE
EndFunction
;END FRAGMENT

 

Link to comment
Share on other sites

2 hours ago, csbx said:

re: the check you're suggesting: If my mod is uninstalled, that will uninstall my version of the BQ script. But, yeah, if someone unchecks the esp for my mod but leaves the script dangling there--good point. Is that what you mean ?

So many things can happen.  Someone else might be overriding the same scripts for other reasons, now, or in the future...  The user may add the mods in another order...

Most mod authors just do their thing, and too bad for incompatibilities.  Accepted norm, so that's ok.  The downside is the user experience, trying to figure out which mods conflict and then deciding which one to give up on.  You can also argue that it doesn't happen all that often... or that you can't future proof your mod... neither of which is false.

It's a judgment call.  I think the global function makes sense in this context, to help users in adding your mod correctly to their mod order.  Not a necessity, nor a community rule, by any means.

Link to comment
Share on other sites

1 hour ago, xkkmEl said:

So many things can happen.  Someone else might be overriding the same scripts for other reasons, now, or in the future...  The user may add the mods in another order...

Most mod authors just do their thing, and too bad for incompatibilities.  Accepted norm, so that's ok.  The downside is the user experience, trying to figure out which mods conflict and then deciding which one to give up on.  You can also argue that it doesn't happen all that often... or that you can't future proof your mod... neither of which is false.

It's a judgment call.  I think the global function makes sense in this context, to help users in adding your mod correctly to their mod order.  Not a necessity, nor a community rule, by any means.

I've already made 9 patches for the mods that I use (mostly form conflicts--standard) that affect vanilla quests and made a fomod that detects their presence. I'm definitely committed to keeping my wide-ranging mod from being a problem.

The good thing is that similarly to Even Better Quest Objectives--it's wide ranging, covering a lot of vanilla quests, but the instructions are to load low in the load order allowing other mods to overwrite. Like EBQO my mod can be over-written in spots and it's just fine--you just don't get the benefit of my mod for a particular quest. Not a big deal.

Thanks for your input on this. The finalizing process for what is my first mod of substance is more of a headache than I thought it would be (e.g. my first fomod..). I appreciate your influence that illustrates how much due diligence one can do to avoid problems.

Link to comment
Share on other sites

Mod X alters a vanilla script. Now my mod is adding a duped version of that script with my code in it via fomod. Someone deletes mod x but now there is an abomination of a script leftover that may make calls to mod x--which is now gone.

Removing mod x does not remove my fomod patch added script.

I suppose I'm the only one in the thread that this is news to 😄

This is exceedingly rare: 2 cases for my mod. But yeah--I have no idea how to solve that.

 

Link to comment
Share on other sites

@csbx  the Gamer removing mods the conflict with yours and your compatibility patch is 100% on the Gamer tweaking their load order.. you done enough suppling the patch. Try not to worry about things that are beyond your control. You will stress less and be more happy without  unnecessary worrying 

BTW yes I know a fix for you, but at best it will just use message box to inform the Gamer the Mod is missing and the Patch is installed, but it requires CRC  values... which now means OFC a SKSE plugin is require to hash it.. with a maintenance script on player load game  checking the load order... before checking the hash value and comparing to your patch hashes value for files only 

just hand balled it over to them.. it is easier, it is what every mod on the nexus does..

However if the patch is plugin and the mods uses a plugin, this is easier, plus we have already done it above, only the patch PEX file and we are using hashes

this is the logic on player load game

  1. all default values are no mods with patches are installed
  2. On plugin Add store the values and check the patch is stalled,
  3.                 warn if patch is missing ELSE do nothing
  4. On plugin (load order unchanged) still there or missing
  5.               DO NOTHING
  6. on plugin  Remove clears the values check if patch is installed
  7.               warn if patch is there ELSE do nothing
  8. go to step 2 for the next patch you supply
  9.         until Done, then stop 

this will really test your logic and coding .. my advise is to modularize into functions there a lot repeating there 

EDIT forgot you need value OLD and Value New too FYI if value OLD != value NEW a mod being added or remove depending on what the values are??

EDIT #2 alot mods do this, my advise is decompile them (if required) and take look, even compare different strategies different mods take, regarding code here.. YES I am suggesting plagiarizing, but try this study the crap out of their code. commit it to memory,  write your code now without referencing theirs...

EDIT #3 OFC you can use above too check for Soft Masters Tooo  FYI things like SkyUI or SexLab, with it being easier regarding the logic 

EDIT notices a mistake in my logic 😂😁😆😅

  1. all default values are no mods with patches are installed
  2. On plugin (load order unchanged) still there or missing
                  DO NOTHING
  3. On plugin Add store the values and check the patch is stalled,
  4.                 warn if patch is missing ELSE do nothing
  5. ELSE
  6. on plugin  Remove clears the values check if patch is installed
  7.               warn if patch is there ELSE do nothing
  8. go to step 2 for the next patch you supply
  9.         until Done, then stop 

I think that better... maybe)))))

 

 

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

I believe this was made out to be way harder than it should be and 2 people tried to make it rather simple using the same methods that I also would've suggested.

 

 

Edited by Evangela
Link to comment
Share on other sites

  • Recently Browsing   0 members

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