Listening for events in UnrealScript

Discussions about Coding and Scripting
1337GameDev
Skilled
Posts: 198
Joined: Thu Apr 16, 2020 3:23 pm
Personal rank: GameDev

Re: Listening for events in UnrealScript

Post by 1337GameDev »

sektor2111 wrote: Fri Oct 30, 2020 4:21 am Barbie's is faster, mine is a bit slower, but I prefer to clean data after use, so I won't change code, I need even that variable String as well mainly in all class not only Name variable. String used will be one from now on called in functions and not each function with a new String variable - I adjusted these codes as long as I did a recheck of what I use because of this opportunity - I think mod will use less memory right now... And then, when I see my code running out of glitches I'm not fixing what is not broken.
In my code, I love separation of concerns, and am curious if the String -> Name conversion can be done in a static method?

Right now, I just did it naively and Spawn a special actor with the hack method and then destroy it after from a static method (I expect me to only use this outside of update, or only on init - so I think garbage collection is minimal).

Also, is there a way to make sub namespaces? Or do you only have the package name as your folder name in the ut directory.
User avatar
sektor2111
Godlike
Posts: 6410
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Listening for events in UnrealScript

Post by sektor2111 »

This being UScript I'm using resources in "Sand-box" - inside UT folder and NEVER SPACES.
As far as I recall Higor was using some statics functions in a separate class integrated in Siege mods, I'm not sure if such conversion is used there, but there is a native written in C++ doing this "StringToName" somewhere in XC_Core modules. I did not wanted a builder dependent on XC, I wanted to be full compatible with or without XC and also with U227, and this is what I did on my way - not the best ever code but pretty operational.
User avatar
Barbie
Godlike
Posts: 2802
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Listening for events in UnrealScript

Post by Barbie »

1337GameDev wrote: Fri Oct 30, 2020 5:35 pm I just did it naively and Spawn a special actor with the hack method and then destroy it after from a static method
Spawning an Actor is quite expensive. Why don't you use it as a static version? (That was one of my first questions when I get in contact to UScript: How to use libraries?)
1337GameDev wrote: Fri Oct 30, 2020 5:35 pm Also, is there a way to make sub namespaces? Or do you only have the package name as your folder name in the ut directory.
What do you mean with that? :omfg:
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
1337GameDev
Skilled
Posts: 198
Joined: Thu Apr 16, 2020 3:23 pm
Personal rank: GameDev

Re: Listening for events in UnrealScript

Post by 1337GameDev »

Barbie wrote: Sat Oct 31, 2020 12:03 am
1337GameDev wrote: Fri Oct 30, 2020 5:35 pm I just did it naively and Spawn a special actor with the hack method and then destroy it after from a static method
Spawning an Actor is quite expensive. Why don't you use it as a static version? (That was one of my first questions when I get in contact to UScript: How to use libraries?)
1337GameDev wrote: Fri Oct 30, 2020 5:35 pm Also, is there a way to make sub namespaces? Or do you only have the package name as your folder name in the ut directory.
What do you mean with that? :omfg:
What do you mean by a static version? How do you convert a string to name, statically?
And well if you have a folder (eg: MyMutator) in the ut99 directory, that contains your Classes, Textures, Sounds, etc folders, then the name "MyMutator" is the package/namespace name.
1337GameDev
Skilled
Posts: 198
Joined: Thu Apr 16, 2020 3:23 pm
Personal rank: GameDev

Re: Listening for events in UnrealScript

Post by 1337GameDev »

sektor2111 wrote: Fri Oct 30, 2020 9:48 pm This being UScript I'm using resources in "Sand-box" - inside UT folder and NEVER SPACES.
As far as I recall Higor was using some statics functions in a separate class integrated in Siege mods, I'm not sure if such conversion is used there, but there is a native written in C++ doing this "StringToName" somewhere in XC_Core modules. I did not wanted a builder dependent on XC, I wanted to be full compatible with or without XC and also with U227, and this is what I did on my way - not the best ever code but pretty operational.
I agree on not using XC_Core. I want as little dependencies as possible.
Post Reply