Jump to content

[LE] Need help with Shout by script


irswat

Recommended Posts

A little bit of over doing it in your first while loop (post above). It can be reduced down to the following:

ShoutLoop = 0
while (ShoutLoop <= 3)
	ShoutLoop += 1

	WordFromShoutCMDArray = ShoutCmdArray[ShoutLoop]
	WordFromShoutCMDForm = ShoutCmdForm[ShoutLoop].GetName()
	
	if WordFromShoutCMDArray == WordFromShoutCMDForm
		ShoutCmdCheck[ShoutLoop] = true
		debug.trace("WordFromShoutCMDArray: " + WordFromShoutCMDArray + " equals WordFromShoutCMDForm " + WordFromShoutCMDForm)
	else
		ShoutCmdCheck[ShoutLoop] = false
		debug.trace("WordFromShoutCMDArray: " + WordFromShoutCMDArray + " does not equal WordFromShoutCMDForm " + WordFromShoutCMDForm)
		ShoutLoop = 4
	endif
	
endWhile

Changing the ShoutLoop initial value to 0 and moving the + 1 addition to the beginning of the while loop can help to ensure that the value is correct when it loops around.

 

Also keep in mind that all of the debug.trace statements take up time and drag the code out. It could be possible that while the statements are still being written that the values have changed and not yielding the correct results. A reduction of trace statements (perhaps from already working portions) may have an effect. Who knows for sure without testing...

Link to comment
Share on other sites

FIXED!

 

 

[11/22/2016 - 06:16:16PM] Thuum CMD detected

[11/22/2016 - 06:16:16PM] PARSING WORD: Fus at iItemFound 76
[11/22/2016 - 06:16:16PM] Index of shout form 25
[11/22/2016 - 06:16:16PM] Name of shout: Unrelenting Force
[11/22/2016 - 06:16:16PM] ShoutForm:[shout < (00013E07)>]
[11/22/2016 - 06:16:16PM] Current word of power: [WordOfPower < (00013E22)>]
[11/22/2016 - 06:16:16PM] Current word of power: Fus
[11/22/2016 - 06:16:16PM] Current word of power: [WordOfPower < (00013E23)>]
[11/22/2016 - 06:16:16PM] Current word of power: Ro
[11/22/2016 - 06:16:16PM] Current word of power: [WordOfPower < (00013E24)>]
[11/22/2016 - 06:16:16PM] Current word of power: Dah
[11/22/2016 - 06:16:16PM] Word: Fus ShoutiCheck: 19.000000 ;as int: 19 . Word 1
[11/22/2016 - 06:16:16PM] PARSING WORD: Ro at iItemFound 77
[11/22/2016 - 06:16:16PM] Word: Ro ShoutiCheck: 38.000000 ;as int: 38 . Word 2
[11/22/2016 - 06:16:16PM] PARSING WORD: Dah at iItemFound 78
[11/22/2016 - 06:16:16PM] Word: Dah ShoutiCheck: 26.000000 ;as int: 26 . Word 3
[11/22/2016 - 06:16:16PM] ShoutLoop: 1. WordFromShoutCMDArray: Fus equals WordFromShoutCMDForm Fus
[11/22/2016 - 06:16:16PM] Iterating ShoutLoop
[11/22/2016 - 06:16:16PM] ShoutLoop: 2. WordFromShoutCMDArray: Ro equals WordFromShoutCMDForm Ro
[11/22/2016 - 06:16:16PM] Iterating ShoutLoop
[11/22/2016 - 06:16:16PM] ShoutLoop: 3. WordFromShoutCMDArray: Dah equals WordFromShoutCMDForm Dah
[11/22/2016 - 06:16:16PM] Iterating ShoutLoop
[11/22/2016 - 06:16:16PM] Adjusting ShoutLoop for use. Adjusted: 3
[11/22/2016 - 06:16:16PM] Detected valid word of power 1
[11/22/2016 - 06:16:16PM] Detected valid word of power 2
[11/22/2016 - 06:16:16PM] Detected valid word of power 3
[11/22/2016 - 06:16:16PM] Command parser test complete in 0.000361 seconds.

 



The first problem was caused by a stupid typo in the clumsy code I posted earlier.
The second problem was caused by Input.HoldKey not working with mouse buttons. I remapped the shout command to a random key and the function now works! Sweet.

Engine now successfully parses Equip weapons/armor including hand, using potions and venoms including number (e.g. use 5 minor potions of healing), and now Shouts.

I'm dreading the next part...spells

Link to comment
Share on other sites

A little bit of over doing it in your first while loop (post above). It can be reduced down to the following:

ShoutLoop = 0
while (ShoutLoop <= 3)
	ShoutLoop += 1

	WordFromShoutCMDArray = ShoutCmdArray[ShoutLoop]
	WordFromShoutCMDForm = ShoutCmdForm[ShoutLoop].GetName()
	
	if WordFromShoutCMDArray == WordFromShoutCMDForm
		ShoutCmdCheck[ShoutLoop] = true
		debug.trace("WordFromShoutCMDArray: " + WordFromShoutCMDArray + " equals WordFromShoutCMDForm " + WordFromShoutCMDForm)
	else
		ShoutCmdCheck[ShoutLoop] = false
		debug.trace("WordFromShoutCMDArray: " + WordFromShoutCMDArray + " does not equal WordFromShoutCMDForm " + WordFromShoutCMDForm)
		ShoutLoop = 4
	endif
	
endWhile

Changing the ShoutLoop initial value to 0 and moving the + 1 addition to the beginning of the while loop can help to ensure that the value is correct when it loops around.

 

Also keep in mind that all of the debug.trace statements take up time and drag the code out. It could be possible that while the statements are still being written that the values have changed and not yielding the correct results. A reduction of trace statements (perhaps from already working portions) may have an effect. Who knows for sure without testing..

thanks. it is the way it is, including the conditional iteration, because the next while loop uses LoopCounter as a measure of how many consecutive and valid words of power have been issued.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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