Universal Control Remapper (UCR) - v0.1.22 28th Oct 2018

Post gaming related scripts
User avatar
evilC
Posts: 4739
Joined: 27 Feb 2014, 12:30

Re: Universal Control Remapper (UCR) - v0.1.22 28th Oct 2018

20 Feb 2019, 14:22

"how old are earth do I know which one is trigger or start?"

To tell what button number of your physical stick each button is:
Start -> joy.cpl
Preview the controller
Press a button on the controller
See which number lights up
TheFatal
Posts: 33
Joined: 30 Jan 2016, 06:58

Re: Universal Control Remapper (UCR) - v0.1.22 28th Oct 2018

24 Apr 2019, 09:46

hey evilc, can you please explain to me how can i use a while loop in ucr scripts ?

im usin if else construction at the moment:

Code: Select all

if (e){	
			static StickOps := UCR.Libraries.StickOpsa
                      
                        this.OutputButtons.OB1.SetState(1)
                        sleep 20
                        this.OutputButtons.OB1.SetState(0)
                        sleep 20
                        this.OutputButtons.OB1.SetState(1)
                        sleep 20
 	} else {
			this.OutputButtons.OB1.SetState(0)
		}
can i use while loop instead of if/else ? for example i need to hold button and repeat actions until button will be released
User avatar
evilC
Posts: 4739
Joined: 27 Feb 2014, 12:30

Re: Universal Control Remapper (UCR) - v0.1.22 28th Oct 2018

24 Apr 2019, 13:33

You should not use any kind of long running loop, period.
You must use settimer. Your function must end as quickly as possible
AHK is not a multi-threaded language - a loop will stop other plugins from working, or other plugins will stop the loopfrom working
User avatar
evilC
Posts: 4739
Joined: 27 Feb 2014, 12:30

Re: Universal Control Remapper (UCR) - v0.1.22 28th Oct 2018

24 Apr 2019, 13:59

Code: Select all

class MyPlugin extends _UCR.Classes.Plugin {
	Init(){
		this.SendFn := this.DoSend.Bind(this)
		; Normal Init code here...
	}

	MyHkChangedState(e){
		fn := this.SendFn
		if (e){
			SetTimer, % fn, 100
		} else {
			SetTimer, % fn, Off
		}
	}

	DoSend(){
		this.OutputButtons.OB1.SetState(1)
		sleep 20
		this.OutputButtons.OB1.SetState(0)
		sleep 20
		this.OutputButtons.OB1.SetState(1)
	}
}
Even then, when this fires, it will interfere with other plugins for ~60ms due to the 3x Sleep 20
ranin26
Posts: 2
Joined: 27 May 2019, 03:44

Re: Universal Control Remapper (UCR) - v0.1.22 28th Oct 2018

27 May 2019, 05:45

@evilC I want to send an output on button press and another on release. I saw you tell another guy to use code runner. I tried using code runner with this for the release output: Send vXBox Stick 1,B but that just types it out, how do I get the actual xbox button as output?
User avatar
evilC
Posts: 4739
Joined: 27 Feb 2014, 12:30

Re: Universal Control Remapper (UCR) - v0.1.22 28th Oct 2018

28 May 2019, 10:51

@ranin26 You can't send vXBox output using the code runner
I wrote you a new plugin to allow you to do this - save this file to Plugins\Core
The plugin is called "ButtonToButtonPr" in the plugins list
It will be included in the next release of UCR

Code: Select all

class ButtonToButtonPr extends _UCR.Classes.Plugin {
	Type := "Remapper (Button To Button - Press / Release)"
	Description := "Remap press or release of input to press and release of output"
	Mode := 1	; 1 = Press, 0 = Release
	; The Init() method of a plugin is called when one is added. Use it to create your Gui etc
	Init(){
		; Create the GUI
		Gui, Add, GroupBox, Center xm ym w170 h60 section, Input Button
		this.AddControl("InputButton", "IB1", 0, this.MyHkChangedState.Bind(this), "xs+5 ys+20")
		this.AddControl("ButtonPreview", "", 0, this.IOControls.IB1, "x+5 yp+5")
		;Gui, Add, Text, y+10, % "Remap"
		Gui, Add, GroupBox, Center x190 ym w170 h60 section, Output Button
		this.AddControl("OutputButton", "OB1", 0, "xs+5 ys+20")
		this.AddControl("ButtonPreview", "", 0, this.IOControls.OB1, "x+5 yp+5")
		
		Gui, Add, GroupBox, Center x370 ym w220 h60 section, Settings
		Gui, Add, Text, xs+5 ys+30 w130 Center, % "Send press and release on"
		this.AddControl("DDL", "Pr", this.ModeSelect.Bind(this), "x+5 yp-3 w75 AltSubmit", "Press||Release")
	}
	
	; Called when the hotkey changes state (key is pressed or released)
	MyHkChangedState(e){
		if (this.Mode == e){
			;~ Tooltip % e
			this.IOControls.OB1.Set(1)
			Sleep 50
			this.IOControls.OB1.Set(0)
		}
	}
	
	ModeSelect(value){
		this.Mode := ( value == 1 ? 1 : 0)
	}
}
Goodentree
Posts: 1
Joined: 09 Jun 2019, 08:25

Re: Universal Control Remapper (UCR) - v0.1.22 28th Oct 2018

09 Jun 2019, 09:09

Keep Getting. Error in include usrmain.ahk
Call to non-existent function
Line 141
Messagethreadfilter.ahk

The above is running UCR.ahk

Launching the ucr.exe just launches then disappears
michielsweb
Posts: 1
Joined: 25 Jul 2019, 01:33

Re: Universal Control Remapper (UCR) - v0.1.22 28th Oct 2018

25 Jul 2019, 02:39

Hi i had a issue, but i was able to party solve it whit ucr and vjoy. i was just wondering. if u could help me whit a minor solution

can there be a option like this implentend in ucr?
keyboard combo on press = turn on vjoy button 1
other keyboard combo on press = turn off vjoy button 1

motivation:
i got a toggle switch hooked up to a usb inport card which has 56 digital input. but only suport 32 joystick buttons from himself,
now i can map the rest whit keyboard command per pin. whit active and lose active keyboard commands.
and make off = always off not sometimes on and sometimes off. depending how the toggle was when card is connected :)

i want down to be on. and up off on my toggle. :)

example.
currently the card puts this out for vjoy
right alt + 1 = on and right alt +`1 when release again. whit toggle to prevent flutter. as i have 30 buttons mapped like this example later.
my card software allows me to make seperate command for active and release. so if i can ucr to understand this logic. i can
make toggle active right alt +1 = button 1 on.
make toggle not active right alt +2 = button 1 off witch wil emulate real toggle switches. :) whit toggle function would be super if posseble against flutter
fara74
Posts: 1
Joined: 30 Sep 2019, 02:06

Re: Universal Control Remapper (UCR) - v0.1.22 28th Oct 2018

30 Sep 2019, 02:15

lt rt not show in ucr help
GoodCharles
Posts: 1
Joined: Yesterday, 00:47

Re: Universal Control Remapper (UCR) - v0.1.22 28th Oct 2018

Yesterday, 00:57

@evilC
First of all thank you so much for creating UCR !!

I literally want a very simple setup with UCR but I can't seem to get it to work.
All I want is to set my W,A,S,D keyboard keys to trigger Up, Left, Down, Right respectively on the Left Stick. (Basically simulating an FPS game's movement)
Goal for this: Moving my FPS game character Forward, Left, Backwards and Right

(I'm willing to give any information to solve this)
May anyone please help? Thanks

Return to “Gaming”

Who is online

Users browsing this forum: No registered users and 13 guests