Banished

Banished

View Stats:
Draika Nov 26, 2014 @ 1:29am
GlovePIE script for Wii Classic Controller Nintendo
GlovePIE is a scripting/macro program that lets you connect Nintendo Wiimotes to your computer. This script is for the Wii Classic Controller.

Spent all afternoon trying to fix xome weird issue where keys kept getting stuck (especially number keys) x.x. Word of advice - don't use press() and release() functions, they suck.

FEATURES:
-Menu and Submenu cycling (using X and Y buttons)
-Audio feedback :3 (you can remove by deleting say("[stuff]") lines)

CONTROLS:

A = left click
B = right click
X = cycle through menus
Y cycle through submenus

Left stick = control mouse pointer
Right stick = pan camera

D-Pad = camera zoom/rotation

L = rotate structure left
R = rotate structure right

Start = Pause menu
Select = toggle pause

NOT TESTED:
ZL = slow down time
ZR = faster time


BUGS/ISSUES:
-time control not tested (using ZL and ZR)
-bug: in the submenu, the counter for the selector always goes up to 10 for every menu even if there are less than 10 items in a submenu. It is reset to 1 after going up to 10 anyway, and pressing X to go to next menu resets it so it's no big deal.

------------ SCRIPT ------------------------

//Mouse control
mouse.DirectInputX = mouse.DirectInputX + deadzone(classic1.LeftStickX) * 15
mouse.DirectInputY = mouse.DirectInputY + deadzone(classic1.LeftStickY) * 15

//Menu navigation control (buildings only, use X)
if Pressed(classic1.X) then
var.Ycount = 0
var.Xcount++
if var.Xcount = 1 then
press(keys.F3)
say("Houses")
wait 200 ms
release(keys.F3)
endif
if var.Xcount = 2 then
press(keys.F4)
say("Infrastructure")
wait 200 ms
release(keys.F4)
endif
if var.Xcount = 3 then
press(keys.F5)
say("Storage and Trade")
wait 200 ms
release(keys.F5)
endif
if var.Xcount = 4 then
press(keys.F6)
say("Town Services")
wait 200 ms
release(keys.F6)
endif
if var.Xcount = 5 then
press(keys.F7)
wait 200 ms
say("Food Production")
release(keys.F7)
endif
if var.Xcount = 6 then
press(keys.F8)
wait 200 ms
say("Resource Production")
release(keys.F8)
endif
if var.Xcount = 7 then
press(keys.F9)
wait 200 ms
say("Destruction and Removal Tools")
release(keys.F9)
var.Xcount = 0
endif
if var.Xcount >= 8 then
var.Xcount = 0
endif
endif

//Submenu navigation control (must select menu with X first, use Y)
if Pressed(classic1.Y) then
var.Ycount++
if var.Ycount = 1 then
keys.One = true
wait 200 ms
keys.One = false
endif
if var.Ycount = 2 then
keys.Two = true
wait 200 ms
keys.Two = false
endif
if var.Ycount = 3 then
keys.Three = true
wait 200 ms
keys.Three = false
endif
if var.Ycount = 4 then
keys.Four = true
wait 200 ms
keys.Four = false
endif
if var.Ycount = 5 then
keys.Five = true
wait 200 ms
keys.Five = false
endif
if var.Ycount = 6 then
keys.Six = true
wait 200 ms
keys.Six = false
endif
if var.Ycount = 7 then
keys.Seven = true
wait 200 ms
keys.Seven = false
endif
if var.Ycount = 8 then
keys.Eight = true
wait 200 ms
keys.Eight = false
endif
if var.Ycount = 9 then
keys.Nine = true
wait 200 ms
keys.Nine = false
endif
if var.Ycount = 10 then
keys.Zero = true
wait 200 ms
keys.Zero = false
var.Ycount = 0
endif
if var.Ycount >= 11 then
var.Ycount = 0
endif
endif

//Time control (use ZL ZR)
if classic1.ZL then
keys.F1 = true
wait 50
keys.F1 = false
keys.One = true
wait 200
keys.One = false
endif

if classic1.ZR then
keys.F1 = true
wait 50
keys.F1 = false
keys.Four = true
wait 200
keys.Four = false
endif




//Left and Right click
Mouse.LeftButton = classic1.a
Mouse.RightButton = classic1.b //use for cancel building something

//Toggle time pause
key.Space = classic1.Select

//Rotate structures (right)
key.R = classic1.L
key.T = classic1.R

//Camera Pan Control
key.W = classic1.RightStickY < -0.6
key.S = classic1.RightStickY > 0.6
key.A = classic1.RightStickX < -0.6
key.D = classic1.RightStickX > 0.6

//Camera Zoom Control
Mouse.WheelUp = classic1.Up
Mouse.WheelDown = classic1.Down

//Camera Rotation Control
key.Q = classic1.Left
key.E = classic1.Right

//Pause menu
key.Escape = classic1.Start


Last edited by Draika; Nov 26, 2014 @ 1:31am
< >
Showing 1-1 of 1 comments
Draika Nov 26, 2014 @ 1:17pm 
I can't really get PPjoy to work properly but to get more realistic mouse simulation with the left stick use the following script with PPjoy installed (Replace "mouse control" part):

PPJoy.Analog0 = Classic.Joy1X*1.5
PPJoy.Analog1 = Classic.Joy1Y*1.5

//Mouse control
mouse.DirectInputX = mouse.DirectInputX + deadzone(PPJoy.Analog0) * 15
mouse.DirectInputY = mouse.DirectInputY + deadzone(PPJoy.Analog1) * 15
< >
Showing 1-1 of 1 comments
Per page: 1530 50

Date Posted: Nov 26, 2014 @ 1:29am
Posts: 1