dullman Posted January 24, 2024 Posted January 24, 2024 Hello I have a problem with this fragment: ;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment ;NEXT FRAGMENT INDEX 2 Scriptname TIF__0100535F Extends TopicInfo Hidden ;BEGIN FRAGMENT Fragment_1 Function Fragment_1(ObjectReference akSpeakerRef) Actor akSpeaker = akSpeakerRef as Actor ;BEGIN CODE Debug.Notification(akSpeaker as Actor) ;END CODE EndFunction ;END FRAGMENT ;BEGIN FRAGMENT Fragment_0 Function Fragment_0(ObjectReference akSpeakerRef) Actor akSpeaker = akSpeakerRef as Actor ;BEGIN CODE DullMods_DairyCowEconomy_MainScript main = (GetOwningQuest() as DullMods_DairyCowEconomy_MainScript) Debug.Notification(akSpeaker.GetFormID() + " : " + akSpeakerRef.GetFormID()) main.initializeAsCustomer(main.initializeAsCustomerHandler, akSpeaker) ;END CODE EndFunction ;END FRAGMENT ;END FRAGMENT CODE - Do not edit anything between this and the begin comment as I write in title it shows some random script associated with actor (as I suspect) e.g. [01/24/2024 - 11:17:59AM] init as customer: [RentRoomScript < (00013486)>] I don't get what can be here wrong but maybe something with adresses in skse but even though I updated skyrim to 1170 whilst creation kit has the latest one (probably 1130) and had only compatible mods, I mean what the problem might be here?
traison Posted January 24, 2024 Posted January 24, 2024 (edited) The issue is most likely in main.initializeAsCustomer. For instance, if the declaration of that function is (string, RentRoomScript) and RentRoomScript inherits from ObjectReference then I wouldn't be surprised if Debug.Log(akSpeaker) would print the reference as if it was of type "RentRoomScript" as that is literally what it would be. Edit: Implicit casting, if you want to look it up. Edited January 24, 2024 by traison
dullman Posted January 24, 2024 Author Posted January 24, 2024 (edited) 5 minutes ago, traison said: The issue is most likely in main.initializeAsCustomer. For instance, if the declaration of that function is (string, RentRoomScript) and RentRoomScript inherits from ObjectReference then I wouldn't be surprised if Debug.Log(akSpeaker) would print the reference as if it was of type "RentRoomScript" as that is literally what it would be. No it's rather not this since basically on the same actors once I get rentRoom script other times I got another script (probably after talk to another actor) I currently reinstalling entire skyrim since it seems that even base version doe not work for me (stuck on the beginning without moving toward execution grounds) so maybe it would help something (the funniest thing that I had a fresh install just before new patch came) ps. and rentRoomScript my script does know nothing about it so in no place I used this type Edited January 24, 2024 by dullman
traison Posted January 24, 2024 Posted January 24, 2024 Hard to tell without seeing the line that actually prints "init as customer:" and the code that leads up to it, at least the parts that affect akSpeaker as it was passed to initializeAsCustomer.
dullman Posted January 24, 2024 Author Posted January 24, 2024 7 minutes ago, traison said: Hard to tell without seeing the line that actually prints "init as customer:" and the code that leads up to it, at least the parts that affect akSpeaker as it was passed to initializeAsCustomer. so the code is simple just print the value into console ; Handler for initializing actor as customer String Property initializeAsCustomerHandler = "initializeAsCustomer" Auto Int Function initializeAsCustomer(String calledFunction, Actor actorRef) Debug.Notification("init as customer: " + actorRef + actorRef.GetName()) Debug.Trace("init as customer: " + actorRef + actorRef.GetName()) Form[] currentActors = getCustomerActors(getCustomerActorsHandler, emptyFloatParameters, emptyIntParameters, emptyStringParameters, emptyFormParameters) Form[] newActors = PapyrusUtil.ResizeFormArray(currentActors, currentActors.Length + 1, actorRef) InitializeActorVariables(actorRef) Debug.Notification(actorRef) return setCustomerActors(setCustomerActorsHandler, newActors, emptyFloatParameters, emptyIntParameters, emptyStringParameters, emptyFormParameters).Length - 1 EndFunction maybe the problem is that reference somewhere is being overwritten but don't believe in it since it should be done after debug
traison Posted January 24, 2024 Posted January 24, 2024 (edited) As far as I know, GetName() does not work on an Actor type. You need to call it on the ActorBase. I made a function for this in one of my utility scripts: string Function GetName(Actor who) Global {Returns the human-readable name of an actor.} If (who == None) Return "?" EndIf ActorBase base = who.GetLeveledActorBase() Return base.GetName() EndFunction Edit: Or, I mean it clearly technically works, but it may not return what you think it will. Edited January 24, 2024 by traison
dullman Posted January 24, 2024 Author Posted January 24, 2024 1 hour ago, traison said: As far as I know, GetName() does not work on an Actor type. You need to call it on the ActorBase. I made a function for this in one of my utility scripts: string Function GetName(Actor who) Global {Returns the human-readable name of an actor.} If (who == None) Return "?" EndIf ActorBase base = who.GetLeveledActorBase() Return base.GetName() EndFunction Edit: Or, I mean it clearly technically works, but it may not return what you think it will. Thanks I still don't know what id (name, FormId etc.) should use to identify unique actors (as for formId it also probably would be working for generic ones) But currently I'm fighting with trying to get a proper ref to akSpeaker (I removed all scripts that I wrote and still gets some kind of script here) so may I ask some helpful person who has 1170 version to test it if it working for them on empty fresh mod?
traison Posted January 24, 2024 Posted January 24, 2024 22 minutes ago, dullman said: Thanks I still don't know what id (name, FormId etc.) should use to identify unique actors Uniques are no different from non-uniques when it comes to references. The Actor type inherits ObjectReference. It only looks different in-game, but that's irrelevant in Papyrus.
dullman Posted January 24, 2024 Author Posted January 24, 2024 1 hour ago, dullman said: Thanks I still don't know what id (name, FormId etc.) should use to identify unique actors (as for formId it also probably would be working for generic ones) But currently I'm fighting with trying to get a proper ref to akSpeaker (I removed all scripts that I wrote and still gets some kind of script here) so may I ask some helpful person who has 1170 version to test it if it working for them on empty fresh mod? So more info on this topic I thought that I would just fill references to test actors in editor as Actor ref and still got a script so it's probably fault of editor and skse working on different version? (although it shouldn't be but I'm only new here)
traison Posted January 24, 2024 Posted January 24, 2024 (edited) Did you test my GetName script? Fairly certain it doesn't matter what type is printed, as long as it at some point inherits Actor, my GetName will work. If you absolutely must have a variable of type Actor, then just cast it: Actor who = akSpeaker As Actor Edited January 24, 2024 by traison
dullman Posted January 24, 2024 Author Posted January 24, 2024 56 minutes ago, traison said: Did you test my GetName script? Fairly certain it doesn't matter what type is printed, as long as it at some point inherits Actor, my GetName will work. If you absolutely must have a variable of type Actor, then just cast it: Actor who = akSpeaker As Actor No I didn't specifically tested it on your getName script I e.g. tested it on getDisplayName() as well the type it logs is already casted to Actor (and on several steps) so that's why I think it will be resolved with new release of CK for skyrim (anyone knew where I can hear news about it?)/ For time being I create the next plugin from the series of dairy cow plugins to time being I have a three planned plugins Dairy Cow, Dairy Cow Economy and (name still being decided and not sure if it's doable) Dairy Cow Magicka
Fotogen Posted January 24, 2024 Posted January 24, 2024 7 hours ago, dullman said: as I write in title it shows some random script associated with actor (as I suspect) e.g. [01/24/2024 - 11:17:59AM] init as customer: [RentRoomScript < (00013486)>] Thats normal. Its how skyrim always worked. Not a bug or glitch. Converting actor(objectreference) into string and printing it out has no real meaning. By the way, that "RentRoomScript" just means that actor has RentRoomScript attached to it. It can also have many other scripts attached. Or none. Conversion to string will just spit out something. Its pointless to think about it much. 7 hours ago, dullman said: I don't get what can be here wrong but maybe something with adresses in skse but even though I updated s Nothing is wrong there.
dullman Posted January 24, 2024 Author Posted January 24, 2024 2 hours ago, Fotogen said: Thats normal. Its how skyrim always worked. Not a bug or glitch. Converting actor(objectreference) into string and printing it out has no real meaning. By the way, that "RentRoomScript" just means that actor has RentRoomScript attached to it. It can also have many other scripts attached. Or none. Conversion to string will just spit out something. Yeah I needed that confirmation that it's normal so I just rechecked my code for nth time and there where several instance where i wrongly assigned variables I mean I was expecting some more info from papyrus logs but thanks for info and responses by both of Fotogen and traison
dullman Posted January 25, 2024 Author Posted January 25, 2024 9 hours ago, dullman said: Yeah I needed that confirmation that it's normal so I just rechecked my code for nth time and there where several instance where i wrongly assigned variables I mean I was expecting some more info from papyrus logs but thanks for info and responses by both of Fotogen and traison I got the hardest bug/problem with my code spend entire time trying to figure what wrong and got unexpected results I mean can someone tell me why code Int index3 = intParameters.Length + 3 intParamsForCalculation[index3] = totalSupply.Length is not equal to intParamsForCalculation[intParameters.Length + 3] = totalSupply.Length I mean I got it after struggling that papyrus should resolve only the first variable in accessing to array but I'm not sure why it happening since this behavior was something unexpected for me
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now