Scripting Roadblocks

AcheronAcheron Join Date: 2002-11-13 Member: 8489Members
edited November 2002 in NS General Discussion
<div class="IPBDescription">I am banging my head against a wall here</div> So, I've got this great script going, based in part on <a href='http://www.unknownworlds.com/forums/index.php?act=ST&f=20&t=8598' target='_blank'>Othell's script</a>.

So far, it's a script that remaps your keys if you're a Marine or a Commander. In Commander mode, ideally, you hit a key to open a menu (eg: b for "build"), and two things happen: the menu opens onscreen, and your keys are remapped for building hotkeys (eg: pressing "B, T" buys a turret; - Just like Starcraft <!--emo&:D--><img src='http://www.unknownworlds.com/forums/html/emoticons/biggrin.gif' border='0' valign='absmiddle' alt='biggrin.gif'><!--endemo-->). However, I ran into a few problems:

- Hotkey commands cannot be combined with other commands in a single keystroke. Ie: bind "b" "hotkey86; exec buildremap.cfg" does not do both of those commands. Thus, the closest solution requires <b>two</b> keypresses to open the menu and remap the keys. Similarly, an additional keypress is required to revert your keys to their default settings after you drop buildings/equip.

- At this point, I thought, "fine, no problem". I even came up with a really sneaky solution: by altering my mouse1 bind, I could place the building <i>and</i> revert my keys. Smiling smugly, I wrote the code into my script and tested it. It didn't work. Apparently, when you are a commander, <b>you can't change what your mouse buttons do</b>. That's right, the command to place a building is hardwired into your mouse, so when I tried to alter my +attack settings, it of course did nothing. Similarly, the command to place a building does not exist, it's simply hardwired to your mouse button without your knowledge.

What does all this mean?

To implement a SC-style hotkey script, instead of hitting two buttons to get a building, you have to hit <b>four</b>. Two to open the menu, one to select the building, and one afterwards to revert your menu keys. <b>Well that's convenient</b>. <!--emo&???--><img src='http://www.unknownworlds.com/forums/html/emoticons/confused.gif' border='0' valign='absmiddle' alt='confused.gif'><!--endemo-->

So my question is: why are these two "roadblocks" in place? Is this an intentional effort of the programmers, much like this "leap-blink" effort, to prevent scripting? or is it just a coding mishap? Will it be "fixed"?

Don't get me wrong, I absolutely love NS. I just happen to love scripting as well, and I think this script, if it weren't crippled by strange extra keypresses, could turn out really well.

Comments

  • JA1numJA1num Join Date: 2002-11-06 Member: 7261Members
    wa? can u speak in english? wait a sec..it is english *too dumb to understand <!--emo&:p--><img src='http://www.unknownworlds.com/forums/html/emoticons/tounge.gif' border='0' valign='absmiddle' alt='tounge.gif'><!--endemo--> *
  • AcheronAcheron Join Date: 2002-11-13 Member: 8489Members
    Sorry, sorry! <!--emo&:D--><img src='http://www.unknownworlds.com/forums/html/emoticons/biggrin.gif' border='0' valign='absmiddle' alt='biggrin.gif'><!--endemo--> <i>Really simple summary for board users not familiar with scripting</i>:

    I want to make a script that makes commanding more like playing starcraft. For example, pressing "B" then "T" would buy a turret.

    However, the "hotkey" commands (what we use to buy buildings, open menus - basically everything we do as a commander) are very strange, and you can't make 1 press of a button do both a hotkey (for example, buy a turret) AND do another command at the same time. For those of you unfamiliar with scripting in Half-Life... <i>this is very strange and annoying</i>.

    Oh, and you can only place buildings as a commander with your left mouse button. (That's also the ONLY thing you can make your left mouse button do as a commander).
  • ComproxComprox *chortle* Canada Join Date: 2002-01-23 Member: 7Members, Super Administrators, Forum Admins, NS1 Playtester, NS2 Developer, Constellation, NS2 Playtester, Reinforced - Shadow, WC 2013 - Silver, Subnautica Developer, Subnautica Playtester, Pistachionauts
    I presume it is in an effort to put blocks against "cheap" scirpting, not what this is by a long shot. For people like me though, I have a strategic commander, and can bind multiples of button sets on it, in order, and put delays in and all that, great for commanding!
  • DeadlyFreezeDeadlyFreeze Join Date: 2002-11-04 Member: 6915Members
    You do know there are hot keys on the control menu...
  • JA1numJA1num Join Date: 2002-11-06 Member: 7261Members
    cheap binds really comes in handy when u're a poor pentium 2 user with 4fps during commander with all controls barely responding <!--emo&:angry:--><img src='http://www.unknownworlds.com/forums/html/emoticons/mad.gif' border='0' valign='absmiddle' alt='mad.gif'><!--endemo-->
  • DeadlyFreezeDeadlyFreeze Join Date: 2002-11-04 Member: 6915Members
    edited November 2002
    well with those hot keys you only have to hit 2 keys, 1 to select the menu and the other to select the item... which is just like SC
  • ComproxComprox *chortle* Canada Join Date: 2002-01-23 Member: 7Members, Super Administrators, Forum Admins, NS1 Playtester, NS2 Developer, Constellation, NS2 Playtester, Reinforced - Shadow, WC 2013 - Silver, Subnautica Developer, Subnautica Playtester, Pistachionauts
    what he wants to do (by the sounds of it), is be able to assing keys to multiple tasks, by handig various CFG file. So, T can bring up a turret factory or place a shotgun, depending on what menu you are in, or will that in game menu do? <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html/emoticons/smile.gif' border='0' valign='absmiddle' alt='smile.gif'><!--endemo-->
  • GreedoGreedo Bounty Hunter Join Date: 2002-01-24 Member: 37Members, NS1 Playtester, Contributor
    All I really know about this is that HL wasn't really meant for this top-down RTS viewpoint (obviously) and because of this, building and waypoint placement had to be hard-bound to the mouse. It took two months and a visit to Valve for Flayra to even be able to get the pop-up menu bound to any key you choose. It would probably take many times that to get any of the commander mouse functions bindable.
  • AcheronAcheron Join Date: 2002-11-13 Member: 8489Members
    <i>Not-so-subtle -bump-</i> <!--emo&:D--><img src='http://www.unknownworlds.com/forums/html/emoticons/biggrin.gif' border='0' valign='absmiddle' alt='biggrin.gif'><!--endemo-->

    Comprox is right, I want the possibility of the same keyboard key being used for dif. hotkeys, depending on which menu is open. All I'm asking here is whether the problems that prevent such a script are intentional or accidental.
  • CatgirlCatgirl Join Date: 2002-11-03 Member: 5741Members
    What you need in this situation is <i>aliases</i>.

    Instead of "bind "b" "hotkey86; exec buildremap.cfg"" you want something like...

    <!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->bind "b" buildmenu
    alias buildmenu "hotkey86; exec buildremap.cfg"<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
  • NewhydraNewhydra Join Date: 2002-11-03 Member: 5733Members
    But hotkeys don't work in aliases. The *only* way to get a hotkey to work is to bind it to a specific key, alone.
  • CatgirlCatgirl Join Date: 2002-11-03 Member: 5741Members
    What does that exact hotkey do anyway? It's probably covered by an impulse command, so you could just replace the hotkey with an appropriate impulse.
  • CatgirlCatgirl Join Date: 2002-11-03 Member: 5741Members
    Actually...nix that. Just re-read my impulse list.
  • Rabid_LlamaRabid_Llama Join Date: 2002-11-02 Member: 4340Members
    Acheron is totally right about everything he said. the Hotkey commands hate aliases, hate being run from console, and even hate being in a bind with anything else ("hotkey##;wait" works in my experience. Too bad it's useless <!--emo&:p--><img src='http://www.unknownworlds.com/forums/html/emoticons/tounge.gif' border='0' valign='absmiddle' alt='tounge.gif'><!--endemo-->)
    I'm going to do some poking around to see if maybe there's a hotkey somewhere for the commander's mouseclick. I'll post back if I find anything.
  • NewhydraNewhydra Join Date: 2002-11-03 Member: 5733Members
    I don't know exactly what hotkeys are, only that they're the only thing I've seen which allows you to build something or change menus as the commander. I've run into the exact same problem trying to get a commander script to work...(if you know the impulse to switch to, say, basic build menu...?)
  • FlayraFlayra Game Director, Unknown Worlds Entertainment San Francisco Join Date: 2002-01-22 Member: 3Super Administrators, NS2 Developer, Subnautica Developer
    Hard-coding the mouse buttons for commander mode wasn't done to intentionally prevent scripts, it was done because I couldn't imagine anyone ever wanting to rebind those things (no one does it in RTS after all). I don't know off-hand how much work it is to fix, but it doesn't sound like a big priority, seeing how I've only heard one complaint so far. :)
  • Rabid_LlamaRabid_Llama Join Date: 2002-11-02 Member: 4340Members
    edited November 2002
    Kinda pointless to say this now that the almighty flayra has spoken (hehe <!--emo&:D--><img src='http://www.unknownworlds.com/forums/html/emoticons/biggrin.gif' border='0' valign='absmiddle' alt='biggrin.gif'><!--endemo-->) but there isn't a hotkey that does anything that I haven't already found (that being building, menus, and recycle).
    Oh, wait, the research buttons I have yet to find. but those... well, you can just click those, no point in binding them.
    It is kinda nice to have hotkey69 on delete, though. Click a building, hit delete, and it recycles <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html/emoticons/smile.gif' border='0' valign='absmiddle' alt='smile.gif'><!--endemo-->
  • AcheronAcheron Join Date: 2002-11-13 Member: 8489Members
    Exaaactly <!--emo&:D--><img src='http://www.unknownworlds.com/forums/html/emoticons/biggrin.gif' border='0' valign='absmiddle' alt='biggrin.gif'><!--endemo-->

    Right now my script *works*, and since I'm fast on the keyboard (100 wpm typing) it doesn't really matter that I have to hit buttons. But my "dream" is to distribute the script so other people can use it. So far my solutions are to:

    1. Bind the menu-opening key to *only* exec the remap script, which will itself rebind the menu opening key. Ie: hit b once to rebind, hit it again to actually open the menu onscreen.

    2. Bind mousewheelup to reset the keys.

    These are both fairly easy to do, because you just double-tap a key to open a menu, and mwheelup is right there and not too much effort to hit.
  • Rabid_LlamaRabid_Llama Join Date: 2002-11-02 Member: 4340Members
    edited November 2002
    Why are you "resetting" the menus at all? In my commander script, you hit a key twice to switch menus, but on the first switch, it rebinds the keypad for that menu AND binds the original button to actually switch menus. That way, just two button presses to switch menus, and one more press to actually build anything.
    So three <!--emo&:D--><img src='http://www.unknownworlds.com/forums/html/emoticons/biggrin.gif' border='0' valign='absmiddle' alt='biggrin.gif'><!--endemo-->
    (Here's a link to mine: <a href='http://rawr.mine.nu/commander.cfg' target='_blank'>http://rawr.mine.nu/commander.cfg</a>. Feel free to modify, or incorporate ideas, or whatever <!--emo&:D--><img src='http://www.unknownworlds.com/forums/html/emoticons/biggrin.gif' border='0' valign='absmiddle' alt='biggrin.gif'><!--endemo-->)
  • Dark_HandDark_Hand Join Date: 2002-11-06 Member: 7248Members
    <!--QuoteBegin--Acheron+Nov 16 2002, 12:52 AM--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (Acheron @ Nov 16 2002, 12:52 AM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->So, I've got this great script going, based in part on <a href='http://www.unknownworlds.com/forums/index.php?act=ST&f=20&t=8598' target='_blank'>Othell's script</a>.
    <!--QuoteEnd--></td></tr></table><span class='postcolor'><!--QuoteEEnd-->
    Don't have anything helpful to add to the thread, but I've played under Othell's command several times; he's one of the best commanders I've seen yet. <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html/emoticons/smile.gif' border='0' valign='absmiddle' alt='smile.gif'><!--endemo-->
  • AcheronAcheron Join Date: 2002-11-13 Member: 8489Members
    edited November 2002
    Yes, my script does the same thing. But if you want different keys to do different things depending on which menu is open, you have to reset the keys.

    Ie:

    If my non-team talk button is t, but I *also* want that button as a hotkey for a turret, I have to somehow rebind it to t after I buy a turret. Since the command to select a turret is a hotkey, and since you can't rebind mouse1 to place the turret and rebind your keys... you have to pick another key (in my case mousewheelup) to reset your keys.

    Fussy? Yes. <!--emo&:D--><img src='http://www.unknownworlds.com/forums/html/emoticons/biggrin.gif' border='0' valign='absmiddle' alt='biggrin.gif'><!--endemo-->
  • merC1merC1 Join Date: 2002-11-06 Member: 7345Members
    edited November 2002
    Umm .. just a quick question . How can someone make scripts to "cheat" in command mode ? i just dont really think that it is necessary to block all that in command mode, i can imagine lots of people want to do the same thing as the original poster .
  • othellothell Join Date: 2002-11-02 Member: 4183Members, NS1 Playtester, Contributor
    <!--QuoteBegin--DarkHand69+Nov 16 2002, 06:17 PM--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (DarkHand69 @ Nov 16 2002, 06:17 PM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->Don't have anything helpful to add to the thread, but I've played under Othell's command several times; he's one of the best commanders I've seen yet. <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html/emoticons/smile.gif' border='0' valign='absmiddle' alt='smile.gif'><!--endemo--><!--QuoteEnd--></td></tr></table><span class='postcolor'><!--QuoteEEnd-->
    heh... thanks.
  • TheHornetTheHornet Join Date: 2002-10-31 Member: 1776Members, Constellation
    well, maybe late and useless, but i've had the same problems as you guys with hotkeys... damn things, so i have just binded every hotkey to a different button, a few overlaps making odd keys, but its all good and i just have to press the menu hotkey before a drop a specific item... maybe theres some way to do... *thinks to self* bind t "exec buildmenu.cfg; wait; hotkey56" then inside buildmenu.cfg just have "hotkey86" hmmm... on second though, no
  • Rabid_LlamaRabid_Llama Join Date: 2002-11-02 Member: 4340Members
    <!--QuoteBegin--TheHornet+Nov 17 2002, 05:40 AM--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (TheHornet @ Nov 17 2002, 05:40 AM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->well, maybe late and useless, but i've had the same problems as you guys with hotkeys... damn things, so i have just binded every hotkey to a different button, a few overlaps making odd keys, but its all good and i just have to press the menu hotkey before a drop a specific item... maybe theres some way to do... *thinks to self* bind t "exec buildmenu.cfg; wait; hotkey56" then inside buildmenu.cfg just have "hotkey86" hmmm... on second though, no<!--QuoteEnd--></td></tr></table><span class='postcolor'><!--QuoteEEnd-->
    I had the same thought. And you're right -- no <!--emo&:angry:--><img src='http://www.unknownworlds.com/forums/html/emoticons/mad.gif' border='0' valign='absmiddle' alt='mad.gif'><!--endemo-->
    the double-tap or bind-everything-to-its-own-key methods are the only ones right now.
    I think that if it's something easy to fix, it would be nice. If it would take a lot of work, the current system should work just fine. There are more pressing issues then commanders having to press a button or two more <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html/emoticons/smile.gif' border='0' valign='absmiddle' alt='smile.gif'><!--endemo-->
  • TheHornetTheHornet Join Date: 2002-10-31 Member: 1776Members, Constellation
    i would be nice... but it shouldn't be a top priority... its easy enough to work around... btw check out my own marine, alien, and commander script, <a href='http://www.unknownworlds.com/forums/index.php?act=ST&f=1&t=11737' target='_blank'>here</a>
Sign In or Register to comment.