View Single Post
Old 02-17-2010, 01:17 PM   #32
acdcfanbill
..the wonders I have seen
 
acdcfanbill's Avatar
 
Status: Super Moderator
Join Date: Jun 2001
Location: Random Hell Wholes around the
Posts: 5,698
Imperialist Meatbags Guild Member The Walking Carpets Guild Member LFN Staff Member 10 year veteran! 
The echo is just to output stuff to the console to tell you what happened if you want to, it's not needed.

As for your script, you are setting variable mouse1 to two different things, and then settings the variable firetoggle to the variable string named firetoggle_on which you didn't set anywhere.



Here's what I think you want to do, you want to set mouse button 1 (mouse1) to do primary fire (+attack) at some points and secondary fire (+altattack) at others

1)
so you need two variable strings, primfire which will set mouse1 to primary fire, and secfire which will set mouse1 to secondary fire

Code:
set primfire "bind mouse1 +attack;"
set secfire "bind mouse1 +altattack;"
2)
now you need to somehow toggle between them, so we need a third variable string, we'll call it togglefire and to start off with, we'll just set it to do primary fire (primfire) first. But because primfire is a variable string, we need to put vstr in front of it when we bind the new variable string (togglefire) to the primary fire variable string (primfire)

Code:
set primfire "bind mouse1 +attack;"
set secfire "bind mouse1 +altattack;"
set togglefire "vstr primfire;"
3)
But if you look at that, you'll see it doesn't really toggle, because nothing ever sets the toggle to anything else, so what we have to do is make the act of setting the primary fire change the toggle variable string so that it will set mouse1 to the secondary fire the next time we use it. To do that, we need to edit the primfire and secfire variable strings to have them set the appropriate things, namely, primary fire (primfire) sets the toggle to make mouse1 do secondary fire (secfire) and secondary fire sets the toggle to make mouse1 do primary fire (primfire). Not forgetting of course, that primfire and secfire are both variable strings so vstr is needed.

Code:
set primfire "set togglefire vstr secfire; bind mouse1 +attack;"
set secfire "set togglefire vstr primfire; bind mouse1 +altattack;"
set togglefire "vstr primfire;"
4)
and then of course, we need a button that actually does the toggling, so we use X to represent that. setting the key to the variable string togglefire nets the final result...

Code:
set primfire "set togglefire vstr secfire; bind mouse1 +attack;"
set secfire "set togglefire vstr primfire; bind mouse1 +altattack;"
set togglefire "vstr primfire;"
bind x "vstr togglefire;"
now, you have to be careful with this because +attack and +altattack arn't just regular commands, they are on as long as the button is pressed, so if you are holding mouse1 during secondary fire (+altattack) to say, charge a bryar shot, and you hit the X key to try switching, you'll have secondary fire stuck on and have to put a -altattack into the console to fix it.


Last edited by acdcfanbill; 02-17-2010 at 01:23 PM.
acdcfanbill is offline   you may: quote & reply,