FFXI "Auto-Translate" Snippet — File Browser
FFXIAuto-TranslateSnippetv1.0 / FFXIAuto-TranslateSnippetv1.0 / auto-translate.mrc
auto-translate.mrc — 2.61 KB — Download this file
;Allow for cycling of ATs
;Allow for normal tabcomps to be done multiple times first
;ie. if new tabcomp wasn't the same as the old tabcomp
;Alphabetical order
;Remove categories
;unload - remove variables4
;; When changing to a NEW one that would be auto-completed... reset and allow
alias -l ffxi-at {
if ($2 !isnum) return
var %i = 1 , %match = 0
var %ffxi-mt
while ((%match < $2) && ($read($scriptdirffxi-translate.txt,w,$1 $+ *,%i))) {
%ffxi-mt = $v1
%i = $calc($readn + 1)
inc %match
}
if (%match == $2) return %ffxi-mt
return
}
;Replaced has color codes... use that
on ^*:TABCOMP:*: {
if (!$1) return
if ($halted) return
if (!%ffxi-nt) set %ffxi-nt 1
var %line = $editbox($target,$iif($cmdbox,1,0)) , %pos = $editbox($target,$iif($cmdbox,1,0)).selstart
var %tnum = $numtok($left(%line,%pos),32)
var %term = $strip($gettok(%line,%tnum,32))
var %oldtn = $calc(%tnum - %ffxi-nt + 1)
;Tab completion wasn't done before, allow it. Or it is a new term
if ((!%ffxi-at) || (%ffxi-at-tnum != %tnum)) {
set %ffxi-at 1
set %ffxi-at-term %term
set %ffxi-at-tnum %tnum
set %ffxi-nt 1
set %ffxi-at-ignore 1
return
}
set %ffxi-rep $ffxi-at(%ffxi-at-term,%ffxi-at)
if (%ffxi-rep) editbox $iif($cmdbox,-ao,-a) $puttok(%line,9< $+ %ffxi-rep $+ 4>,%tnum,32)
inc %ffxi-at
set %ffxi-nt $numtok(%ffxi-rep,32)
haltdef
}
on *:TABCOMP:*: {
;Tab comp was allowed from the ^ event: return.
if (%ffxi-at-ignore) {
unset %ffxi-at-ignore
return
}
if (!$1) { unset %ffxi-at | return }
if ($halted) { unset %ffxi-at | return }
if (!%ffxi-nt) set %ffxi-nt 1
var %line = $editbox($target,$iif($cmdbox,1,0)) , %pos = $editbox($target,$iif($cmdbox,1,0)).selstart
var %tnum = $numtok($left(%line,%pos),32)
var %term = $strip($gettok(%line,%tnum,32))
var %oldtn = $calc(%tnum - %ffxi-nt + 1)
;Space after last word
if (!$mid(%line,$calc(%pos - 1),1)) {
unset %ffxi-at
return
}
if ((!%ffxi-at) || (%ffxi-at-tnum != $calc(%tnum - %ffxi-nt + 1)) || (< $+ %ffxi-at-term $+ * !iswm $strip($gettok(%line,%oldtn $+ - $+ %tnum,32)))) {
set %ffxi-at 1
set %ffxi-at-term %term
set %ffxi-at-tnum %tnum
set %ffxi-nt 1
%oldtn = %tnum
}
set %ffxi-rep $ffxi-at(%ffxi-at-term,%ffxi-at)
if (%ffxi-rep) {
editbox $iif($cmdbox,-ao,-a) $instok($deltok(%line,%oldtn $+ - $+ %tnum,32),9< $+ %ffxi-rep $+ 4>,%oldtn,32)
inc %ffxi-at
set %ffxi-nt $numtok(%ffxi-rep,32)
}
}
on *:INPUT:*: unset %ffxi-?t* %ffxi-rep
on *:ACTIVE:*: unset %ffxi-?t* %ffxi-rep