Edit paths in #scripts to point into location where you'll save the two php-files on this page.
#alias {.login} { #script {php ./fl/php/load_prefs.php $character}; #script {php ~/fl/php/start_logger.php $character}; #read ./fl/tickers; } #action {^([Q]uit) Enter Aabahran with which Name?> $} {#alias {%*} {#var {character} {%%1};#send %%1}} #action {^Password?> $} {#unalias {%%*}} #action {^Prepare yourself. For you are about to <Enter> the Forsaken Lands!$} { .login; #unaction {^([Q]uit) Enter Aabahran with which Name?> $}; #unaction {^Password?> $}; }
Content of load_prefs.php:
Edit $main_path to point into location where you have files you use to load into Tintin++.
Debug-option also expects that you run the script from path under location where your files reside (in my case, /home/f-3000/fl/php/).
If you don't like the container-stuff in the script, just delete it or comment it out.
<?php // if you call this file with debug as second argument, you'll get content that suits terminal (useful for checking that everything works dandy) (i.e. php load_prefs.php charname debug) // this is where YOUR tintin-files reside $main_path="/home/f-3000/fl/"; if(!isset($argv[1]))die("#showme load_prefs.php -> Missing argument 1! (character name);"); $path="$main_path/prefs_".$argv[1]; if(isset($argv[2])&&$argv[2]==="debug"){ $path="../prefs_".$argv[1]; define("N","\n"); }else{ define("N",";"); } echo "#var {prefs_loaded} {1}".N; @$haku=file($path,FILE_IGNORE_NEW_LINES); if($haku===false)die("#showme load_prefs.php -> Preferences file for {$argv[1]} not found!".N); echo "#showme loading prefs...".N; echo "#read $path".N; $class=false; $data=array( 'class'=>'', 'weapon'=>'', 'instrument'=>'', 'projectile'=>'', 'prefs'=>'', ); foreach($haku as $item){ $exped=explode("{",$item,2); $exped=explode("}",$exped[1],2); switch($exped[0]){ case 'containers': $exped=explode("}{",trim(rtrim($exped[1],"} "),"{ ")); $data['containers']=array(); for($a=0;$a<count($exped);$a++){ $b=$a+1; $data['containers'][$exped[$a]]=$exped[$b]; $a=$b; } break; case 'class': $class=trim(rtrim($exped[1]," }")," {"); break; } } // check if class is empty, so we can blame prefs-file if it's lacking! if($class===false) { die("#showme Prefs-file did not contain class-variable! Aborting...".N); } if($class==="") { die("#showme Class-variable was empty in prefs-file! Aborting...".N); } // build container-stuff... $container_help=array("#showme <caf>Containers:"); if(isset($data['containers'])){ $main_containers=array("2","6","0"); // some day prefs should contain these... $container_help=array(); foreach($data['containers'] as $key => $item){ echo "#var {containers[$key]} {".$item."}".N; echo "#alias {"."$key} {get %0 \$containers[$key]}".N; echo "#alias {"."$key$key} {put %0 \$containers[$key]}".N; $star="*"; if(!in_array($key,$main_containers))foreach($main_containers as $cont){ echo "#alias {"."$cont$key} {get \$containers[$key] \$containers[$cont];get %0 \$containers[$key];put \$containers[$key] \$containers[$cont];}".N; echo "#alias {"."$cont$key$key} {get \$containers[$key] \$containers[$cont];put %0 \$containers[$key];put \$containers[$key] \$containers[$cont];}".N; $star=""; } $container_help[]="#showme <caf>containers[$key] = $item $star"; } } $container_help=implode(";",$container_help); echo "#alias {.help_containers} {".$container_help."}".N; // end container-stuff // load class-based files... echo "#showme Reading class ($class) based stuff...".N; $path="$main_path/class_based_stuff/$class/"; exec("ls $path",$list); foreach($list as $item){ if(strpos($item,"~")!==false)continue; echo "#read $path$item".N; } // Load character-based settings... $c=ucfirst($argv[1]); $file="$main_path/stuff/$c/settings"; if(file_exists($file)){ echo "#read $file".N; } //echo '#if {$affects_connected} {#chat message affects {class: $class}}'.N; ?>
Content of start_logger.php
Edit $path to point into location where you save your logs.
<?php // this is where your FL log-files reside... $path="/home/f-3000/fl/logs/"; $date=date("m-d"); $file=$path.date("Y")."/".$argv[1]."_$date"; echo '#log {a} {'.$file.'};'; echo '#showme <818>Logging to file "'.$argv[1].'_'.$date.'" ...;'; ?>
Here is an example of prefs-file content:
Prefs-file name is in format prefs_charname.
#VARIABLE {class} {adventurer} #VARIABLE {containers} {{2}{'backpack'}{3}{cow}{4}{bag}{5}{knapsack}{6}{quiver}{7}{sack}{8}{satchel}{9}{keg}} #VARIABLE {dualweapon} {} #VARIABLE {emote_prefs} {{search_from}{a sack}{takeout}{}} #VARIABLE {instrument} {} #VARIABLE {offhand} {shield} #VARIABLE {prefs} {{ap_coin}{on}{ap_slab}{on}{auto_pickup}{on}{dirt}{off}{disarm}{off}{trip}{off}{where}{1}} #VARIABLE {projectile} {arrow} #VARIABLE {weapon} {sub}
Preferences can be saved with Logout script.