Code: Select all
variable int GP_Forward=0
variable int GP_Sideways=0
variable int GP_Rotation=0
variable int GP_Elevation=0
variable int GP_Threshhold=20
variable int GP_Axis_Changed=0
variable bool GP_Strafe=0
variable string GP_Last_Changed=""
variable bool GP_Button_Changed=0
variable bool GP_Lastdirection=0
variable bool GP_Autorun=0
variable bool GP_DPad_Changed=0
variable int GP_DPad_Value=-1
variable int GP_DPad_Lastvalue=-1
function main()
{
call initialize
while TRUE
{
if "${GP_DPad_Changed}"
DoDpad
if "${GP_Button_Changed}"
DoButtons
if "${GP_Axis_Changed}"
DoAxes
waitframe
}
}
function initialize()
{
Event[OnAxisMove]:AttachAtom[AxisAtom]
Event[OnButtonMove]:AttachAtom[ButtonAtom]
Event[OnDPadMove]:AttachAtom[DPadAtom]
squelch HUD -add dpad 1,1 *
HUDSet dpad -s 12 -c FF00F000 -l 10,800 -t ""
}
atom DoDpad()
{
switch ${GP_DPad_Value}
{
case -1
break
case 0
HUDSet dpad -s 12 -c FF00F000 -l 5,940 -t "Resonance"
GP_DPad_Lastvalue:Set[${GP_DPad_Value}]
break
case 45
HUDSet dpad -s 12 -c FF00F000 -l 5,940 -t "Shield of the Eighth"
GP_DPad_Lastvalue:Set[${GP_DPad_Value}]
break
case 90
HUDSet dpad -s 12 -c FF00F000 -l 5,940 -t "Pestilence Shock"
GP_DPad_Lastvalue:Set[${GP_DPad_Value}]
break
case 135
HUDSet dpad -s 12 -c FF00F000 -l 5,940 -t "Taelosian Guard"
GP_DPad_Lastvalue:Set[${GP_DPad_Value}]
break
case 180
HUDSet dpad -s 12 -c FF00F000 -l 5,940 -t "Form of Endurance III"
GP_DPad_Lastvalue:Set[${GP_DPad_Value}]
break
case 225
HUDSet dpad -s 12 -c FF00F000 -l 5,940 -t "Ant Legs"
GP_DPad_Lastvalue:Set[${GP_DPad_Value}]
break
case 270
HUDSet dpad -s 12 -c FF00F000 -l 5,940 -t "Levitation"
GP_DPad_Lastvalue:Set[${GP_DPad_Value}]
break
case 315
HUDSet dpad -s 12 -c FF00F000 -l 5,940 -t "Symphony of Battle"
GP_DPad_Lastvalue:Set[${GP_DPad_Value}]
break
default
}
GP_DPad_Changed:Set[0]
}
atom DoButtons()
{
switch ${GP_Last_Changed}${If[${GP_Lastdirection}==1,_Down,_Up]}
{
case RP_B0_Down
nomodkey keypress hot1_1
break
case RP_B1_Down
nomodkey keypress hot1_2
break
case RP_B2_Down
nomodkey keypress hot1_3
break
case RP_B3_Down
nomodkey keypress hot1_4
break
case RP_B4_Down
nomodkey keypress use
break
case RP_B5_Down
switch ${GP_DPad_Lastvalue}
{
case -1
break
case 0
swapcast "Voice of the Serpent"
break
case 45
swapcast "Coldain Hero's Insignia Ring"
break
case 90
swapcast "Symbol of the Planemasters"
break
case 135
swapcast "Ring of Organic Darkness"
break
case 180
swapcast "Pristine Witheran Hide Drum"
break
case 225
swapcast "Bracelet of the Shadow Hive"
break
case 270
swapcast "Pegasus Feather Cloak"
break
case 315
swapcast "Rapier of Somber Notes"
break
default
}
break
case RP_B6_Down
nomodkey keypress hotpage1_3
break
case RP_B6_Up
nomodkey keypress hotpage1_1
break
case RP_B7_Down
nomodkey keypress hotpage1_2
break
case RP_B7_Up
nomodkey keypress hotpage1_1
break
case RP_B8_Down
nomodkey keypress tab
break
case RP_B9_Down
nomodkey keypress cyclenpctargets
break
case RP_B10_Down
keypress centerview
echo
break
case RP_B11_Down
; if "${GP_Autorun}==1"
; {
; GP_Axis_Changed:Set[1]
; GP_Autorun:Set[0]
; nomodkey keypress forward
; }
; else
; {
; GP_Axis_Changed:Set[1]
; GP_Autorun:Set[1]
nomodkey keypress autorun
; }
break
default
}
GP_Button_Changed:Set[0]
}
atom DoAxes()
{
GP_Rotation:Set[${Math.Calc[(${Input.Axis[RP_RX].Position}*100)-50].Int}]
GP_Elevation:Set[${Math.Calc[(${Input.Axis[RP_LY].Position}*100)-50].Int}]
GP_Sideways:Set[${Math.Calc[(${Input.Axis[RP_LX].Position}*100)-50].Int}]
GP_Forward:Set[${Math.Calc[(${Input.Axis[RP_RY].Position}*100)-50].Int}]
if "${GP_Rotation}<-${GP_Threshhold}"
{
nomodkey keypress left hold
}
else
{
if "${GP_Rotation}>${GP_Threshhold}"
{
nomodkey keypress right hold
}
else
{
nomodkey keypress left
nomodkey keypress right
GP_Rotation:Set[0]
}
}
if "${GP_Elevation}<-${GP_Threshhold}"
{
nomodkey keypress pitchdown hold
}
else
{
if "${GP_Elevation}>${GP_Threshhold}"
{
nomodkey keypress pitchup hold
}
else
{
nomodkey keypress pitchdown
nomodkey keypress pitchup
GP_Elevation:Set[0]
}
}
if "${GP_Sideways}<-${GP_Threshhold}"
{
nomodkey keypress strafe_left hold
}
else
{
if "${GP_Sideways}>${GP_Threshhold}"
{
nomodkey keypress strafe_right hold
}
else
{
nomodkey keypress strafe_left
nomodkey keypress strafe_right
GP_Sideways:Set[0]
}
}
if "${GP_Forward}<-${GP_Threshhold}"
{
nomodkey keypress forward hold
}
else
{
if "${GP_Forward}>${GP_Threshhold}"
{
nomodkey keypress back hold
GP_Autorun:Set[0]
}
else
{
nomodkey keypress forward
nomodkey keypress back
GP_Forward:Set[0]
}
}
GP_Axis_Changed:Set[0]
}
atom AxisAtom(string AxisName, float Position)
{
switch ${AxisName}
{
case RP_RX
GP_Rotation:Set[${Math.Calc[(${Position}*100)-50].Int}]
GP_Axis_Changed:Set[1]
stick off
break
case RP_LY
GP_Elevation:Set[${Math.Calc[(${Position}*100)-50].Int}]
GP_Axis_Changed:Set[2]
break
case RP_LX
GP_Sideways:Set[${Math.Calc[(${Position}*100)-50].Int}]
GP_Axis_Changed:Set[3]
break
case RP_RY
GP_Forward:Set[${Math.Calc[(${Position}*100)-50].Int}]
GP_Axis_Changed:Set[4]
stick off
break
default
; echo ${AxisName} is at ${Position}
}
}
atom ButtonAtom(string ButtonName,bool Pressed)
{
switch ${ButtonName}
{
case RP_B0
case RP_B1
case RP_B2
case RP_B3
case RP_B4
case RP_B5
case RP_B6
case RP_B7
case RP_B8
case RP_B9
case RP_B10
case RP_B11
GP_Last_Changed:Set[${ButtonName}]
GP_Lastdirection:Set[${Pressed}]
GP_Button_Changed:Set[1]
break
default
; echo ${ButtonName} ${Pressed}
}
}
atom DPadAtom(string Name, float Position)
{
switch ${Name}
{
case RP_DPad
GP_DPad_Value:Set[${Position}]
GP_DPad_Changed:Set[1]
break
default
; echo DPad::${Name} ${Position}
}
}
