
Re: WORKING ON A NEW SCRIPT PROJECT
Yop_Solo wrote:
Hi,
I'm working on a new project and I would like to do a GetCurrentline but if there are numbers or symbole like < ! or anything i would like to strip, how should I proceed... Do a big strip with each character... i pray that is not the way i need to do it...
Example of my script : my script take the $FIRSTNAME AND $LASTNAME.
But some players don't use a last name for their character, so the next word or characters after the name there is the <#34> or any player's serial in tw2002.
I Would like that my script take always the $FIRSTNAME and if it's not <#22>, take the $LASTNAME with a real last name "character's last name"...
So if you follow my though, I will be please to evict that situation : $FIRSTNAME = BOB $LASTNAME = <#22>
So when you do echo "Hi " & $FIRSTNAME & " " & $LASTNAME & "."
It's not written : Hi BOB <#22>. ....
i would like to have : Hi BOB.
Someone help me please.
k, I am guessing that you are writing a script that is working in T-Edit directly with the user record. The following might work - not sure as I didn't test completely.
Code:
waitfor "Userfile record"
setTextLineTrigger userName :userName "<A> Name"
pause
:userName
cutText currentline $dirtyName 20 999
getword $dirtyName $temp 1
setVar $name ""
setVar $i 2
while ($temp <> 0)
getword $dirtyName $temp $i
getwordpos $temp $pos "(#"
if ($pos > 0)
setVar $temp 0
else
setVar $name $name & $temp & " "
end
add $i 1
end
echo ansi_12 $name
or maybe simply
Code:
waitfor "Userfile record"
setTextLineTrigger userName :userName "<A> Name"
pause
:userName
getwordpos currentline $pos "(#"
cutText currentline $name 22 ($pos - 22)
echo ansi_12 $name
_________________
/ Promethius / Enigma / Wolfen /
"A man who has no skills can be taught, a man who has no honor has nothing."