The Game Modding Community - Since 2001

Logic in Scripts?

A Forum Thread for Team Fortress 2

So I was bored one day and decided to try to figure out a way to have scripts in TF2 have true/false logic in them. After a couple of minutes I came up with this:
alias null ""
alias false null
alias true null
alias returnResult null

alias under "wait 2"
alias over "wait 5"

resultFalse "clear; echo false"
resultTrue "clear; echo true"

alias setToFalse "alias false over; alias true under"
alias setTotrue "alias false under; alias true over"

alias testForFalse "testForTrue; false; alias returnResult resultFalse"
alias testForTrue "true; alias returnResult resultTrue"


Do you think if this concept was taken and expanded it could work? You'd have to setToTrue/False in aliases that you want to be able to test, and it would only work on servers with the wait command enabled. But I feel like I could be on to something. What do you guys think?

EDIT: Forgot to mention that you can customize the resultTrue/False to do as you please.

Posts

  • 2y
    Cyber Moonlight avatar
    Cyber Moonlight username pic Joined 3y ago
    Wandering
    1,922 points Ranked 2674th
    12 medals 4 rare
    • GameBanana’s Christmas Giveaway 2016 Day Eighteen Winner! Medal icon
    • 8-14 Entries! GameBanana’s Christmas Giveaway 2016 Medal icon
    • Returned 1000 times Medal icon
    • 8-14 Entries! GameBanana’s Christmas Giveaway 2017 Medal icon
    • One month a member Medal icon
    • 2016 Survey Participant Medal icon
    Yeah since most of the commands only work for one specific value it couldn't really work in most cases.
    Power core: Online! avatar
    Mantra
    Power core: Online!
  • 2y
    HaivoN avatar
    HaivoN Joined 4y ago
    Offline
    5,115 points Ranked 987th
    12 medals 2 rare
    • Returned 1000 times Medal icon
    • 8-14 Entries! GameBanana’s Christmas Giveaway 2017 Medal icon
    • One month a member Medal icon
    • 6 months a member Medal icon
    • 1 year a member Medal icon
    • Reached 1,000 Points Medal icon
    I personally think creating some basic aliases in your scripts would be much easier than using a boolean system since 'aliased commands' can't take arguments. (and it's pain in ass to make it w/o arguments)

    If I really need to make something that looks like a cvar, I use this:
    // setinfo registers cl_cvar as an actual console command (can be autocompleted, is in commands list, etc)
    alias cvar0 "setinfo cl_cvar 0; alias cl_cvar cvar1; echo Value is 1"
    alias cvar1 "setinfo cl_cvar 1; alias cl_cvar cvar0; echo Value is 0"

    Nothing really new, but may be you didn't know about setinfo.

    By the way, you don't need to include alias null "", you can just use alias true, alias false, it will act the same.

    asd фыв

Embed

Share banner
Image URL:
HTML embed code:
BB embed code:
Markdown embed code:

Author

Sharky! avatar
Sharky! Joined 2y ago
Offline
194 points Ranked 19748th

Sharky!
Sign up to access this!
Sign up to access this!
Sign up to access this!
Sign up to access this!

Category

Share

  • Share on Reddit
  • Share on Twitter
  • Share on Facebook
  • Share on Google+

Stats

  • 490 Views
  • 2 Posts
  • 2y Submitted
  • 2y Modified

Greetings! Mascot

GameBanana is one of the oldest mod sites on the net. Sign up and maximize your browsing experience.

  • Subscribe: Get notified of new submissions like this.
  • Say Thanks: Show your appreciation - send modders points.
  • Post: Give modders your thoughts on their work.
  • Vote: Help your favorite modders win monthly awards.
  • Flag: Alert moderators and warn members of problems with mods.
  • Watch: Get notified when mods are updated.

Sound fun? Sign up now!

Already a Bananite? Login

bcp.crwdcntrl.net tracking pixel