TinTin++ Mud Client The TinTin++ message board

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
TinTin++ Mud Client

Tintin++ MySQL database integration

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Finished Scripts
View previous topic :: View next topic  
Author Message
k00pa



Joined: 17 Dec 2008
Posts: 9

PostPosted: Thu Dec 25, 2008 5:21 am    Post subject: Tintin++ MySQL database integration Reply with quote

So I build python script and tintin++ triggers that sends monsters that you kill and stuff that you sell to MySQL database.

I put it to my website.

http://www.pelikoira.net/index_en.php
_________________
___!!___
Back to top
View user's profile Send private message
atraeyu



Joined: 12 Dec 2007
Posts: 165

PostPosted: Sun Jan 19, 2014 3:38 pm    Post subject: Reply with quote

It looks like that page was taken down. Is this still available anywhere?
Back to top
View user's profile Send private message AIM Address
Dorien



Joined: 26 Jul 2012
Posts: 2

PostPosted: Tue Feb 11, 2014 7:11 am    Post subject: Reply with quote

Back to top
View user's profile Send private message
atraeyu



Joined: 12 Dec 2007
Posts: 165

PostPosted: Tue Feb 11, 2014 8:32 am    Post subject: Reply with quote

It's only four years! Smile
Back to top
View user's profile Send private message AIM Address
dorian



Joined: 29 Jul 2012
Posts: 66

PostPosted: Fri Apr 21, 2017 4:12 pm    Post subject: Reply with quote

i have found this Smile

Code:


#CLASS {cDBConnector} {kill};
#CLASS {cDBConnector} {open};

#NOP /********************************************************************/;
#NOP /* Generic MySQL Database Connector                                 */;
#NOP /* By Balthus - 8th March 2010                                      */;
#NOP /*                                                                  */;
#NOP /* db_submit works the same way as #FORMAT                          */;
#NOP /*                                                                  */;
#NOP /* db_submit {returnvar}                                            */;
#NOP /* {select * from tablename where fieldname = '%s'} {match text}    */;
#NOP /*                                                                  */;
#NOP /* Parses the output and puts it into an associative array:         */;
#NOP /* $returnvar[recordnumber][fieldname]                              */;
#NOP /*                                                                  */;
#NOP /* E.G. to get the data from HP field of the first record returned: */;
#NOP /* #VAR {varname} {$returnvar[1][HP]}                               */;
#NOP /*                                                                  */;
#NOP /********************************************************************/;

#NOP **** Database Connection Info ****;
#VAR {dbSettings[user]} {codex};
#VAR {dbSettings[pass]} {zaq12wsx};
#VAR {dbSettings[database]} {arkadia};
#VAR {dbSettings[server]} {127.0.0.1};

#NOP **** Constants ****;
#FORMAT {dbSettings[tab]} {%a} {9};

#ALIAS {db_submit}
{
    #IF {"%0" != ""}
    {
        #VAR {db} {};

        #NOP /* Start constructing #FORMAT command to construct full SQL query string */;
        #VAR {dbFormat} {#FORMAT {db[Command]} {%2}};
        #VAR {db[Count]} {0};

        #NOP /* Parse parameters 3->n, remove quotes, and append to #FORMAT command string */;
        #FOREACH {%0} {db[Temp]}
        {
            #MATH {db[Count]} {$db[Count] + 1};
            #IF {$db[Count] > 2}
            {
                #REPLACE {db[Temp]} {"} {'};
                #REPLACE {db[Temp]} {'} {''};
                #IF {"$db[Temp]" != ""}
                {

                    #VAR {dbFormat} {${dbFormat}{${db[Temp]}}};
                };
            };
        };

        #NOP /* Perform built #FORMAT command to construct full SQL command in db[Command] */;
        ${dbFormat};

        #NOP /* Send constructed SQL command to the database, collecting returned raw output (if any) into db[Return] */;
        #SCRIPT {db[return]} {mysql -h${dbSettings[server]} -u${dbSettings[user]} -p${dbSettings[pass]} -D${dbSettings[database]} -Be "${db[Command]}"};

        #VAR {db[output]} {};
        #VAR {db[temp]} {};

        #NOP /* Loop through returned tab-delimited records (if any) and process */;
        #FOREACH {$db[return][]} {i}
        {
            #VAR {db[fieldindex]} {0};
            #MATH {db[recordindex]} {$i - 1};

            #NOP /* Loop through every character in the current record...split into fields on tab */;
            #PARSE {$db[return][$i]} {j}
            {
                #IF {"$j" == "$dbSettings[tab]"}
                {
                    #MATH {db[fieldindex]} {$db[fieldindex] + 1};

                    #NOP /* If its the first record (header record) set the field names */;
                    #NOP /* Otherwise populate the field contents                       */;
                    #IF {$i == 1}
                    {
                        #VAR {db[fields][$db[fieldindex]]} {$db[temp]};
                    }
                    {
                        #VAR {db[output][$db[recordindex]][$db[fields][$db[fieldindex]]]} {$db[temp]};
                    };
                    #VAR {db[temp]} {};
                }
                {
                    #VAR {db[temp]} {$db[temp]${j}};
                };
            };

            #NOP /* Process the data remaining after the last tab on a record */;
            #MATH {db[fieldindex]} {$db[fieldindex] + 1};
            #IF {$i == 1}
            {
                #VAR {db[fields][$db[fieldindex]]} {$db[temp]};
            }
            {
                #VAR {db[output][$db[recordindex]][$db[fields][$db[fieldindex]]]} {$db[temp]};
            };
            #VAR {db[temp]} {};
        };
        #IF {"%1" != ""}
        {
            #VAR {%1} {$db[output]};
        };
        #UNVAR {db};
        #UNVAR {dbFormat};
    };
};

#CLASS {cDBConnector} {close};
Back to top
View user's profile Send private message
PowerGod



Joined: 04 Aug 2014
Posts: 339

PostPosted: Fri Apr 21, 2017 4:20 pm    Post subject: Reply with quote

"It's only three years !" Coffee
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Finished Scripts All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads
TinTin++ Homepage

Powered by phpBB © 2001, 2002 phpBB Group