Author Topic: Anyone good at scripting?  (Read 6097 times)

Offline Mr. Gamebito

  • Member
  • *
  • Posts: 47
  • i enjoy ponyhypocrites
Anyone good at scripting?
« on: July 06, 2012, 05:44:51 pm »
I'm wondering three things:

1. Is it possible to make it so that you have to hit two keys in order for a script to start working (ex: Hitting left control and P)?
2. Is it possible to make a script where you can press a button and it switches scripts (ex: Hitting "i" once and saying /3, and hitting "i" again would make me say /1)?
3. How would you stop a looping script (ex: alias "poop" "+taunt; poop")?

If anyone knows how to do any of these, please post an example script below! <3
ain't nobody got time to make one kbi

Offline Exile

  • Full Admin
  • *****
  • Posts: 9
  • Lawnmowers
Re: Anyone good at scripting?
« Reply #1 on: July 06, 2012, 11:32:24 pm »
This shit is all untested so tell me if it works I guess. It's been a while since I've done scripting.

1. I think this will work

bind ctrl +ctrlp;
bind p myaction;
alias +ctrlp "alias myaction action";
alias -ctrlp "alias myaction nullaction";


2. Yeah this is possible. Extracted from one of my scripts to toggle netgraph
alias toggle_net_graph tng1
alias tng0 "net_graph 0; alias toggle_net_graph tng1"
alias tng1 "net_graph 3; alias toggle_net_graph tng0"

3. You can't anymore. You used to be able to do this using "wait" but Valve has disabled it permanantly I think. Even if they didn't, it's disabled on most servers since you can do some really terrible things with it.

Offline Mr. Gamebito

  • Member
  • *
  • Posts: 47
  • i enjoy ponyhypocrites
Re: Anyone good at scripting?
« Reply #2 on: July 07, 2012, 11:57:38 am »
2. Yeah this is possible. Extracted from one of my scripts to toggle netgraph
alias toggle_net_graph tng1
alias tng0 "net_graph 0; alias toggle_net_graph tng1"
alias tng1 "net_graph 3; alias toggle_net_graph tng0"

What does tng1 mean in the first line? >.< Actually, what does it mean in all the other lines (other than naming the alias)? :3
And what would I bind "o" to?
ain't nobody got time to make one kbi

Offline Mr. Gamebito

  • Member
  • *
  • Posts: 47
  • i enjoy ponyhypocrites
Re: Anyone good at scripting?
« Reply #3 on: July 08, 2012, 04:20:40 pm »
Okay. So I made a toggle script after learning about rebinding in scripts.

One for switching between first and third person on the servers:
Quote
alias 3rdon "echo ThirdPerson Enabled; say /3; bind o 1ston"
alias 1ston "echo FirstPerson Enabled; say /1; bind o 3rdon"
bind o 3rdon

And one for going through Buddha, God, and Mortal mode on the trade server:
Quote
alias buddha "echo Buddha On; say /buddha; bind p god"
alias god "echo God On; say /god; bind p mortal"
alias mortal "echo Mortal On; say /mortal; bind p buddha"
bind p buddha
ain't nobody got time to make one kbi