/* * Soldat Clicker v1.2 * By ramirez * * How to load: * /load -rs soldat_clicker.mrc * * Description: * mIRC Soldat Clicker allows players quickly and easily share * server information with each other, without the need of * editing favorites, copy/pasting information from IRC to * game, and so on. By simply double clicking a soldat:// link, * you'll join the server automatically, with absolutely no * need of remembering or going through the tedious process of * switching between mIRC and copy/pasting information to Soldat. * The script also allows you to change a few settings with a popup, * such as do you want to join as a player or a spectator, or do * you play in windowed or fullscreen. It also lets registered * players to switch profiles. * * Syntax: * soldat://host:port/password * * Ip address be an ip address in a dotted format, or a host name, * such as server.selfkill.com. Port and password are optional, * if they aren't specified defaults are assumed. Default port * is 23073 and there is no password by default. You can specify * a password without specifying port as well. * * Examples: * soldat://server.selfkill.com Joins server.selfkill.com on port 23073 * soldat://85.131.237.138:9000 Joins server 85.131.237.138 on port 9000 * soldat://server.selfkill.com/abc Joins server.selfkill.com on port 23073 and password abc * soldat://85.131.237.138:9000/abc Joins 85.131.237.138 on port 9000 and password abc */ on *:LOAD:SoldatSetPath on ^*:HOTLINK:soldat*:*:{ var %soldat_hotlink_regex, %soldat_hotlink_match %soldat_hotlink_regex = /^soldat:\/\/([\w-.]+)(:(\d+))?(\/([^\/]+))?\/?$/i %soldat_hotlink_match = $regex(soldat_hotlink, $strip($1), %soldat_hotlink_regex) if (%soldat_hotlink_match) { return } else { halt } } on *:HOTLINK:soldat*:*:{ var %soldat_address = $regml(soldat_hotlink, 1), %soldat_port = 23073, %soldat_password = $null if (!$isfile(%soldat_executable)) { SoldatSetPath } if ($isfile(%soldat_executable)) { if ($regml(soldat_hotlink, 0) == 3) { if ($left($regml(soldat_hotlink, 2), 1) == :) { %soldat_port = $regml(soldat_hotlink, 3) } else { %soldat_password = $regml(soldat_hotlink, 3) } } elseif ($regml(soldat_hotlink, 0) == 5) { %soldat_port = $regml(soldat_hotlink, 3) %soldat_password = $regml(soldat_hotlink, 5) } run $+(", %soldat_executable, ") -join %soldat_address %soldat_port %soldat_password } else { echo 4 -a The path  $+ %soldat_executable $+  is not valid executable. } } alias -l SoldatSortProfiles { set %soldat_profiles $null var %total = $findfile($nofile(%soldat_executable) $+ Profiles\, *.ini, 0), %i = 1 while (%i <= %total) { set %soldat_profiles $addtok(%soldat_profiles, $findfile($nofile(%soldat_executable) $+ Profiles\, *.ini, %i), 124) inc %i } set %soldat_profiles $sorttok(%soldat_profiles, 124) } alias -l SoldatSetPath { var %path, %dir, %full_path if ($isdir($nofile(%soldat_executable))) { %dir = $nofile(%soldat_executable) } else { %dir = $mircdir } %path = $sdir(%dir, Path to Soldat Directory) if ($isdir(%path)) { %full_path = %path $+ Soldat.exe if (!$isfile(%full_path)) { if ($?!="File %full_path does not exist. $crlf $+ If your Soldat executable is named differently, choose 'Yes' to select the file manually.") { %full_path = $sfile(%path, Soldat Executable) if ($isfile(%full_path)) { set %soldat_executable %full_path } } } else { set %soldat_executable %full_path } } } alias -l SoldatProfileSubMenu { var %default = $nofile(%soldat_executable) $+ soldat.ini if (!$isfile(%default)) return $null elseif ($1 isnum) { var %i = $calc($1 - 1), %name if (%i > $numtok(%soldat_profiles, 124)) return $null if (%i == 0) %name = Default else %name = $left($nopath($gettok(%soldat_profiles, %i, 124)), -4) return $iif(%i == $readini(%default, GAME, Profile_Default), $style(1)) %name $+ :SoldatSetConf GAME Profile_Default 0 %i } } alias -l SoldatGetConf { var %section = $1, %item = $2, %profile = $3, %default = $+($nofile(%soldat_executable), soldat.ini), %ini = %default if (!$isfile(%default)) return $null if (%profile) { %profile = $readini(%default, GAME, Profile_Default) if (%profile) { %ini = $gettok(%soldat_profiles, %profile, 124) if (!$isfile(%ini)) return $null } } return $readini(%ini, %section, %item) } alias -l SoldatSetConf { var %section = $1, %item = $2, %profile = $3, %value = $4, %default = $+($nofile(%soldat_executable), soldat.ini), %ini = %default if (!$isfile(%default)) return $null if (%profile) { %profile = $readini(%default, GAME, Profile_Default) if (%profile) { %ini = $gettok(%soldat_profiles, %profile, 124) if (!$isfile(%ini)) return $null } } writeini %ini %section %item %value } menu status,channel,query,menubar,nicklist { Soldat .$submenu($SoldatSortProfiles) .Set Path to Soldat:SoldatSetPath .- .Switch Profile ..$submenu($SoldatProfileSubMenu($1)) .$iif($SoldatGetConf(NETWORK, Spectator, 1) isnum 0-1, $iif($v1 == 1, $style(1)), $style(2)) Join as Spectator:SoldatSetConf NETWORK Spectator 1 $iif($SoldatGetConf(NETWORK, Spectator, 1) == 0, 1, 0) .$iif($SoldatGetConf(GAME, FullScreen, 0) isnum 0-1, $iif($v1 == 1, $style(1)), $style(2)) Use Fullscreen:SoldatSetConf GAME FullScreen 0 $iif($SoldatGetConf(GAME, FullScreen, 0) == 0, 1, 0) }