Page 1 of 1

Support with voice command

Posted: 2004-07-12 01:05:45
by Cerberus
Functions with voice command

To use speak:

hungrystat on = Enable hungry system, configurated for some foods
hungrystat off = disable system

autoguard on = Enable gs system, Do not use out of protection :)
autoguard off = disable system

supportwar on = Enable support of life, the system Heal with bandage and reequip weapons
supportwar off = disable system

confighands = Configure weapons/itens
preparetowar = Enable and equip weapons
stopviolence = Disable reequip weapons but keep active system of life

stopall = quit function
mystat = show status

O.o: The function voice command do not work with others character's voice ;)

Code: Select all

var ativo = 1
var protecao = 0
var suplife = 0
var armada = 1
var fome = 0

var maodi = "0"
var maoes = "0"
var nome = uo.getname()	

sub main()
	while not uo.dead()
		if (uo.life<uo.str) and (protecao==1) then
			uo.say("Guards")
			wait(4000)
		endif
		if (fome>30500) and (ativo==1) then
			comer()
			fome=0
		else
			fome=fome+1
		endif

		wait(50)
		if (uo.life<uo.str) and (suplife==1) then
			suporte(1)
			wait(1000)
		endif

		if uo.injournal(nome + ": hungrystat off",10) then
			ativo=0
			uo.print("Sistema de fome: off")
			uo.deletejournal()
		endif
		if uo.injournal(nome + ": hungrystat on",10) then
			ativo=1
			uo.print("Sistema de fome: on")
			uo.deletejournal()
		endif
		if uo.injournal(nome + ": autoguard off",10) then
			protecao=1
			uo.print("Sistema de gs: on")
			uo.deletejournal()
		endif
		if uo.injournal(nome + ": autoguard on",10) then
			protecao=0
			uo.print("Sistema de gs: off")
			uo.deletejournal()
		endif

		if uo.injournal(nome + ": supportwar off",10) then
			suplife=0
			uo.print("Sistema de life: off")
			uo.deletejournal()
		endif
		if uo.injournal(nome + ": supportwar on",10) then
			suplife=1
			uo.print("Sistema de life: on")
			uo.deletejournal()
		endif

		if uo.injournal(nome + ": confighands",10) then
			maodi = pobject("Qual arma ou item utilizar com mao direita?")
			maoes = pobject("Qual arma ou item utilizar com mao esquerda?")
			uo.deletejournal()
		endif
		if uo.injournal(nome + ": preparetowar",10) then
			suporte(2)
			armada = 1
			uo.deletejournal()
		endif
		if uo.injournal(nome + ": stopviolence",10) then
			suporte(3)
			armada = 0
			uo.deletejournal()
		endif
		if uo.injournal("accept itens",1) then
			uo.lclick(65,44)
			uo.deletejournal()
		endif

		if uo.injournal(nome + ": stopall",10) then
			goto Fimditudo
		endif
		if uo.injournal(nome + ": mystat",10) then
			if (ativo==1) then
				uo.print("Sistema de fome: ativado")
			endif
			if (ativo==0) then
				uo.print("Sistema de fome: desativado")
			endif
			if (protecao==1) then
				uo.print("Sistema  de  gs: ativado")
			endif
			if (protecao==0) then
				uo.print("Sistema  de  gs: desativado")
			endif
			if (suplife==1) then
				uo.print("Sistema de Life: ativado")
			endif
			if (suplife==0) then
				uo.print("Sistema de Life: desativado")
			endif
			if (armada==0) then
				uo.print("      Armar auto: desativado")
			endif
			if (armada==1) then
				uo.print("      Armar auto: ativado")
			endif
			uo.deletejournal()
		endif
	wend

Fimditudo:
end sub 

sub comer()
	## Frango
	uo.findtype("0x09B7")
	if uo.findcount() > 0 then
		uo.usetype("0x09B7")
		goto Fimfome
	endif

	## Ribs
	uo.findtype("0x09F2")
	if uo.findcount() > 0 then
		uo.usetype("0x09F2")
		goto Fimfome
	endif

	## File de Peixe
	uo.findtype("0x097B")
	if uo.findcount() > 0 then
		uo.usetype("0x097B")
		goto Fimfome
	endif

	## Ovo
	uo.findtype("0x09B6")
	if uo.findcount() > 0 then
		uo.usetype("0x09B6")
		goto Fimfome
	endif

	## Baconzao
	uo.findtype("0x09C9")
	if uo.findcount() > 0 then
		uo.usetype("0x09C9")
		goto Fimfome
	endif

	## Paozinho redondo
	uo.findtype("0x103B")
	if uo.findcount() > 0 then
		uo.usetype("0x103B")
		goto Fimfome
	endif

Fimfome:
end sub

sub suporte(x)
	if x==1 then
		## Verifica si tem bands e usa
		uo.findtype("0x0E21")
		if uo.findcount() > 0 then
			uo.exec("bandageself")
			wait(600)

			#rearmar as maos si tiver
			if (maodi<>"0") and (armada==1) then
				uo.useobject(maodi)
				wait(100)
				# uo.canceltarget()
				uo.press(0x1B)
				wait(50)
			endif
			if (maoes<>"0") and (armada==1) then
				uo.useobject(maoes)
				wait(100)
				# uo.canceltarget()
				uo.press(0x1B)
				wait(50)
			endif
			
			wait(3000)
		endif
	endif
	
	if x==2 then
		#rearmar as maos si tiver
		if maodi<>"0" then
			uo.useobject(maodi)
			wait(50)
			# uo.canceltarget()
			uo.press(0x1B)
			wait(50)
		endif
		if maoes<>"0" then
			uo.useobject(maoes)
			wait(50)
			#uo.canceltarget()
			uo.press(0x1B)
			wait(50)
		endif
	endif

	if x==3 then
		uo.moveitem(maodi)
		wait(50)
		uo.moveitem(maoes)
		wait(50)
	endif
end sub

sub pobject(s) 
	var needserial = 1 
    uo.exec("addobject frase")
	uo.print(s)
   	while uo.targeting() 
   		wait(100)
   	wend 
   	if uo.getserial("frase") <> "0x00000000" then 
   		return uo.getserial("frase")
   	else
   		return "0"
  	endif
end sub