First at all, I am brazilian, and I did this script with my friend, who is brazilian too, please comment !
Guuuuuuuuys, I come here to show a calculator to your Ultima Online, using injection.
Tired of doing the whole time you're having to open the trade the sake of their Windows calculator?
Your troubles are over (aeuaoieuaoieuaoieue) now with this script you performs mathematical operations IN-GAME!
What it does?IN GAME performs mathematical operations, making it very easy trade at the game!How to use?Following the instructions at the beginning of the script, you type without spaces you want to do the operation by
Examples of how to do InGame:Code:
2+2
2*2
2/2
2-2
Image:Script:Code:
Sub Calc()
UO.DeleteJournal()
UO.Print('Welcome to the calculator system, by Samsung & DracoX')
UO.Print('Operations : Division \ , Plus + , Subtraction - , Multiplication * ')
Wait(500)
UO.Print('Following the example: 123+123')
var conta=TextoAlguem('self')
var i=0
var numero1=''
While MID(conta,i,1)<>'+' AND MID(conta,i,1)<>'-' AND MID(conta,i,1)<>'*' AND MID(conta,i,1)<>'/' AND Len(conta)>i
If MID(conta,i,1)=='k' then
numero1=numero1+'000'
Else
numero1=numero1+MID(conta,i,1)
End If
i=i+1
WEnd
var operador=MID(conta,i,1)
var numero2=''
While MID(conta,i,1)<>' ' AND Len(conta)>i
If MID(conta,i,1)=='k' then
numero2=numero2+'000'
Else
numero2=numero2+MID(conta,i,1)
End If
i=i+1
WEnd
If numero1=='' Then
numero1=0
Else
numero1=Str2Int(numero1)
End If
If numero2=='' Then
numero1=0
Else
numero2=Str2Int(numero2)
End If
var resultado=0
If operador=='+' Then
resultado=numero1+numero2
End If
If operador=='-' Then
resultado=numero1-numero2
End If
If operador=='*' Then
resultado=numero1*numero2
End If
If operador=='/' Then
resultado=numero1/numero2
End If
If operador<>'+' AND operador<>'-' AND operador<>'*' AND operador<>'/' Then
UO.Print('Error')
Else
UO.Print(str(numero1)+' '+operador+' '+str(numero2)+' = '+str(resultado))
End If
End Sub
;;; Converção de Texto em Número Inteiro {
##### ##### Converter Texto em Número Inteiro ##### #####
; Descrição:
; - Converte os caracteres numéricos em seus números correspondentes a ordem em que aparecem e transforma letras e outros em zeros. (Ex.: '12345' -> 12345 | '1ab45' -> 10045 | '12,21' -> 12021)
;
; Parâmetros:
; - texto = o que se quer converter em número inteiro
;
Sub Str2Int(texto)
var valor
var resultado=0
var loop1, loop2
For loop1=0 to Len(texto)-1
If MID(texto,loop1,1)=='1' Then
valor=1
Else
If MID(texto,loop1,1)=='2' Then
valor=2
Else
If MID(texto,loop1,1)=='3' Then
valor=3
Else
If MID(texto,loop1,1)=='4' Then
valor=4
Else
If MID(texto,loop1,1)=='5' Then
valor=5
Else
If MID(texto,loop1,1)=='6' Then
valor=6
Else
If MID(texto,loop1,1)=='7' Then
valor=7
Else
If MID(texto,loop1,1)=='8' Then
valor=8
Else
If MID(texto,loop1,1)=='9' Then
valor=9
Else
valor=0
End If
End If
End If
End If
End If
End If
End If
End If
End If
If loop1<Len(texto)-1 Then
For loop2=1 to Len(texto)-loop1-1
valor=valor*10
Next
End If
resultado=resultado+valor
Next
return resultado
End Sub
;;; }
;;; Texto que Alguém Disse {
##### ##### Texto que Alguém Disse ##### #####
; Descrição:
; - Retorna uma mensagem (fala) ser escrita pela pessoa cujo nome foi informado (A mensagem no journal aparece como 'Nome: Mensagem bla' e esta função retona 'Mensagem bla')
;
; Parâmetros:
; - alguem = o nome da pessoa que se deseja esperar a mensagem (fala)
;
Sub TextoAlguem(alguem)
Repeat
Wait(100)
Until UO.InJournal(UO.GetName(alguem))
var texto=UO.Journal(UO.InJournal(UO.GetName(alguem))-1)
If Len(texto)>Len(UO.GetName(alguem))+2 Then
return MID(texto,Len(UO.GetName(alguem))+2,Len(texto)-Len(UO.GetName(alguem))-2)
Else
return ''
End If
End Sub
;;; }