Luthien on 3/10/2016 at 22:20
The "run" command allows some useful scripting. To use them, make a subdirectory "rs" in the game directory, place the scripts there with the given name and make a binding in user.bnd to activate. This works in TG (TDP should work too). I've not yet converted the scripts to TMA (TMA does not have the cycle_item command but uses next_item and prev_item instead).
WARNING: If the bindings in user.bnd get too log, the game crashes in the options screen. So don't make the script names too long.
* Select the blackjack and the compass, if available, otherwise select nothing.
Code:
bind somekey "run rs/bj_and_compass"
Code:
run "rs/clear_all"
clear_weapon_and_item
inv_select blackjack
inv_select compass2
* "Deactivate" the current weapon, i.e. do not shoot a knocked arrow etc. but keep the weapon in hand.
Code:
bind somekey "run rs/relax_weapon"
Code:
cycle_weapon 1
cycle_weapon -1
use_weapon 0
* Clear the weapon and the active item (uses the script below).
Code:
bind somekey "run rs/clear_all"
Code:
clear_weapon
run rs/clear_item
* Clear the active item so that it does not come back after looking at the map.
Code:
bind somekey "run rs/clear_item"
Code:
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
clear_item
cycle_item 1
cycle_item -1
Note: If you ever encounter a mission with more than 50 carryable item types, add more "clear_item - cycle_item 1 - cycle_item -1" triplets to the script.
* Frob an environment item even when holding an inventory item. Do *not* use the inventory item.
Code:
bind somekey "run rs/frob_environment"
Code:
clear_item
use_item 0
use_item 1
cycle_item 1
Drawback: If you have no item ready when invoking the script, it switches to the first item you have, usually the compass if you have one, but potentially something annoying.
Cigam on 4/10/2016 at 15:58
Thanls for this, looks interesting. I will check out that option about relaxing weapons as a denock without putting bow away would be useful.
Out of interest would it be possible to create two separate binds, one exclusively for picking up/interacting with objects in the world, and another exclusively for using inventory items?
So I could click-click-click sweep a table or area for collectable objects without having to worry about accidentally throwing a mine or drinking a potion if I miss and click on nothing?
Or failing that, a script that picks up an item then immediately clears inventory so I can happily keep clicking knowing that if I miss an object it won't instead use what I previously picked up?
Either would be very useful.
Grandmauden on 4/10/2016 at 19:35
Quote:
Or failing that, a script that picks up an item then immediately clears inventory so I can happily keep clicking knowing that if I miss an object it won't instead use what I previously picked up?
That's already in the game. Disable "auto-equip" under the game options.
Luthien on 4/10/2016 at 20:11
Quote Posted by Cigam
I will check out that option about relaxing weapons as a denock without putting bow away would be useful.
It's a bit awkward because it really tucks away the weapon then draws it again. But it works.
Quote:
Out of interest would it be possible to create two separate binds, one exclusively for picking up/interacting with objects in the world, and another exclusively for using inventory items?
Tricky. Using "toggle" type commands like "use_item" is funny in scripts. I see no way to make a script that just uses the item in hand and does not frob the environment if none is held, because "use_item" does not make this distinction. But it *is* possible to make a script that frobs the environment even when wielding a poition or so, without switching the item (actually the script tucks away the item, frobs the environment and then re-equips the item).
Code:
bind somekey "run rs/frob_environment"
Code:
clear_item
use_item 0
use_item 1
cycle_item 1
This works fine for me in TG. The only drawback is that if you have no item ready when invoking the script, it switches to the first item you have, usually the compass if you have one, but potentially something annoying. Don't ask me why "use_item 0" must come before "use_item 1". Perhaps scripting reverses the order of "toggle" type commands?
Looks very useful. Bind it to your usual "use" key and make another binding for really using the inventory ("bind somekey +use_item"). Over are the times when you accidentally ate half the food when picking up a pile of apples. :-)
Quote:
Or failing that, a script that picks up an item then immediately clears inventory so I can happily keep clicking knowing that if I miss an object it won't instead use what I previously picked up?
This should work, but not tested.
Code:
use_item 0
use_item 1
clear_item
Quote Posted by Grandmauden
That's already in the game. Disable "auto-equip" under the game options.
Alas, that's only in T2.
Luthien on 4/10/2016 at 21:06
More scripts that simplify using items from your backpack. So now you can drink a slowfall potion or throw a flashbomb with a single keypress. No fiddling with the inventory anymore. And a "first aid" button could save you when running away from an archer.
Unfortunately if you don't have that type of item, or hold a shovel, rock, body etc. you'll throw that or frob the environment instead.
If you don't have the "clear_item" script or don't want to use it, replace the last line in the scripts with a plain "clear_item" command.
My TG bindings:
Code:
bind f1 "run rs/first_aid"
bind f1+shift "inv_select healingpotion"
bind f2 "run rs/quaff_airpotion"
bind f2+shift "inv_select airpotion"
bind f3 "run rs/quaff_speedpotion"
bind f3+shift "inv_select speedpotion"
bind f4 "run rs/throw_flashbomb"
bind f4+shift "inv_select flashbomb"
bind f5 "run rs/quaff_holyh2o"
bind f5+shift "inv_select holyh2o"
bind f8 "run rs/quaff_slowfall"
bind f8+shift "inv_select slowfall"
* FIRST_AID: Eat a healing fruit if possible, then eat another healing fruit if available or drink a healing potion if not.
Code:
bind somekey "run rs/first_aid"
Code:
clear_item
inv_select healingfruit
use_item 0
use_item 1
; note: selects a healingfruit rather than a healingpotion if you still have one
inv_select healingpotion
use_item 0
use_item 1
run rs/clear_item
* Select and activate a flare.
Code:
bind somekey "run rs/ignite_flare"
Code:
clear_item
inv_select flare
use_item 0
use_item 1
run rs/clear_item
* Quaff an airpotion.
Code:
bind somekey "run rs/quaff_airpotion"
Code:
clear_item
inv_select airpotion
use_item 0
use_item 1
run rs/clear_item
* Quaff holy water.
Code:
bind somekey "run rs/quaff_holyh2o"
Code:
clear_item
inv_select holyh2o
use_item 0
use_item 1
run rs/clear_item
* Quaff an invisibility potion.
Code:
bind somekey "run rs/quaff_invisipotion"
Code:
clear_item
inv_select invisipotion
use_item 0
use_item 1
run rs/clear_item
* Quaff a healing potion.
Code:
bind somekey "run rs/quaff_healingpotion"
Code:
clear_item
inv_select healingpotion
use_item 0
use_item 1
run rs/clear_item
* Quaff a slowfall potion.
Code:
bind somekey "run rs/quaff_slowfall"
Code:
clear_item
inv_select slwofall
use_item 0
use_item 1
run rs/clear_item
* Quaff a speef potion.
Code:
bind somekey "run rs/quaff_speedpotion"
Code:
clear_item
inv_select speedpotion
use_item 0
use_item 1
run rs/clear_item
* Throw a scouting orb.
Code:
bind somekey "run rs/throw_cameragrenade"
Code:
clear_item
inv_select cameragrenade
use_item 0
use_item 1
run rs/clear_item
* Throw a frogg egg.
Code:
bind somekey "run rs/throw_frogegg"
Code:
clear_item
inv_select frogegg
use_item 0
use_item 1
run rs/clear_item
* Throw a flashbomb.
Code:
bind somekey "run rs/throw_flashbomb"
Code:
clear_item
inv_select flashbomb
use_item 0
use_item 1
run rs/clear_item
Luthien on 4/10/2016 at 22:03
Just noted that TG crashes when entering the options screen if a line in user.bnd is too long. So I've renamed the script directory to "rs" and shortened some script names.
By the way, the "frob_environment" script works great. You can now run around hitting the "frob" key like crazy without risking to use something you just picked up!
Cigam on 6/10/2016 at 18:32
Quote Posted by Grandmauden
That's already in the game. Disable "auto-equip" under the game options.
Ah, so it is. I think I assumed that like the 'autosearch bodies' option it would not work in TG since it is a T2 feature. But unlike 'autosearch bodies' it actually does work in TG and is not just a redundant menu option.
Cigam on 6/10/2016 at 18:59
Luthien, thanks for that frob script. Switching autoequip off does solve half of the problem in that as long as nothing is equipped you can sweep-click around a table knowing that you will not waste any of the items you are picking up. But you still have to remember to unequip first, which you might forget or not have time to do.
The frob scipt eliminates the need to remember or make sure nothing is equipped, and so you can drop a flashbomb, turn around and blackjack the guard, then quickly PP them or pick them up or grab the object on the table behind them, without accidentally wasting a still-equiped flashbomb if you miss-aim.
It also appears that you can leave autoequip on then the item will be equipped after you use frob to pick it up, which I think is my preference. PP a guard, get the key, then run to the door happily frobbing any other door, chest, lever or guard you have just knocked out on the way, without the key interfering, then "use" the key once you get to the door without having to switch to it as you would if autoequip was off.
So thanks for the script, a good problem-solver for me :)
Just two things. In your instructions you say to add the lines to user.cfg but this did nothing for me. I added them to user.bnd instead and that made them work in-game but reset a lot of my options and so I had to change them back. Is this normal? Not a problem if so but just want to check I am using the right file.
Secondly, just a minor thing, but is that bind for deactivate weapon meant to end in a "?
Once again, thanks for some useful scripts :) Those quick-drink potions ones also look good, since thinking about it I never use their hotkeys to select them in inventory unless if I am going to drink them.
Cigam on 6/10/2016 at 19:04
Just one more thing :)
Is there anyway to create a bind that will select your first key? I often come to a locked door and want to check all my keys before having to spend the time lockpicking, but there is no direct way to get to your keys from what I can see. Some scrolling until you find them is required.
You might have had enough of scripting of course, but thought I'd ask :)
Luthien on 6/10/2016 at 19:20
Quote Posted by Cigam
In your instructions you say to add the lines to user.cfg but this did nothing for me. I added them to user.bnd instead and that made them work in-game
Sorry, that was just a typo.
Quote:
but reset a lot of my options and so I had to change them back. Is this normal?
I don't understand exactly what happened to you. No, that's not normal, but user.bnd gets overwritten by the game once in a while. That shouldn't be a problem unless you edit the file with the game still running.
Quote:
Secondly, just a minor thing, but is that bind for deactivate weapon meant to end in a "?
Yes. Might work without the final one, never tested that.
Quote:
Those quick-drink potions ones also look good, since thinking about it I never use their hotkeys to select them in inventory
unless if I am going to drink them.
I still have to get used to my new bindings because I usually select potions to stack them. :)