<stpc> Problems With Windower Scripts

Eorzea Time
 
 
 
言語: JP EN FR DE
日本語版のFFXIVPRO利用したい場合は、上記の"JP"を設定して、又はjp.ffxivpro.comを直接に利用してもいいです
users online
フォーラム » Windower » Support » <stpc> problems with windower scripts
<stpc> problems with windower scripts
 Bahamut.Ricker
Offline
サーバ: Bahamut
Game: FFXI
user: RickerUk
Posts: 6
By Bahamut.Ricker 2014-06-30 05:36:46  
Hello,

When I try to use <st> in a windower script, or as part of an alias, execution of any following commands continues right away, and doesn't pause while I confirm the target.

What I am trying to do is use the SubTarget addon, this addon allows you to send a command to your mule, from your mains screen.

If I make this macro in game, everything works as expected;

/ta <stpc>
/console sta go scowie haste

This will make scowie cast haste on the player I selected with the sub target.

If I do the same, but in a windower script, it doesn't work the same;

input /ta <stpc>
sta go scowie haste

When executing this script, the second command is run immediately, it doesn't wait for me to confirm the target.

I would like to get this working with scripts or aliases, so I can bind them to keys, instead of taking up space on my in game macro's.

Anyone got any idea's?
 Lakshmi.Byrth
VIP
Offline
サーバ: Lakshmi
Game: FFXI
user: Byrthnoth
Posts: 6137
By Lakshmi.Byrth 2014-06-30 06:12:09  
The way SE implemented <st> target selection is very complicated. In order for the script that you want to work, you would have to either use the game's interface (the macro you made) or make an addon almost explicitly for the purpose.

Here's the flow for your macro:
Code
You send /ta <st> to the outgoing text buffer (like you typed it)
The game sees it and sends /ta <your player ID> to the outgoing text buffer (this causes an arrow to appear over your head)
You target someone else with it and hit enter
The game sends /ta <your chosen target ID> to the outgoing text buffer

Your macro's next line executes now


Here's the flow for your script:
Code
You send /ta <st> to the outgoing text buffer (like you typed it)
The game sends /ta <your player ID> to the outgoing text buffer (this causes an arrow to appear over your head)
The Windower script doesn't wait on ST targets to be chosen
Your sta line executes now


The only reason the macro works is because SE has macro lines pause until after <st> selection, which is an overly complicated process that's difficult to emulate. So two recommendations:
1) If you want this to work in a windower script, I recommend just using a wait.
2) If you want to try and write an addon to emulate the st selection process, give Shortcuts a look. It's a pain in the ***.
 Ragnarok.Martel
Offline
サーバ: Ragnarok
Game: FFXI
Posts: 2905
By Ragnarok.Martel 2014-06-30 06:20:29  
Two possible solutions.

#1. Break it down into a two part operation. The first part selects a ST target, then the second specifies the spell and activates it.

so, you'd have a simple "/ta <stpc>" in the first bind. Then "sta go scowie haste" in the second spell specific bind.

It makes for more work, but without using an actual macro so you can pause on ST, there's not all that much to do.

NOTE: this idea works on the assumption that SubTarget calls lastst out of the game data to get the target. I dunno that it does, I don't use it. I made my own dualbox st targeting solutions long before the addon came out.

#2. This one would require the use of spellcast of gearswap.

For this option, your bind would be a simple ST of you trying to cast the desired spell.

like, /ma haste <stpc>

The you'd need to set it up in SC or GS to catch said spell, cancel it, and spit out a matching cmd for SubTarget.(there's a potential issue with this in gearswap... not sure how I'd work around it atm) Technically, you wouldn't even need the addon for this method. Could send both spell and target via send, circumventing the subtarget addon entirely.

One issue with this idea is the handling of spells that both you and your mule can cast. This would effectively block your main from casting any of the spells you wanted to send to the mule.

Although, there's a work around for that issue too. XD
 Bahamut.Ricker
Offline
サーバ: Bahamut
Game: FFXI
user: RickerUk
Posts: 6
By Bahamut.Ricker 2014-06-30 06:52:04  
I did have this working when I played previously, in the way you mentioned, via spellcast.

I had a list of spells that If I tried to cast on my main, I would send to my mule via spellcast. I could then do this by doing cure5 <stpc>, as you said.

I will try to get this working with gearswap, since I have moved to that since returning. The only reason I went with the SubTarget addon as it appeared to be able to do what I wanted.

I can see the problems, like If I ever played 2 jobs with access to the same spells. This is never likely to happen though (I don't think).

I usually bind haste, cures, etc to button combinations on my joypad, makes it much faster to dual box.
 Ragnarok.Martel
Offline
サーバ: Ragnarok
Game: FFXI
Posts: 2905
By Ragnarok.Martel 2014-06-30 18:09:24  
Bahamut.Ricker said: »
I usually bind haste, cures, etc to button combinations on my joypad, makes it much faster to dual box.
I'm extremely interested in how you're doing that. Assuming joypad = controller.

Windower, and the binder plugin don't support controller binds. And I'm only managing single button binds via a program that passes button presses to keyboard keystrokes.

A way to directly bind controller buttons, and even more so, combinations of buttons would be extremely useful.
[+]
 Ragnarok.Sekundes
Offline
サーバ: Ragnarok
Game: FFXI
user: Sekundes
Posts: 4189
By Ragnarok.Sekundes 2014-06-30 20:49:57  
Ragnarok.Martel said: »
Bahamut.Ricker said: »
I usually bind haste, cures, etc to button combinations on my joypad, makes it much faster to dual box.
I'm extremely interested in how you're doing that. Assuming joypad = controller.

Windower, and the binder plugin don't support controller binds. And I'm only managing single button binds via a program that passes button presses to keyboard keystrokes.

A way to directly bind controller buttons, and even more so, combinations of buttons would be extremely useful.

Mark another interested. I don't have nearly enough buttons but combos would solve many of those issues.
 Bahamut.Ricker
Offline
サーバ: Bahamut
Game: FFXI
user: RickerUk
Posts: 6
By Bahamut.Ricker 2014-07-01 07:14:13  
Ok, Here's what I came up with.

You need a program called AutoHotKey. I made an AutoHotKey script that can sense when you press certain HotKeys, and you can then Tell it what to send to your FFXI client.

So for example, when I press left shoulder and the X button (Think of a PS3 pad). The script would send Ctrl + F1 (If my FFXI window is active). Obviously for this to work you also have to set up binds in windower.

I made this script originally to alt + tab between my 2 windows by using the joypad, I then expanded it so that I could use combinations. Although I am having trouble getting it to work currently, hence the reason for this thread.

I am currently at work, I don't have access to the script. I will post it when I get home.

You will need to know the button numbers on your controller, this can be done via the control panel using the test feature of the controller.
 Ragnarok.Martel
Offline
サーバ: Ragnarok
Game: FFXI
Posts: 2905
By Ragnarok.Martel 2014-07-02 05:11:43  
I'd love to hear more on this. Particularly that script. I grabbed AutoHotKey, and managed to make a script to determine when the desired buttons are being pressed. But I can't seem to get it to send simultaneous keystrokes to FFXI. Like, send ^{F3} seems to just press F3 rather than Ctrl+F3.

I'm beginning to wonder if the issue is less with what I'm doing and more with FFXI being weird somehow. I tried having it send Alt+F4(written !{F4} in the code) and had notepad in focus when I trigger the controller hot key. And it did what Alt+F4 should, and closed the window. So why is it, that when FFXI is in focus, and I do the same thing, it won't trigger the Alt+F4 Bind? Pressing them on the keyboard manually works.

Anyway, I'd love to see that script. This is getting rather frustrating.
 Lakshmi.Byrth
VIP
Offline
サーバ: Lakshmi
Game: FFXI
user: Byrthnoth
Posts: 6137
By Lakshmi.Byrth 2014-07-02 05:53:58  
That was also my experience with AHK. I set it up to try and reduce alt-tab to a single button press and I basically couldn't get it to happen while I was in game.
 Fenrir.Jinjo
VIP
Offline
サーバ: Fenrir
Game: FFXI
user: Minjo
Posts: 2269
By Fenrir.Jinjo 2014-07-02 06:02:54  
I've been using AHK for 8 years and have never had an issue. I play with controller, so this is my bind to either open my main or tab to my mule (I should probably expand it to open my mule's window if I only have that open, but as I said I've literally had this for 8 years and I've changed nothing but the names for this particular bind):
Code
Joy12::
{
 If WinExist("Tsai ahk_class FFXiClass")
{  
  IfWinActive Tsai ahk_class FFXiClass
  {
    If WinExist("Errai ahk_class FFXiClass")
    {
     WinActivate
    }
  }
  else
  {
    If WinExist("Tsai ahk_class FFXiClass")
    WinActivate
  }
}


I also use ^!1::{} ^!2::{} ^!7::{} etc. which is Ctrl+Alt+Key and have never had a problem.
 Ragnarok.Martel
Offline
サーバ: Ragnarok
Game: FFXI
Posts: 2905
By Ragnarok.Martel 2014-07-02 06:13:59  
Well, I did finally get something working. I had to have it hold the keys down, the use sleep to wait a bit, then let up on them. THat finally made it start triggering Ctrl/Alt +Fkey binds.

Is FFXI just HELP I AM TRAPPED IN 2006 PLEASE SEND A TIME MACHINE?

Also, I setup a hotkey to reload my script, since i was having to reload it so freaking much testing things. It's great, but for some reason, it won't trigger if FFXI is in focus... again, weird.
 Ragnarok.Martel
Offline
サーバ: Ragnarok
Game: FFXI
Posts: 2905
By Ragnarok.Martel 2014-07-02 06:19:00  
Hmmm. Occasionally it still just presses F3 rather than Ctrl/Alt+F3. Seems rather unreliable. Would definitely like a better way to handle it.
 Fenrir.Jinjo
VIP
Offline
サーバ: Fenrir
Game: FFXI
user: Minjo
Posts: 2269
By Fenrir.Jinjo 2014-07-02 06:23:35  
Hrm, you're correct -- either Windower or XI prevents AHK from receiving key presses, but not controller input, when active.
 Bahamut.Ricker
Offline
サーバ: Bahamut
Game: FFXI
user: RickerUk
Posts: 6
By Bahamut.Ricker 2014-07-02 13:29:17  
Here is the script that I use.
Code
#MaxThreads 2
#MaxThreadsPerHotkey 2

#WinActivateForce

#SingleInstance force


GetWindowIDs()
 
; Button 1 (X)
Joy1::
{
	ifWinActive ahk_class FFXiClass 
	{
		TriggerState := GetTriggers()
		If (TriggerState == "None") {
			; Action
			SendInput {Enter}
		}
		else if (TriggerState == "Both") 
		{
			; Curaga III - Ctrl + f11
			SendInput {Esc}
			sleep 100
			SendInput {ctrl down}
			sleep 100
			SendInput {F11}
			sleep 100
			SendInput {ctrl up}    
		}
		else if (TriggerState == "Right") 
		{
			; Cure 5 Others - Ctrl + f9
			SendInput {Esc}
			sleep 100
			SendInput {ctrl down}
			sleep 100
			SendInput {F9}
			sleep 100
			SendInput {ctrl up}
		}
		else if (TriggerState == "Left") 
		{
			; Cure 5 - Ctrl + f3
			SendInput {Esc}
			sleep 100
			SendInput {ctrl down}
			sleep 100
			SendInput {F3}
			sleep 100
			SendInput {ctrl up}
		}
	}
	return
}

; Button 2 (O)
Joy2:: 
{
	ifWinActive ahk_class FFXiClass 
	{
		TriggerState := GetTriggers()
		If (TriggerState == "None") 
		{
			; Cancel
			SendInput {Esc}
		}
		else if (TriggerState == "Both") 
		{
			; Curaga IV - Ctrl + f5
			SendInput {ctrl down}
			sleep 100
			SendInput {F5}
			sleep 100
			SendInput {ctrl up}    
			sleep 100
			SendInput {Esc}
		}
		else if (TriggerState == "Right") 
		{
			; Cure 6 Others - Ctrl + f10
			SendInput {Esc}
			sleep 100
			SendInput {ctrl down}
			sleep 100
			SendInput {F10}
			sleep 100
			SendInput {ctrl up}
		}
		else if (TriggerState == "Left") 
		{
			; Cure 6 - Ctrl + f4
			SendInput {ctrl down}
			sleep 100
			SendInput {F4}
			sleep 100
			SendInput {ctrl up}
			sleep 100
			SendInput {Esc}
		}	
	}
	return
}

; Button 3 ([])
Joy3:: 
{
	ifWinActive ahk_class FFXiClass 
	{
		TriggerState := GetTriggers()
		If (TriggerState == "None") 
		{
			; Switch Active Window
			SendInput {NumpadAdd}
		}
		else if (TriggerState == "Both") 
		{
			; Remove last debuff from others, Alt + f5
			SendInput {alt down}
			sleep 100
			SendInput {F5}
			sleep 100
			SendInput {alt up}
			sleep 100 
		}
		else if (TriggerState == "Right") 
		{
			; Cure IV - Ctrl + f2
			SendInput {ctrl down}
			sleep 100
			SendInput {F2}
			sleep 100
			SendInput {ctrl up}
			sleep 100
			SendInput {Esc}
		}
		else if (TriggerState == "Left") 
		{
			; Remove debuffs, Ctrl + f8
			SendInput {ctrl down}
			sleep 100
			SendInput {F8}
			sleep 100
			SendInput {ctrl up}
			sleep 100
			SendInput {Esc}
		}
	}
	return
}

; Button 4 (Triangle)
Joy4:: 
{
	ifWinActive ahk_class FFXiClass 
	{
    TriggerState := GetTriggers()
		If (TriggerState == "None") 
		{
			; Menu
			SendInput {NumpadSub}
		}
		else if (TriggerState == "Both") 
		{
			; Curaga V
			SendInput {alt down}
			sleep 100
			SendInput {F3}
			sleep 100
			SendInput {alt up}    
			sleep 100
			SendInput {Esc}
		}
		else if (TriggerState == "Right") 
		{
			; Cure IV Others - Alt + f2
			SendInput {Esc}
			sleep 100
			SendInput {alt down}
			sleep 100
			SendInput {F2}
			sleep 100
			SendInput {alt up}
		}
		else if (TriggerState == "Left") 
		{
			; Stun - Alt + F1
			SendInput {alt down}
			sleep 100
			SendInput {F1}
			sleep 100
			SendInput {alt up}
			sleep 100
			SendInput {Esc}
		}
	}
	return
}

; Button 5 (L1)
Joy5:: {
	ifWinActive ahk_class FFXiClass 
	{
		; follow
		SendInput {ctrl down}
		sleep 100
		SendInput x
		sleep 100
		SendInput {ctrl up}
	}
	return
}

; Button 6 (R1)
Joy6:: {
	ifWinActive ahk_class FFXiClass 
	{
		; Autorun
		SendInput {Numpad7}
	}
	return
}

; Button 12 (L3)
Joy12:: {    
	ifWinActive ahk_class FFXiClass 
	{
		TriggerState := GetTriggers()
		If (TriggerState == "None") 
		{
			; Heal
			SendInput {NumpadMult}
		}
		else if (TriggerState == "Both") 
		{
			; Haste Scowie - Ctrl + f6
			SendInput {ctrl down}
			sleep 100
			SendInput {F6}
			sleep 100
			SendInput {ctrl up}
			sleep 100
			SendInput {Esc}
		}
		else if (TriggerState == "Right") 
		{
			; Haste others - Ctrl F12
			SendInput {Esc}
			sleep 100
			SendInput {ctrl down}
			sleep 100
			SendInput {F12}
			sleep 100
			SendInput {ctrl up}
		}
		else if (TriggerState == "Left") 
		{
			; Haste Ricker - Ctrl F7
			SendInput {ctrl down}
			sleep 100
			SendInput {F7}
			sleep 100
			SendInput {ctrl up}	
			sleep 100
			SendInput {Esc}
		}
	}
	return
}

; Button 13 (R3)
Joy13:: {
	TriggerState := GetTriggers()
	If (TriggerState == "None") 
	{
		; Switch active window between Ricker and Scowie
		IfWinActive, ahk_id %ricker_id% 
		{
			IfWinExist, ahk_id %scowie_id% 
			{
				WinActivate
			}
		} 
		else 
		{
			IfWinExist, ahk_id %ricker_id% 
			{
				WinActivate
			}
		}
	}
	else if (TriggerState == "Both") 
	{
	}
	else if (TriggerState == "Right") 
	{
	}
	else if (TriggerState == "Left") 
	{
		; Enfeebles - Alt + F4
		SendInput {alt down}
		sleep 100
		SendInput {F4}
		sleep 100
		SendInput {alt up}	
	}
	return
}

; refresh window IDs
#a:: 
{
  GetWindowIDs()
  return
}

GetTriggers() 
{
	; Get the state of the triggers
  
	Trigger := "None"
  
	GetKeyState, LeftTrig, Joy7
	GetKeyState, RightTrig, Joy8
	If (RightTrig == "D") 
	{
		if (LeftTrig) == "D" 
		{
			Trigger := "Both"
		}
		else 
		{
			Trigger := "Right"
		}
	}
	else if (LeftTrig == "D") 
	{
		Trigger := "Left"
	}
	return Trigger
}
  


GetWindowIDs() 
{
	; Get Scowie and Ricker Window IDs
	ricker_id := ""  
	scowie_id := ""

	WinGet,ffxi,List,ahk_class FFXiClass

	Loop, %ffxi% 
	{
		cur_id := ffxi%A_Index%
		WinGetTitle, cur_title, ahk_id %cur_id%
		If (cur_title = "Ricker") or (cur_title = "Kraeze") or (cur_title = "Katheryn") or (cur_title = "Growler") or (cur_title = "Zhandra") or (cur_title = "Elliemarie") 
		{
			global ricker_id := cur_id
		}
		else 
		{
			if (cur_title = "Scowie") or (cur_title = "Muluwalu") or (cur_title = "Tsar") 
			{
				global scowie_id := cur_id
			}
		}
	}
	if (!ricker_id) 
	{
		output := "Ricker ID not found`n"
	}
	if (!scowie_id) 
	{
		output := output . "Scowie ID not found"
	}
	if (output != "") 
	{
		MsgBox %output%
	}
	return
}  


Things that you need to do.

Find out the number of your buttons, you can do this in control panel.

Change the ffxi config so that the buttons you want to use as part of a combination are unassigned. I will refer to the buttons as a PS3 pad. For this script it is Button 1(x), Button 2(O), Button 4(Triangle), Button 3(Square), Button 13 (Right stick), Button 12 (Left Stick), Button 5( L1) and Button 6(R1).

You will also need to setup binds in windower, to activate when the key combo is sent via the script. For example I have ctrl + x bound to a follow macro so that when I press my L1 button, my mule follows me (Whichever character I am controlling). This is bound to different commands depending on the character that is logged in, via autoexec.

I think the script has to be run as administrator.