Difference between revisions of "Scripting/nl"
m (Auto: Regex({'\\b, en\\b': ' en'},) (Review RC#3271423)) |
m |
||
Line 226: | Line 226: | ||
| MOUSE5 | | MOUSE5 | ||
|} | |} | ||
− | |||
− | |||
==Useful commands== | ==Useful commands== |
Latest revision as of 11:06, 1 June 2023
![]() | Deze vertaling heeft een update nodig. Je kan helpen deze pagina te verbeteren door door hem te bewerken met inhoud van Scripting (bron bekijken). Zie ook Help:Language translation. |
Scripting is het gebruik van configuratiebestanden (.cfg) om nieuwe keybinds en aliassen automatiseren van complexe gedragingen en console commando sequenties te creëren. Scripting is ingebouwd in Team Fortress 2 en wordt niet verboden door VAC (Valve Anti Cheat). Gebruik van scripting variëren van gewoon een toets om een commando naar zichzelf verwijst loops en geneste aliassen die elkaar herdefiniëren binden. Enige functionaliteit die kan worden gemaakt met scripting kan ook worden bereikt zonder evenwel scripting zal deze functionaliteiten ook worden gebruikt in de snelle battle.
Inhoud
Scripting Bestanden
Team Fortress 2 leest automatisch meerdere game-bestanden en alle scripts uitvoert in hen. Hier is de lijst van deze bestanden:
- config.cfg - Dit is het standaard configuratie bestand dat is bewerkt dat alle in-game instellingen verandert in keybinds-of video-instellingen weer te geven. Het is veilig om dit bestand te bewerken, maar het zal veranderen in een gewijzigde keybinds bij het opstarten weer te geven. Deze config zal iedere keer het spel opstart draaien, vóór alle andere config.
- config_default.cfg - Dit bevat een basisset van keybinds en zal worden uitgevoerd als een back-up als config.cfg niet aanwezig.
- autoexec.cfg - Dit is het standaard configuratiebestand voor het uitvoeren van aangepaste keybinds en aliassen. Deze config zal iedere keer het spel opstart draaien, na config.cfg.
- scout.cfg, soldier.cfg, pyro.cfg, etc. - Elke klasse heeft een config file die automatisch wordt uitgevoerd wanneer je naar die klasse veranderd. Merk je op dat alle instellingen die in een klassen config bestand wordt bewaard bij het overschakelen klassen tenzij uitdrukkelijk herbonden.
Scripting-bestanden bewerken
Op Windows, kunnen scripting bestanden zijn te vinden in:
<Steam map> / SteamApps / common / team fortress 2/tf/cfg
Op een Mac, kan scripting bestanden zijn te vinden in:
~ / Library / Application Support / stoom / SteamApps / common / team fortress 2/tf/cfg
Sinds de SteamPipe update code kan ook worden geplaatst in
... / SteamApps / common / team fortress 2/tf/custom/yourfoldernamehere/cfg
Scripting Opdrachten
Het volgende is een lijst van opdrachten die geen gebruik hebben afgezien van scripting; ze beinvloeden de0 gameplay niet direct.
Bind
Het eenvoudigste command is het bind command. Het zal een aantal belangrijke leiden tot een bepaalde actie uit te voeren, of dat actie is een instelling, een opdracht of een script.
bind [TOETS] [COMMAND]
<br /
Citaten kunnen optioneel worden geplaatst rond de toets of de opdracht.
bind [TOETS] "[COMMAND 1]; [COMMAND 2]; [COMMAND 3]"
Citaten kan optioneel worden geplaatst rond de toets, maar aanwezig zijn in het command.
Commands come in two forms:
bind "e" "Voicemenu 0 0"
Deze bind zal ervoor zorgen dat de speler om een Medic roept als hij op E drukt.
bind "w" "+forward"
Deze bind zal ervoor zorgen dat de speler vooruit gaan terwijl ze de W hebben ingedrukt.
Schakelen
Met dit command kan een instelling gemaakt worden om tussen twee of meer waarden te schakelen.
toggle "sv_cheats 0 1"
Bind Schakelen
Dit werkt identiek te schakelen, maar bindt aan een toets.
bindtoggle o "sv_cheats 0 1"
Incrementvar
Dit zorgt voor variabelen worden verhoogd of verlaagd door herhaaldelijk een vast bedrag.
bind MWHEELUP "incrementvar fov_desired 75 90 1"
bind MWHEELDOWN "incrementvar fov_desired 75 90 -1"
Dit zal ertoe leiden om het gezichtsveld te verhogen tijdens het schuiven op en af te nemen bij het naar beneden scrollen.
Opmerking: Incrementvar zal de waarde omlopen als het te groot of te klein. In dit voorbeeld, wanneer het gezichtsveld klappen 90, zal dalen tot 75 en vice-versa.
Alias
Een alias kunnen naar meerdere commands worden verwezen door een enkel commando. Dit is effectief steno en is vooral nuttig als een reeks opdrachten moet meerdere malen worden genoemd.
Opmerking: Alias mogen geen spaties bevatten. Zij kunnen underscores(_), getallen en symbolen bevatten. Alias namen zijn hoofdlettergevoelig.
alias Call_For_Medic "Voicemenu 0 0"
bind "e" "Call_For_Medic"
Dit script werkt hetzelfde met een eenvoudige bind, wat betekent dat wanneer de speler drukt op E, zullen ze vragen om een Medic
.
Exec
Dit command zal een bestand uit te voeren. Dit brengt complexe scripts kunnen worden opgeslagen in andere bestanden, om niet overzichtelijk meer algemene bestanden.
exec autoexec.cfg
Dit script zal een autoexec script van de speler uit voeren.
Echo
Dit command zorgt ervoor dat de tekst moet worden afgedrukt naar de console. Dit is erg handig voor debugging.
echo Scripting is; echo Zeer nuttig
.
Zegt ZAL uitprinten Scripting isZeer nuttig.
Spaties zijn Actie Alleen ontleed ALS ZE Tussen de woorden, van ALS de echo tekst between aanhalingstekens,zoals in het volgende voorbeeld.
echo "Scripting is zeer nuttig."
De extra ruimte zal worden afgedrukt, omdat de straf wordt aangegeven met aanhalingstekens.
Opmerking: Het is niet mogelijk om af te drukken uit de 'of, karakters en hun betekenis wordt verkeerd geïnterpreteerd.
Wacht
Dit command
Opmerking:. De hoeveelheid real-time komt dit overeen met afhankelijk tickrate de server
'Waarschuwing: Wacht commands zijn uitgeschakeld op bepaalde servers. Dit zal ertoe leiden dat bepaalde scripts te mislukken en kan (in semi-zeldzame gevallen) ervoor zorgen dat het spel crasht. '
echo Waarom stak de kip de weg over;? wacht 66;! echo Om aan de overkant te komen "
Dit script zal 66 frames (1 seconde op de meeste servers) wachten voordat het afdrukken van de punchline.
Lijst van de belangrijkste toets namen
Hover over a key to see its scripting name.
ESC F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 ` 1 2 3 4 5 6 7 8 9 0 - = Delete Tab ⇆ Q W E R T Y U I O P [ ] \ ⇪ Caps A S D F G H J K L ; ' ↵ ⇧ Shift Z X C V B N M , . / ⇧ Shift Ctrl ⊞ Alt Spacebar ⊞ ≣ Menu Ctrl |
PrtScn ScrLk Pause Insert Home PgUp Delete End PgDn
← ↓ → |
|
Mouse Button | Name of Keybind |
---|---|
Scroll Up | MWHEELUP |
Scroll Down | MWHEELDOWN |
Left Click | MOUSE1 |
Right Click | MOUSE2 |
Wheel Click | MOUSE3 |
Left Button Click (forward) | MOUSE4 |
Right Button Click (back) | MOUSE5 |
Useful commands
Disguising
The disguise
command takes two arguments, the first being the class and the second being the team.
- Class
- 1. Scout
- 2. Sniper
- 3. Soldier
- 4. Demoman
- 5. Medic
- 6. Heavy
- 7. Pyro
- 8. Spy
- 9. Engineer
- Team
- 1. BLU team
- 2. RED team
- -1. Opposite team
- -2. Same team
Thus, disguise 5 1
would disguise as a BLU Medic and disguise 7 -2
would disguise as a friendly Pyro.
Note: disguise 8 -2
(Friendly Spy) will cause the player to un-disguise.
Buildings
The build
command takes two arguments, the first being the building and the second being the building type.
build 0 0
will build a Dispenser (Engineer only)
build 1 0
will build a teleporter entrance (Engineer only)
build 1 1
will build a teleporter exit (Engineer only)
build 2 0
will build a Sentry Gun (Engineer only)
build 3 0
will build a Sapper (Spy only)
Similarly, the destroy
command will destroy buildings.
destroy 0 0
will destroy a Dispenser (Engineer only)
destroy 1 0
will destroy a teleporter entrance (Engineer only)
destroy 1 1
will destroy a teleporter exit (Engineer only)
destroy 2 0
will destroy a Sentry Gun (Engineer only)
Note: Sappers cannot be destroyed.
Voice Menu
The voicemenu
command takes two arguments, the menu number and the command number.
- 0 (
voice_menu_1
)- 0: MEDIC!
- 1: Thanks!
- 2: Go! Go! Go!
- 3: Move Up!
- 4: Go Left
- 5: Go Right
- 6: Yes
- 7: No
- 1 (
voice_menu_2
)- 0: Incoming
- 1: Spy!
- 2: Sentry Ahead!
- 3: Teleporter Here
- 4: Dispenser Here
- 5: Sentry Here
- 6: Activate Charge!
- 7: MEDIC: ÜberCharge Ready
- 2 (
voice_menu_3
)- 0: Help!
- 1: Battle Cry
- 2: Cheers
- 3: Jeers
- 4: Positive
- 5: Negative
- 6: Nice Shot
- 7: Good Job
Note: These numbers are one less than as they appear in-game.
Assorted
clear
will clear the console of any information.fov_desired (75-90)
will set your field of view.lastdisguise
will cause the player to re-disguise as their last disguise. (Spy only)load_itempreset [0, 1, 2, 3]
will load a particular loadout preset [A, B, C, D].say "message"
will say a message to public chat.say_team "message"
will say a message to your team.+taunt
will cause the player to taunt.+use_action_slot_item
will cause the player to use their action slot item.volume (0-1)
will change the in-game volume.
Advanced Scripting Techniques
Toggles
It is possible to bind a key to toggle a command which would otherwise be a press and hold command.
bind w toggle
alias toggle "enable"
alias enable "alias toggle disable; +forward"
alias disable "alias toggle enable; -forward"
This script will cause a press of W to keep the player moving forward until W is pressed again.
Key combinations
It is possible to create a script where pressing one button while another is held down will change the action of the first button.
bind e call
alias call Call_For_Medic
alias Call_For_Medic "Voicemenu 0 0"
alias Call_For_Ubercharge "Voicemenu 1 6"
At this point, the script will mean that every time E is pressed, the player will call for a Medic. It also has an unused alias to call for an Ubercharge.
bind shift +toggleState
alias +toggleState "alias call Call_For_Ubercharge"
alias -toggleState "alias call Call_For_Medic
Now, pressing ⇧ Shift will redirect call
to ask for an ubercharge. Releasing ⇧ Shift will make call
point back at a Medic call.
When ⇧ Shift+E is pressed, the player will call for an Ubercharge, rather than for a Medic.
Wait-testing
Since the wait
command is integral to some scripts, it may be necessary to test to see if a server has disabled the command.
alias waitTester "alias waitTest waitPositive; wait; waitTest"
alias wait "alias waitTest waitNegative"
alias waitPositive "echo Wait is enabled on this server.; exec waitPositive.cfg"
alias waitNegative "echo Wait is DISABLED on this server!; exec waitNegative.cfg"
waitTester
This script relies on the fact that if the wait command is disabled on a server, the alias named wait
can be defined by the user. Thus, the script creates an alias named waitTest
which by default points to waitPositive
, but if wait
is not allowed (and can thus be defined by the user), will be redirected to waitNegative
.
Loops
Warning: Loops which run without a wait command will cause the TF2 client to hang. It is highly suggested to run a script only after a wait testing script.
It is generally considered bad form to have one alias point to itself, as this loop cannot be broken out of and the reset. Therefore, looping scripts tend to include two parts to the loop: The part that waits, and the part that loops.
alias loop "+taunt; wait 132; redirect"
alias redirect loop
bind g "redirect"
bind o "alias redirect break"
alias break "alias redirect loop"
This script will start looping once G is pressed. It will then taunt every 132 frames (2 seconds on most servers). Pressing O would cause the next iteration of the loop to break out. The break
alias will then reset the loop, so that next time it is called it will loop again.
Noteworthy scripts
There are several notable scripts that have affected gameplay. Some of these are patched out, while others remain functional.
Patched scripts
Pistol scripts
Originally, the Pistol could be fired almost as fast as the human hand could press a key. Scripts were created to simulate this rapid pressing by holding down a single key.
13 augustus 2009-patch: The Pistol now fires at a fixed rate, not based on the speed at which you press the firing button.
Chargin' Targe turn scripts
Originally, the keyboard commands to turn your viewpoint left and right were not treated the same as the mouse commands. The Chargin' Targe was the first weapon to create a restriction on how quickly you could turn your viewpoint, therefore Valve put a limit on mouse turn-speed, yet forgot to apply the same restriction to the keyboard command that resulted in the same action. Scripts were created to rebind the turning controls when a player charged, circumventing this restriction.
23 juni 2011-patch: Fixed an exploit with the Chargin' Targe that allowed greater turning control than intended.
However, there is still no cap on turn speed when using a gamepad's analog sticks.
Air crouching scripts
Originally, you could crouch as many times as you liked in a single jump. By binding a script to crouch and uncrouch as rapidly as possible, you could exploit the engine and make it difficult to properly register shots on jumping targets.
6 maart 2009-patch: You can now duck twice in the air.
Gloves of Running Urgently Scripts
The Gloves of Running Urgently used to drain 6 health per second while active. However, jumping preserved the speed bonus granted by this weapon and did not require the weapon to be active. Simple scripting allowed for the player to quickly switch to the gloves, jump, and then switch away.
27 juni 2012-patch: Replaced the damage over time of the Gloves of Running Urgently with a time-delayed mini-crit de-buff.
Current Scripts
Weapon Hiding Scripts
There are a large number of scripts which toggle the weapon display option depending on which weapon slot is selected for a class. Players often make their guns invisible to clear up the screen, but make items like melee weapons, PDAs, watches, and so forth visible because these models indicate important information. For example, the Spy relies heavily on his visible model to determine when he is cloaked, when his Cloak is disturbed, and when the Dead Ringer activates. Other classes use the melee animations to judge when their attacks will hit.
Sentry Jumping Scripts
Since the Engineer Update, Engineers have been able to pack up and carry their Sentry Guns. Simultaneously introduced in the update, the Wrangler allows Engineers to Sentry jump with their Sentry rockets. With extremely fast inputs, it was discovered that a player could Sentry jump and successfully pack up their Sentry before they were launched away.
While a human can repeat this feat, it is difficult. Some players made scripts which could reliably execute the commands in the right order at the right speed allowing them to make a Sentry jump while carrying their Sentry every time.
Note: The Rescue Ranger can circumvent this necessity, as it can pick up buildings at range for 130 metal.
Gunslinger Scripts
Since it can be troublesome to destroy then rebuild a Combat Mini-Sentry in the heat of battle through the PDA, some players have scripted the destruction and rebuilding of their Combat Mini-Sentry with the click of one or two mouse buttons. Such a script is especially useful when using the Frontier Justice, as the player gains practically instant access to revenge crits when needed.
Sensitivity and Control scripts
Some players prefer different mouse sensitivities and control schemes for some classes. For example, changing from the Medic, which doesn't require fine aiming, to the Sniper, which encourages low sensitivity for precise aiming so that a hand twitching inadvertently won't ruin a player's aim too much. These scripts alter control schemes and mouse settings on a per class, or even per weapon, basis.
Charge Dash Scripts
Since timing a charge and jump can be difficult, some players may use a quick script that binds the two actions to a button so that the charge dash will cover the maximum amount of distance possible. The player is still required to swing their melee weapon normally to end the charge though.
Quickscope Scripts
Many players find it difficult to scope in and fire straight after to get a quick headshot. There are scripts that will zoom in and fire just by clicking one mouse button. This does require players to aim outside of the scope, though.
Rocket Jump Scripts
In order to Rocket Jump to a maximum height or distance, it is required that the player jumps, crouches, and fires their rocket at roughly the same time. This can be easily scripted to occur with the press of a button.