LUA user contributed

From Win-Test Wiki
Jump to navigation Jump to search

User contributed LUA Scripts

As the scripting language LUA opens the possibility to change WT-behaviour to personal needs, there are user contributed scripts available. This collection here is for your convenience. Please try and use at your own risk.


The ESM.WTS script is used by win-test for the ESM-Mode (Enter Sends Message).



I've followed the instructions of Larry to have a custom esm script and managed to write one during the brakes of WAE (yes, this WAE could have more participants :-) and even test it during the contest. It worked great. Scripting seems to introduce no noticeable delays when the enter key is pressed.

I am not a strong contender how ESM should be, other than staying usable, intuitive and reproducible. What 5B4AGN suggested sounded pretty reasonable to me and here is my attempt.

Simply place it in the "scripts" directory of WT, named esm.wts (any other name and WT will ignore the external script). At the top of the script you will find a variable setting:

shortcq = false;

Setting it to true, it will convert the CQ calling and the TU part of the QSO in short forms (a la 5b4agn) and the exact contents of the messages are defined in the two lines that follow the shortcq setting. I have also added the possibility to have an exchange filled in and no call (in that case the script sends CL?)

I must say I am very impressed by the functionality that WT opens to the users with lua scripts. I would really like to see more API calls made available and WT functions using scripts (programmable keys, even so2r, etc)

In the mean time if you have suggestions to improve the script let me know. I can easily inlcude them.




-- Wintest ESM - Nick, F5VIH/SV3SJ
-- Set "shortCQ to true or false
shortcq = true;
shortCQ = "$MYCALL"; shortTU = "$CORRECT ++TU-- $CR";
-- Send functions
function sendCq() wtQso:ResetExchangeSent(); if (wtQso:IsModePhone()) then wtApp:SendFKey("F1"); else if (shortcq) then wtKeyer:Play(shortCQ); else wtApp:SendFKey("F1"); -- Always use the function key end; end; end;
function sendExchangeRun() if (wtQso:IsModePhone()) then wtApp:SendFKey("F2"); wtKeyer:Play("$CR"); else wtKeyer:Play("$INSERT"); end; wtQso:SetExchangeSent(); end;
function sendExchangeAgain() if (wtQso:IsModePhone()) then wtApp:SendFKey("F2"); else wtKeyer:Play("$F5 $F7"); -- $LOGGED ? end; end;
function sendTu() if (wtQso:IsModePhone()) then if (shortcq) then wtKeyer:Play("$CR"); wtApp:SendFKey("F5"); else wtApp:SendFKey("PLUS"); end; else if (shortcq) then wtKeyer:Play(shortTU); else wtKeyer:Play("$PLUS"); end; end; wtQso:ClearStatus(); end;
function sendQuestionMark() wtQso:ResetExchangeSent(); if (wtQso:IsModePhone()) then wtApp:SendFKey("F7"); -- Again ? else wtKeyer:Play("$F7"); end; end;
function sendMyCall() if (wtQso:IsModePhone()) then wtApp:SendFKey("F4"); -- My call else wtKeyer:Play("$F4"); end; end;
function sendExchangeSAndP() -- Sends appropriate exchange when in S&P mode if (wtQso:IsModePhone()) then wtApp:SendFKey("F2"); -- 5NN EXCHANGE else wtKeyer:Play("$F2"); end; wtQso:SetExchangeSent(); end;
function sendAskForCall() if (wtQso:IsModePhone()) then wtApp:SendFKey("F7"); -- AGN else wtKeyer:Play("CL?"); end; end;
function askForNumber() if (wtQso:IsModePhone()) then wtApp:SendFKey("F6"); -- NR AGN else wtKeyer:Play("$F6"); end; end;
function askWithPartialCall() if (wtQso:IsModePhone()) then wtApp:SendFKey("F7"); -- AGN else wtKeyer:Play("$F5 ?"); end; end;
-- ESM core code
-- Return 0 (or return nothing) if we want the CR -- to be processed also by WT (ie log QSO) and -1 if not.
if (wtQso:IsOperatingModeRun()) then -- Run Mode if (wtContest:IsExchangeRequired()) then -- Usual contests requiring an exchange if (wtQso:IsCallsignEmpty()) then if (wtQso:IsExchangeEmpty()) then sendCq(); else -- we ve got an exchange but not a call, ask for the call sendAskForCall(); end; else -- call is not empty if (wtQso:IsExchangeSent()) then -- we have sent the exchage if (not wtQso:IsQsoApproved()) then if (wtQso:IsCurrentFieldCallsign() and not wtQso:IsExchangeEmpty()) then askWithPartialCall(); end; if (wtQso:IsCurrentFieldCallsign() and wtQso:IsExchangeEmpty()) then wtQso:ResetExchangeSent(); sendExchangeRun(); if (wtQso:IsCurrentFieldCallsign()) then wtKeyer:Play("$SPACEBAR") end; end; if (wtQso:IsCurrentFieldExchange() and wtQso:IsExchangeEmpty()) then askForNumber(); end; else -- qso has valid call and exchange if (wtQso:IsCurrentFieldExchange()) then sendTu(); else -- current field is not exchange (should be callsign) if (wtQso:IsCurrentFieldCallsign()) then wtQso:ResetExchangeSent(); sendExchangeRun(); if (wtQso:IsCurrentFieldCallsign()) then wtKeyer:Play("$SPACEBAR") end; end; end; end;
else -- have not sent exchange and we are in the call field sendExchangeRun(); if (wtQso:IsCurrentFieldCallsign()) then wtKeyer:Play("$SPACEBAR") end; end; end;
else -- The contest doesnt require an exchange to be received e.g. DXPed etc. if (not wtQso:IsQsoApproved()) then if (wtQso:IsCallsignEmpty()) then sendCq(); else if (wtQso:IsCallsignRepeated()) then sendExchangeAgain(); else sendExchangeRun(); end; end; else if (wtQso:IsExchangeSent()) then sendTu(); else sendExchangeRun(); end; end; end;
else -- S&P : The automatic exchange fill (if enabled) is disabled by WT if ( (wtQso:IsExchangeEmpty() and wtContest:IsExchangeRequired()) or not wtQso:IsQsoApproved() ) then if (wtQso:IsCallsignEmpty()) then sendQuestionMark(); else if (not wtQso:IsDupe()) then -- Call only if not dupe sendMyCall(); end; end; else if (wtQso:IsExchangeSent()) then wtQso:ClearStatus(); wtKeyer:Play("$CR"); return -1; -- Log it silently else if (not wtQso:IsDupe()) then -- Sent exchange only if not dupe sendExchangeSAndP(); end; end; end; end;
return -1; -- This script overrides the Win-Test CR process

Back to LUA / ESM Mode

Back to Main Page