For direct access use https://forums.oldunreal.com
It's been quite a while since oldunreal had an overhaul, but we are moving to another server which require some updates and changes. The biggest change is the migration of our old reliable YaBB forum to phpBB. This system expects you to login with your username and old password known from YaBB.
If you experience any problems there is also the usual "password forgotten" function. Don't forget to clear your browser cache!
If you have any further concerns feel free to contact me: Smirftsch@oldunreal.com

Tips: How do I...

Post Reply
User avatar
[]KAOS[]Casey
OldUnreal Member
Posts: 4497
Joined: Sun Aug 07, 2011 4:22 am
Location: over there

Tips: How do I...

Post by []KAOS[]Casey »

This is a topic about random things that you can do in C++ that are not obvious.



How do I... Iterate over all objects that are relevant to me?

Code: Select all

for( TObjectIterator O; O; ++O )
{
}//Iterate over all UObjects. 
How do I... Convert a "FString" into const TCHAR*? (useful for logging)

Code: Select all

FString F= FString::Printf(TEXT("%s"),TEXT("nedm"));
GLog->LogF(TEXT("%s"),*F);

//the "*" operator on FString converts your FString into a const TCHAR. 

How do I... Convert a  const TCHAR* to FString?

Code: Select all

const TCHAR *Str = TEXT("nedm");
FString F= FString::Printf(TEXT("%s"),Str);
How do I... Load an arbitrary class?

Code: Select all

(UTexture *)StaticLoadObject(UTexture::StaticClass(), NULL,TEXT("Engine.S_Actor"), NULL,LOAD_NoWarn | LOAD_Quiet,NULL);//Load Engine.S_Actor texture.

...More to come.
Last edited by []KAOS[]Casey on Tue Aug 25, 2015 6:40 am, edited 1 time in total.
User avatar
Masterkent
OldUnreal Member
Posts: 1469
Joined: Fri Apr 05, 2013 12:41 pm

Re: Tips: How do I...

Post by Masterkent »

How do I... Convert a  const TCHAR* to FString?

Code: Select all

const TCHAR *Str = TEXT("nedm");
FString F= FString::Printf(TEXT("%s"),Str);
Why not just use FString constructor here?

Code: Select all

FString F = Str;
FString F2(Str);
auto &&F3 = FString(Str);
Pre-227 version does not have such a ctor?
Last edited by Masterkent on Tue Aug 25, 2015 9:29 am, edited 1 time in total.
User avatar
[]KAOS[]Casey
OldUnreal Member
Posts: 4497
Joined: Sun Aug 07, 2011 4:22 am
Location: over there

Re: Tips: How do I...

Post by []KAOS[]Casey »

That works too, but printf is generally more useful (albeit slower)
User avatar
han
Global Moderator
Posts: 686
Joined: Wed Dec 10, 2014 12:38 am

Re: Tips: How do I...

Post by han »

You can also use the LoadObject() template instead of using StaticLoadObject() directly. This equivalent for for the above example would be:

Code: Select all

LoadObject( NULL, TEXT("Engine.S_Actor"), NULL, LOAD_NoWarn | LOAD_Quiet, NULL );
Last edited by han on Thu Oct 22, 2015 7:53 pm, edited 1 time in total.
HX on Mod DB. Revision on Steam. Löffels on Patreon.
User avatar
atrey
OldUnreal Member
Posts: 5
Joined: Wed Nov 07, 2018 12:47 pm

Re: Tips: How do I...

Post by atrey »

Assuming this is a good post to post a couple of "How do I" questions.

1) Is there some "tick()" equivilent function that loops constantly in-game when coding natively?


2) Similar to question 1, but is there a native looping function that is called in-editor to update that environment? Or is that something that happens in the Render.Render class?


Thanks.
User avatar
han
Global Moderator
Posts: 686
Joined: Wed Dec 10, 2014 12:38 am

Re: Tips: How do I...

Post by han »

UEngine::Tick() in it's subclasses used in game/editor.
HX on Mod DB. Revision on Steam. Löffels on Patreon.
User avatar
atrey
OldUnreal Member
Posts: 5
Joined: Wed Nov 07, 2018 12:47 pm

Re: Tips: How do I...

Post by atrey »

UEngine::Tick() in it's subclasses used in game/editor.
Is there a pointer somewhere in AActor, or if not, how would I go about makng one?

Also, is UEngine::Tick() called quicker than UScript's tick?
Post Reply

Return to “C++ Native Mods for UE1”