www.ClassicTW.com
https://mail.black-squirrel.com/

WORKING ON A NEW SCRIPT PROJECT
https://mail.black-squirrel.com/viewtopic.php?f=15&t=25272
Page 1 of 1

Author:  Yop_Solo [ Thu Dec 17, 2009 12:07 am ]
Post subject:  WORKING ON A NEW SCRIPT PROJECT

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.

Author:  Promethius [ Thu Dec 17, 2009 1:46 am ]
Post subject:  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

Author:  Yop_Solo [ Thu Dec 17, 2009 10:34 pm ]
Post subject:  Re: WORKING ON A NEW SCRIPT PROJECT

Thanks you, i will try that I give a feedback.

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/