{"id":149,"date":"2009-09-15T10:14:33","date_gmt":"2009-09-15T08:14:33","guid":{"rendered":"http:\/\/blog.ansuz.nl\/?p=149"},"modified":"2009-09-15T10:14:33","modified_gmt":"2009-09-15T08:14:33","slug":"bfh-random-tip","status":"publish","type":"post","link":"http:\/\/blog.ansuz.nl\/index.php\/2009\/09\/15\/bfh-random-tip\/","title":{"rendered":"BF:H Random tip"},"content":{"rendered":"<p>Whenever you join a BatlleField: Heroes server a &#8216;Tip of the day&#8217; is displayed. I was wondering where I could find all the tips and if anybody had already done something with them (i.e. create a service to get a random tip).<\/p>\n<p>I couldn&#8217;t find anything after a Google search, so I started looking around. It turns out that all in game copy is stored in a file called &#8216;<em>strings.csv<\/em>&#8216;. If you have BF:Heroes installed in the default location, you can find it here: &#8216;<em>C:\\Program Files\\EA Games\\Battlefield Heroes\\mods\\bfheroes\\Localization<\/em>&#8216;. This file is a comma separated values file which you can open with Notepad and even Excel.<\/p>\n<p>The bits I needed to have tips displayed are the rows starting with &#8216;<em>WEST_FE_Loading_tip_ingress_<\/em>&#8216; and &#8216;<em>WEST_FE_Loading_tip_text_<\/em>&#8216;. What I&#8217;ve done for now is copy those fields over into an XML file: <a href=\"http:\/\/ansuz.nl\/php_lib\/bfheroes\/tipoftheday.xml\" target=\"_blank\">http:\/\/ansuz.nl\/php_lib\/bfheroes\/tipoftheday.xml<\/a>. I guess a next step could be a little script (or AIR application) that takes the &#8216;<em>scripts.csv<\/em>&#8216; file and converts it to XML in the format I need.<\/p>\n<p>I then created a small PHP script to load the XML file and display a random quote, see here: <a href=\"http:\/\/ansuz.nl\/php_lib\/bfheroes\/tip.php?method=randomTip\" target=\"_blank\">http:\/\/ansuz.nl\/php_lib\/bfheroes\/tip.php?method=randomTip<\/a><br \/>\nThe first line is the &#8216;tip header&#8217;, the second the &#8216;tip body&#8217;. Both are wrapped in a &#8216;span&#8217;-tag with a unique class name so you can style it the way you want.<\/p>\n<p>The final bit I did is loading a random tip on a site with my BF:H stats and applying some styling to it: <a href=\"http:\/\/ansuz.nl\/bla\/bfheroes\/\" target=\"_blank\">http:\/\/ansuz.nl\/bla\/bfheroes\/<\/a>.<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>Whenever you join a BatlleField: Heroes server a &#8216;Tip of the day&#8217; is displayed. I was wondering where I could find all the tips and if anybody had already done something with them (i.e. create a service to get a &hellip; <a href=\"http:\/\/blog.ansuz.nl\/index.php\/2009\/09\/15\/bfh-random-tip\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,3],"tags":[],"class_list":["post-149","post","type-post","status-publish","format-standard","hentry","category-html","category-php"],"_links":{"self":[{"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/posts\/149","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/comments?post=149"}],"version-history":[{"count":4,"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/posts\/149\/revisions"}],"predecessor-version":[{"id":154,"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/posts\/149\/revisions\/154"}],"wp:attachment":[{"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/media?parent=149"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/categories?post=149"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/tags?post=149"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}