how do i call a console command in a function?

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

FireFox-

New Member
Nov 2, 2005
16
0
0
Hi there,
how do i call the console command Say in a function i tried PlayerOwner().ConsoleCommand("Say") but it doesn't work and i tried to call Say("myvar"); and still doesn't work
i've declared the variable in question as var localized string because it should
contain text and i putted it into the default properties as follow:
defaultproperties

Code:
{
  myvar="sometext"
}

how do i get out from this?

thank you very much
Best Regards FireFox-
 
Last edited by a moderator:

Wormbo

Administrator
Staff member
Jun 4, 2001
5,913
36
48
Germany
www.koehler-homepage.de
The Say console command is an exec function in the PlayerController class. Since you attempoted to use PlayerOwner(), I guess you are coding a GUIComponent class, so try: PlayerOwner().Say("text");
 

FireFox-

New Member
Nov 2, 2005
16
0
0
i'm just tryin' to update the vehicle explosion function that should reside in the MyModGame (this is just an example of course because after i understood how to care with all the component in the function i will write my own function :) and there aren't guicomponent declaration yet unfortunately :(
i tried what you have wrote but didn't work :(
any other suggestion?
shall i write the function code?
thank you very much

Best Regards FireFox-
 
Last edited:

Wormbo

Administrator
Staff member
Jun 4, 2001
5,913
36
48
Germany
www.koehler-homepage.de
UnrealScript is an object-oriented language. You will have to know not only what you want to do (i.e. what objects/functions/variables to use), but also where (i.e. which class/object) you want to do it from.
 

FireFox-

New Member
Nov 2, 2005
16
0
0
yes i know that UnrealScript is a object oriented language i noticed it by browsing the source code of ut2k4 and i noticed that everything is linked by class and or class reference in that way it makes the code to be more extended because if i extend a myown class to gameinfo for example
it means that i can use my own variables + the gameinfo's variable am i right?
 
Last edited: