Jump to content

Seeking Script Extender Advice


Recommended Posts

I'm about to start writing scripts using script extender and I was testing functions. This particular script is meant for tracking if a player is staring down an NPC by tracking there crosshairs using the "xGetPCTarget" function. Can anyone tell me why I keep getting 1 error and where it is? I am using MWEdit version 0.6.1 which I downloaded from Sourceforge. http://sourceforge.net/projects/mwedit/files/mwedit/v0.6.1%20-%20Minor%20Update/

=================================================================================================================
CODE:

=================================================================================================================

begin _SETest

float staretimer
long pctarget
short mode
short scripthasstarted
short IsPlayerStaring
short combatstatus

if ( MenuMode == 1 )
return
endif

if ( scripthasstarted != 1 )
set scripthasstarted to 1
set mode to 0
endif

if ( mode == 0 )
if ( pctarg == 0 )
set mode to 1
set IsPlayerStaring to 0
endif
if ( IsPlayerStaring == 1 )
set staretimer to ( staretimer + GetSecondsPassed )
if ( staretimer > 10 )
set combatstatus to 1
set staretimer to 0
"_BM_B1"->StartCombat, Player
set mode to 2
endif
if ( GetDistance, "_BM_B1" < 125 )
set mode to 1
setx pctarget to xGetPCTarget
if ( pctarget == 0 )
set staretimer to 0
set mode to 1
set IsPlayerStaring to 0
endif
if ( pctarget != "_BM_B1" )
set staretimer to 0
set mode to 1
set IsPlayerStaring to 0
endif
if ( pctarget == "_BM_B1" )
set staretimer to ( staretimer + GetSecondsPassed )
set IsPlayerStaring to 1
set mode to 2
endif
endif
if ( GetDistance, "_BM_B1" > 500 )
set staretimer to ( staretimer + GetSecondsPassed )
if ( staretimer > 10 )
set combatstatus to 1
set staretimer to 0
"_BM_B1"->StartCombat, Player
set mode to 2
endif
set mode to 1
setx pctarget to xGetPCTarget
if ( pctarget == 0 )
set staretimer to 0
set IsPlayerStaring to 0
set mode to 1
endif
if ( pctarget != "_BM_B1" )
set staretimer to 0
set IsPlayerStaring to 0
set mode to 1
endif
if ( pctarget == "_BM_B1" )
set staretimer to ( staretimer + GetSecondsPassed )
set IsPlayerStaring to 1
set mode to 1
endif
endif
endif
if ( IsPlayerStaring != 1 )
set IsPlayerStaring to 0
set staretimer to 0
set mode to 1
endif
endif

if ( mode == 1 )
if ( pctarget == 0 )
set mode to 0
set IsPlayerStaring to 0
endif
if ( IsPlayerStaring == 1 )
set staretimer to ( staretimer + GetSecondsPassed )
if ( staretimer > 10 )
set combatstatus to 1
set staretimer to 0
"_BM_B1"->StartCombat, Player
set mode to 2
endif
if ( GetDistance, "_BM_B1" < 125 )
set mode to 0
setx pctarget to xGetPCTarget
if ( pctarget == 0 )
set staretimer to 0
set mode to 0
set IsPlayerStaring to 0
endif
if ( pctarget != "_BM_B1" )
set staretimer to 0
set mode to 0
set IsPlayerStaring to 0
endif
if ( pctarget == "_BM_B1" )
set staretimer to ( staretimer + GetSecondsPassed )
set IsPlayerStaring to 1
set mode to 0
endif
endif
if ( GetDistance, "_BM_B1" > 500 )
set staretimer to ( staretimer + GetSecondsPassed )
if ( staretimer > 10 )
set combatstatus to 1
set staretimer to 0
"_BM_B1"->StartCombat, Player
set staretimer to 0
set mode to 2
endif
set mode to 1
setx pctarget to xGetPCTarget
if ( pctarget == 0 )
set staretimer to 0
set IsPlayerStaring to 0
set mode to 0
endif
if ( pctarget != "_BM_B1" )
set staretimer to 0
set IsPlayerStaring to 0
set mode to 0
endif
if ( pctarget == "_BM_B1" )
set staretimer to ( staretimer + GetSecondsPassed )
set IsPlayerStaring to 1
set mode to 0
endif
endif
endif
if ( IsPlayerStaring != 1 )
set IsPlayerStaring to 0
set staretimer to 0
set mode to 0
endif
endif

if ( mode == 2 )
if ( GetDistance, "_BM_B1" < 125 )
if ( combatstatus == 1 )
set mode to 3
endif
if ( combatstatus == 0 )
set IsPlayerStaring to 0
set mode to 0
endif
endif
if ( GetDistance, "_BM_B1" > 700 )
if ( combatstatus == 1 )
set IsPlayerStaring to 0
"_BM_B1"->StopCombat
set combatstatus to 0
set mode to 0
endif
if ( combatstatus == 0 )
set IsPlayerStaring to 0
set mode to 0
endif
endif
endif

if ( mode == 3 )
if ( GetDistance, "_BM_B1" < 125 )
if ( combatstatus == 1 )
set IsPlayerStaring to 0
set mode to 2
endif
if ( combatstatus == 0 )
set IsPlayerStaring to 0
set mode to 0
endif
endif
if ( GetDistance, "_BM_B1" > 700 )
if ( combatstatus == 1 )
"_BM_B1"->StopCombat
set IsPlayerStaring to 0
set combatstatus to 0
set mode to 2
endif
if ( combatstatus == 0 )
set IsPlayerStaring to 0
set mode to 2
endif
endif
endif

end _SETest

=================================================================================================================
CODE END

=================================================================================================================

Edited by Skibidyboparoobopadopa
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...