Logic in Scripts?

A Forum Thread for Team Fortress 2

Attention Gamer! We are one of the oldest mod sites on the Interwebs. Sign up and maximize your browsing experience.

  • Subscribe: Get notified of new submissions like this.
  • Say Thanks: Show your appreciation by sending Sharky! points.
  • Post: Give Sharky! your thoughts on this Thread.
  • Flag: Alert moderators and warn members of a problem with this Thread.
  • Watch: Get notified when this Thread is updated.
Mascot

Sound fun?

Sign up

Already a Bananite? Login

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

  • 10mo
    Midnight Lycanroc avatar
    Midnight Lycanroc avatar Wandering
    Member Joined 2y
    1,146 points Ranked 4136th
    10 medals 3 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
    • One month a member Medal icon
    • 2016 Survey Participant Medal icon
    • 6 months a member Medal icon
    Yeah since most of the commands only work for one specific value it couldn't really work in most cases.
    Embrace the night
  • 10mo
    HaivoN avatar
    HaivoN Offline
    Member Joined 3y
    4,074 points Ranked 1136th
    11 medals 1 rare
    • Returned 1000 times 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
    • Gamefiler of the Month, January 2016 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 фыв

Share

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

More embeddable images

Bookmark and Share

Submitter

Sharky! avatar
Sharky! Offline
Member Joined 1y
194 points Ranked 18351st

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

Category

Stats

Posts
2
Views
403
Date Added
10mo
Date Modified
10mo
bcp.crwdcntrl.net tracking pixel