1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. 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.

how do i call a console command in a function?

Discussion in 'Programming' started by FireFox-, Nov 7, 2005.

  1. FireFox-

    FireFox- New Member

    Joined:
    Nov 2, 2005
    Messages:
    16
    Likes Received:
    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: Nov 7, 2005
  2. Wormbo

    Wormbo Administrator Staff Member

    Joined:
    Jun 4, 2001
    Messages:
    5,915
    Likes Received:
    36
    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");
     
  3. FireFox-

    FireFox- New Member

    Joined:
    Nov 2, 2005
    Messages:
    16
    Likes Received:
    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: Nov 7, 2005
  4. Wormbo

    Wormbo Administrator Staff Member

    Joined:
    Jun 4, 2001
    Messages:
    5,915
    Likes Received:
    36
    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.
     
  5. FireFox-

    FireFox- New Member

    Joined:
    Nov 2, 2005
    Messages:
    16
    Likes Received:
    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: Nov 7, 2005

Share This Page