Deprecated: Function set_magic_quotes_runtime() is deprecated in /customers/stein-ivar.net/stein-ivar.net/httpd.www/textpattern/lib/txplib_db.php on line 14

Warning: Cannot modify header information - headers already sent by (output started at /customers/stein-ivar.net/stein-ivar.net/httpd.www/textpattern/lib/txplib_db.php:14) in /customers/stein-ivar.net/stein-ivar.net/httpd.www/textpattern/lib/txplib_misc.php on line 1625

Warning: Cannot modify header information - headers already sent by (output started at /customers/stein-ivar.net/stein-ivar.net/httpd.www/textpattern/lib/txplib_db.php:14) in /customers/stein-ivar.net/stein-ivar.net/httpd.www/textpattern/publish.php on line 477
stein-ivar.net — Code - hatin' php since 2002.

Making the TotemBar in WoW movable! · Jul 10, 06:32


local g = getfenv(0) local OnMouseDown = function(self) if(IsAltKeyDown()) then self:StartMoving() end end local OnMouseUp = function(self) self:StopMovingOrSizing() end -- [[ TotemFrame ]] local tb = TotemFrame tb.UnregisterEvent = function() end tb.UnregisterAllEvents = function() end tb.noomnicc = true tb:SetMovable(true) tb:SetUserPlaced(true) tb:EnableMouse(true) tb:RegisterForDrag("LeftButton") tb:SetWidth(128) tb:SetHeight(38) tb:SetScript("OnMouseDown", OnMouseDown) tb:SetScript("OnMouseUp", OnMouseUp) tb:RegisterEvent"PLAYER_TOTEM_UPDATE" tb:RegisterEvent"PLAYER_ENTERING_WORLD" tb:SetParent(UIParent) tb:ClearAllPoints() tb:SetPoint("CENTER", UIParent, 0, 0) for i = 1,4 do g["TotemFrameTotem"..i.."IconCooldown"].noomnicc = true end

This makes the default TotemBar in WoW show regardless of you using the default playerframe, it will also move it with pressing down alt while clicking on it. Will prolly clean up the code some and release it later on.


Permanent Link Comment


Quake2 ServerQuery in lua. · Jul 8, 07:22


local socket = require("socket") local port = "27910" local host = "aq2.catchgamer.no" local packet = "\255\255\255\255status\n" local ip = assert(socket.dns.toip(host)) local udp = socket.udp() udp:setpeername(ip, port) local nsent, err = udp:send(packet) local header, err = udp:receive() local t = {players = {}} header = header:sub(11) -- strip away the firstline for key, var in header:gmatch'\\([^\\]+)\\([^\\\n]+)' do t[key] = var end for frag, ping, player in header:gmatch'(%d+) (%d+) "(.-)"\n' do table.insert(t.players, { player = player, frag = frag, ping = ping }) end local output = string.format("%s, players: %s/%s, map: %s [%s]", t["hostname"], #t.players, t["maxclients"], t["mapname"], t["gamename"]) print(output)

Prints out:
23:17:14 steino@kimiko work $ time lua q2.lua Catch-Gamer.no AQ2 #1 Teamplay, players: 7/16, map: urban3 [action] real 0m0.078s user 0m0.000s sys 0m0.010s

Requires Luasocket.

Made by Me and haste.

You can basicly make this work with any kind of game out there aslong as you know what packet to send. Qstat is a nice place to look for info on other types of games (hf reading that source :—D)


Permanent Link Comment


Testing! · Jul 5, 03:03


Testing the code-tag using the last.fm plugin.

function lastfm($atts) { global $s, $c; extract(lAtts(array( ‘label’ => ‘’, ‘labeltag’ => ‘’, ‘break’ => ‘br’, ‘wraptag’ => ‘’, ‘parent’ => ‘’, ‘posted’ => ‘’, ‘section’ => $s, ‘sticky’ => ‘’, ‘user’ => ‘’, ),$atts)); function openURL($url, $headers = null){ if (function_exists(‘curl_init’)) { $ch = curl_init($url); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $data[‘html’] = curl_exec($ch); curl_close($ch); } elseif (ini_get(‘allow_url_fopen’) == 1) { $data[‘html’] = file_get_contents($url); } if($headers) {$data[‘headers’] = get_headers($url, 1); } return $data;
} $url = “http://ws.audioscrobbler.com/1.0/user/” . $user . “/recenttracks.xml”; $xml = openURL($url); $info = simplexml_load_string($xml[“html”]); // OUTPUT $out = array(); for($i=0;$i<5;$i++){ $fm = $info->track[$i]; $out[$i] = tag($fm->artist . ‘ – ‘ . $fm->name, ‘a’, ‘ href=”’ . $fm->url . ‘”’); } return doLabel($label, $labeltag).doWrap($out, $wraptag, $break, $class);
}


Permanent Link Comment