*.txt problem
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

*.txt problem

Started by gathering, 15 December, 2004, 16:01:37

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

gathering

got a problem is thare away to meke ptokax writ the nick on a person if the text is from a txt file

Herodes

sure there is ..
Nightlitch used smth like
gsub(text, strfind(text, ("regexp_for_string_to_find")), user.sName)

in his Advanced MOTD script ..

gathering

whare shall i write it???

Herodes

what is your text file like ?

gathering

A  
                    < * >                                                             *
 *                  /.-.\         *                   *                  *
          *         /&\                    *
                 ,@.*;@,                                        *                     *                  *
                  /_o.I \    *      
               / ;--.  ,__  ')             *                               *                  *                   *
             ;@ o O,* ' &\
           *  ( '--)_@ ;o ()\      *                 *              Merry Christmas
            / ;--._ ''--._O'@;                                 and a happy new year          *
           /&*,() o ;-.,_  "" )                                    to  all on SVCD                   *
          / ,@ ;+& () o* ;-';\                                
         ( ""--.,_0 +@' &()\                       *                          
         /-.,_      ''--....-' )  *                                                                           *
   *    /@o :;'--,.__   __.'\                                                        *
     ;*,&(); @ &^;  " o;@();         *                   *                  
     /(); o^ ; & ().o@*& ;&\                                              *
   "="==""==,,,.,="=="==="                                          
  __.----.(\-''#####---...___...-----


like this

Herodes

to start with,.. ascii art text isnt the best thing to match a regular expression ... it was too many characters you will need so that you can signal what text is to be replaced ...

Anyway this is the principle to follow...

consider this string :  
str = "Mery Christmas [user]"

If I want to replace "[user]" with my nick "Herodes" I would need to do  this :
str = gsub( str, strfind(str, "%[user%]", "Herodes" )

now the variable str will return :
str = "Merry Christmas Herodes"

gathering

this has to be put in a .lua file right?

bastya_elvtars

what that all shouldlook like? i do not understand at all.
Everything could have been anything else and it would have just as much meaning.

gathering

I just need to get the nick from a user when he is writing the CMD for the *.txt file

like this


going to the toilet

going to the toilet

just like that i need the CMD to put in the TXT file

SMF spam blocked by CleanTalk