Logic in Scripts?

A Forum Thread for Team Fortress 2

Greetings! 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.
  • Vote: Help Sharky! win the Monthly Awards.
  • Flag: Alert moderators and warn members of a problem with this Thread.
  • Watch: Get notified when this Thread is updated.
Mascot

Stop Lurking!

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

  • 1y
    Cyber Moonlight avatar
    Cyber Moonlight username pic Joined 2y ago
    Wandering
    1,436 points Ranked 3375th
    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!
  • 1y
    HaivoN avatar
    HaivoN Joined 3y ago
    Offline
    4,537 points Ranked 1045th
    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:

Submitter

Sharky! avatar
Sharky! Joined 1y ago
Offline
194 points Ranked 18754th

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
438
Date Added
1y
Date Modified
1y

Share

  • Share on Reddit
  • Share on Twitter
  • Share on Facebook
  • Share on Google+
bcp.crwdcntrl.net tracking pixel