How to script autobuy of specific items

enter image description here

As you can see the shop is a grid of items.

Commands needed:

the command shop_nav_to_tab x is the column you want in x(0-9)

the command shop_select_itemrow x is the row you want in x(1-11)

example: you want town portal. this would be shop_nav_to_tab 0 and shop_select_itemrow 5

to buy items you need 2 more commands:

dota_shop_force_hotkeys x activates shopkeys(1) or disables them(0) toggleshoppanel just brings up the shop itself

Building:

we need to combine them all into one command:

bind k "dota_shop_force_hotkeys 1;toggleshoppanel;shop_nav_to_tab 0;shop_select_itemrow 5;toggleshoppanel;dota_shop_force_hotkeys 0"

would bind buying a town portal to the key k.

you can bind as many items as u want to one key. just add them after toggleshoppanel:

bind j "clarity+tango+healing_salve" "dota_shop_force_hotkeys 1;toggleshoppanel;shop_nav_to_tab 0;shop_select_itemrow 1;shop_nav_to_tab 0;shop_select_itemrow 2;shop_nav_to_tab 0;shop_select_itemrow 3;toggleshoppanel;dota_shop_force_hotkeys 0"
//                                                                                    (0/1)=clarity                             (0/2)=Tango                           (0/3)=Healing_Salve

Extras:

for a better overview of the things you do you can use alias "namethecommandiwant"

for example:

alias "tp" "dota_shop_force_hotkeys 1;toggleshoppanel;shop_nav_to_tab 0;shop_select_itemrow 5;toggleshoppanel;dota_shop_force_hotkeys 0"

bind k "tp"

is the same code as above! you can just see the binding more clearly.

the clarity combo would be the following:

alias "clarity+tango+healing_salve" "dota_shop_force_hotkeys 1;toggleshoppanel;shop_nav_to_tab 0;shop_select_itemrow 1;shop_nav_to_tab 0;shop_select_itemrow 2;shop_nav_to_tab 0;shop_select_itemrow 3;toggleshoppanel;dota_shop_force_hotkeys 0"
//                                                                                    (0/1)=clarity                             (0/2)=Tango                           (0/3)=Healing_Salve
bind j "clarity+tango+healing_salve"