Close
Showing results 1 to 2 of 2

Hybrid View

  1. #1

    Default Trouble with If Blocks

    So I wrote some code to try a toggle:
    Code:
    <Hotkey LWin>
     <If KeyToggleVar Is 1>
      <TargetButton ToggleKeysBtn>
      <SetButtonText ToggleKeysBtn "Broadcast: Default">
             <ShowWin>
      <Override Hotkey All; Shift All; Alt All; Ctrl All>
      <Hotkey DefaultList; Shift All; Alt All; Ctrl All>
         <SendLabel w1, w2, w3, w4, w5>
           <Key %Trigger%>
      <SetVar KeyToggleVar 2>
      <wait 400>
             <HideWin>
     <Else If KeyToggleVar Is 2>
      <TargetButton ToggleKeysBtn>
      <SetButtonText ToggleKeysBtn "Broadcast: All">
             <ShowWin>
      <Override Hotkey DefaultList; Shift All; Alt All; Ctrl All>
      <Hotkey All; Shift All; Alt All; Ctrl All>
         <SendLabel w1, w2, w3, w4, w5>
           <Key %Trigger%>
      <SetVar KeyToggleVar 3>
      <wait 400>
             <HideWin>
     <Else>
      <TargetButton ToggleKeysBtn>
      <SetButtonText ToggleKeysBtn "Broadcast: Off">
             <ShowWin>
       <Override Hotkey All; Shift All; Alt All; Ctrl All>
      <SetVar KeyToggleVar 1>
      <wait 400>
             <HideWin>
    But when I load this script I get an error
    "Else If" can only follow "If".
    Not sure why I am getting this error - since it IS following the If...

    Any thoughts?
    5 Boxing (85):
    Paladin, 2xMage, Warlock, Priest
    Paldius, Magria, Magrib, Walina, Priset
    Currently:
    5 Boxing (85):
    Paladin, 3xWarlock, Shaman
    Ghallo, Warlisia, Warlisib, Warlisic, Pleo!

  2. #2

    Default

    Quote Originally Posted by Ghallo View Post
    Not sure why I am getting this error - since it IS following the If...
    It has to follow inside the same hotkey definition.

    Each time the keyword <Hotkey...> appears in your script, you are terminating the previous hotkey definition and starting a new definition from scratch.

    <Override ...> and <Hotkey ...> always happen at load time. The program interprets these keywords when it loads the script, not when you press a hotkey.

    Some keywords, since they always happen at load time, are intended to be used outside of hotkey definitions. Examples of such keywords are <Hotkey ...>, <Override ...>, <Template>, <UseKeyAsModifier>, etc.

    If you want to redefine hotkeys when you press a hotkey, the pressed hotkey must reload an entire script.
    Last edited by Freddie : 12-12-2010 at 04:44 AM
    �Author of HotkeyNet and Mojo

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •