Hier dan de nederlandse woordmix:
In drie stukken:
jumble.cfg
--------------------------------------------------------------------------------
-- JumbleFever
-- Author: Donald Duck
-- Converted to LUA 5 by ??????Hawk??????
-- 03/03/2005
-- This is the config file to set values.
-- Do so at your own risk.
sBotName = "Lampje";
sTranslator = "Donald Duck";
-- NOTE: this file is a lua file. JumbleFever calls dofile on it. So
-- you can do anything in here that you would want to occur in the
-- PtokaX Main event.
sJumbleWordsFile = "Jumble\\Dutch.txt";
sJumbleScoresFile = "JumbleScores.txt";
sHintChar = "?"
iDisplayScores = 25; -- displays top 10 scores
-- iDisplayScores = nil; -- displays all scores
-- In seconds
iPauseTime = 10;
iHintTime = 60;
iGameEndTime = 120;
iBonusTimeLimit = 10;
-- FORMULA SYSTEM --
-- Scores and Hint are now formula strings that have variables:
-- iLength = length of phrase (minus spaces)
-- iBonusTime = bonus time remaining
-- additional math functions such as min, max, floor, etc can be used
-- If you're not a scripter, don't change this.
-- Cause I don't want to help 20 people with nil problems :-P
sScoreFormula = "6"; -- score equals 6
-- sScoreFormula = "$iLength"; -- score equals length of phrase
-- sScoreFormula = "2 * $iLength + 3" -- score equals length of phrase times 2 plus 3
-- sScoreFormula = "min($iLength - 5, 0) * 2 + 6"; -- score equals 6 plus 2 for every letter beyond 5
sBonusFormula = "$iBonusTime"; -- bonus score equals bonus time
sHintFormula = "math.floor(.4 * $iLength + .5)";
-- Command table.
-- Format: ["cmdname"] = { FunctionName, OperatorOnly, "Description"}
tCommands = {
[string.lower("a.start")] = { StartJumbleGame, 0, "Start de woordmix. kan gebruikt worden met verschillende talen (a.start taal)"},
[string.lower("a.stop")] = { StopJumbleGame, 0, "Stop de woordmix."},
[string.lower("a.phrase")] = { DisplayJumblePhrase, 0, "Laat de woordmix nog eens zien."},
[string.lower("a.help")] = { DisplayJumbleHelp, 0, "Laat deze help nog een keer zien."},
[string.lower("a.scores")] = { DisplayJumbleScores, 0, "Laat de scores zien."},
[string.lower("a.myscore")] = { DisplayMyJumbleScore, 0, "Laat jou score zien."},
[string.lower("a.hint")] = { DisplayJumbleHint, 0, "Laat een hint zien."},
[string.lower("a.join")] = { JoinJumble, 0, "Speel mee met het prive spel."},
[string.lower("a.leave")] = { LeaveJumble, 0, "Stop met het prive spel."},
[string.lower("a.private")] = { SetPrivateJumbleGame, 1, "Zet woordmix naar prive."},
[string.lower("a.public")] = { SetPublicJumbleGame, 1, "Zet woordmix naar mainchat."},
}
-- This string table is dynamic. You define GLOBAL variables with $varname. To define "$"
-- user $$. All above values are considered globals. All others in this table have easy
-- names so I hope everyone understands without an explaination. Try to use common sense
-- when selecting global variables in a string. If you don't think it will be set at the
-- time the string is displayed, it probably isn't :-P
tStringTable = {
[1] = "\r\nWoordmix gemaakt door: $sAuthor Email: $sEmail\r\n"..
"Speel woordmix met je vrienden hier! elke zin of woord word aangezien \r\n"..
"als gok voor Woordmix. Hier zijn de commands:\r\n",
[2] = "$sCmd\t- $sDesc\r\n",
[3] = "10 seconden over!!!",
[4] = "$sUserName verdient $iScore punten en $iBonus tijdbonus. Rank $iRank/$iRankTotal (Score: $iUserScore)",
[5] = "$sUserName verdient $iScore punten. Rank $iRank/$iRankTotal (Score: $iUserScore)",
[6] = "$sUserName heeft een nieuwe woordmix gestart!!!",
[7] = "Typ \"$sJumbleHelp\" voor help.",
[8] = "$sUserName heeft woordmix gestopt. :-(",
[9] = "De woordmix is: $sJumblePhrase", -- fix
[10] = "Rank: $iRank/$iRankTotal Score: $iUserScore",
[11] = "Je hebt nog geen score, Jammer. :-)",
[12] = "$sUserName speelt ook mee met woordmix.",
[13] = "Hallo $sUserName",
[14] = "$sUserName heeft woordmix verlaten.",
[15] = "De woordmix was: $sActualPhrase",
[16] = "Top $iDisplayScores woordmix spelers\r\n\r\n",
[17] = "Alle $sBotName Players\r\n\r\n",
[18] = "Geen scores",
[19] = "$iPos) Naam: $sUserName - Score: $iUserScore\r\n",
[20] = "Hier is een hint: $sHint",
[21] = "Woordmix is automatisch gestopt. :-("
};
--------------------------------------------------------------------------------
Jumble.lua_5.0.lua:
--------------------------------------------------------------------------------
sAuthor = "Donald Duck";
sEmail = "woordmix@kinderspel.nl";
sConversion = " Converted to LUA 5 by ??????Hawk?????? 03/03/2005"
bGameRunning, bGamePaused = nil, nil;
sJumblePhrase, sActualPhrases, NoSpacePhrase = nil,nil,nil;
iLength, iBonusTime = 0, 0;
sScoreOutput, sHintOutput, sHelpOutput, sOpHelpOutput = nil, nil, nil, "";
iTimeCount, iGameNoReplyCount = 0, 0;
tScores, tScoresByName = { n = 0 }, {};
tChannelUsers, iChannelCount = {}, nil;
-- PtokaX Events --
function Main()
dofile("jumble.cfg");
sScoreFormula = "return "..sScoreFormula;
sBonusFormula = "return "..sBonusFormula;
sHintFormula = "return "..sHintFormula;
frmHub:RegBot(sBotName);
sHelpOutput = StrReplace(tStringTable[1]);
for cmd,tTemp in tCommands do
if(tTemp[1] == DisplayJumbleHelp) then
sJumbleHelp = cmd;
end
sCmd, sDesc = cmd, tTemp[3];
if(tTemp[2] == 0) then
sHelpOutput = sHelpOutput..StrReplace(tStringTable[2]);
else
sOpHelpOutput = sOpHelpOutput..StrReplace(tStringTable[2]);
end
end
OldSendToAll = SendToAll;
UserDisconnected = LeaveJumble;
OpDisconnected = LeaveJumble;
SetTimer(1000);
ReadScoresFromFile();
SetScores();
end
function OnTimer()
if(bGamePaused) then
iTimeCount = iTimeCount + 1;
if(iTimeCount >= iPauseTime) then
StartJumblePhrase();
end
elseif(bGameRunning) then
iTimeCount = iTimeCount + 1;
if(iTimeCount == iHintTime) then
SendToAll(sBotName, sHintOutput);
elseif (iTimeCount == iGameEndTime - 10) then
SendToAll(sBotName, StrReplace(tStringTable[3]));
elseif (iTimeCount == iGameEndTime) then
StopJumblePhrase();
if(iGameNoReplyCount >= 3) then
StopJumbleGame();
end
else
end
else
end
end
function ChatArrival(curUser, sData)
local s, e, sNewData, chat, cmd, args = string.find(sData, "(%b<>%s+((%S+)%s*([^%|]*)))%|$");
local s, e, sTo = string.find(sData, "^%$To: (%S+)");
if(cmd == nil or (sTo and sTo ~= sBotName)) then return 0; end
sUserName = curUser.sName;
if(sTo) then
curUser.SendData = curUser.SendPM;
end
cmd = string.lower(cmd);
if(tCommands[cmd] and (tCommands[cmd][2] == 0 or curUser.bOperator)) then
curUser:SendData(sData);
tCommands[cmd][1](curUser, args);
return 1;
else
if (not(iChannelCount) and string.sub(sData,1,1) == "<") then
iGameNoReplyCount = 0;
end
if(iChannelCount and string.find(sData, "$To: "..sBotName, 1, 1) == 1 and cmd == "!me") then
sNewData = "* "..sUserName..string.sub(chat, 4);
end
if(bGameRunning and bGamePaused == nil and string.find(string.upper(chat), sActualPhrase, 1, 1)) then
SendToAll(sNewData);
iBonusTime = math.max(iBonusTimeLimit - iTimeCount, 0);
iScore = assert(loadstring(StrReplace(sScoreFormula)))();
iBonus = assert(loadstring(StrReplace(sBonusFormula)))();
if(tScoresByName[sUserName]) then
tScoresByName[sUserName][2] = tScoresByName[sUserName][2] + iScore + iBonus;
else
tScoresByName[sUserName] = {sUserName, iScore + iBonus};
table.insert(tScores, tScoresByName[sUserName]);
end
iRank = SetScores(sUserName);
iRankTotal = table.getn(tScores);
iUserScore = tScoresByName[sUserName][2];
WriteScoresToFile();
StopJumblePhrase();
if(iBonusTime ~= 0) then
SendToAll(sBotName, StrReplace(tStringTable[4]));
else
SendToAll(sBotName, StrReplace(tStringTable[5]));
end
iGameNoReplyCount = 0;
return 1;
else
if(iChannelCount and string.find(sData, "^$To: "..sBotName, 1, 1) == 1) then
if(tChannelUsers[sUserName] == nil) then
JoinJumble(curUser);
else
SendToAll(sNewData);
iGameNoReplyCount = 0;
end
return 1;
end
end
end
end
-- Command Functions --
function StartJumbleGame(curUser, args)
if(bGameRunning) then return; end
if(args ~= "") then
HubGameActive = 2
local s, e, args = string.find(args, "([%w%s]+)$");
args = "Jumble\\"..args..".txt";
local f,e = io.open(args,"r")
if f then
sJumbleWordsFile = args;
f:close(f)
end
end
OldSendToAll(sBotName, StrReplace(tStringTable[6]));
StartJumblePhrase();
SendToAll(sBotName, StrReplace(tStringTable[7]));
iGameNoReplyCount = 0;
end
function StopJumbleGame(curUser)
if not(bGameRunning) then return; end
if not(bGamePaused) then
StopJumblePhrase();
end
if(curUser) then
OldSendToAll(sBotName, StrReplace(tStringTable[8]));
else
OldSendToAll(sBotName, StrReplace(tStringTable[21]));
-- TODO: fix numbers
end
bGameRunning, bGamePaused = nil, nil;
iBonusTime, iLength = 0, 0;
StopTimer();
end
function DisplayJumblePhrase(curUser)
if(bGameRunning and not bGamePaused) then
if(curUser == nil) then
SendToAll(sBotName, StrReplace(tStringTable[9]));
else
curUser:SendData(sBotName, StrReplace(tStringTable[9]));
end
end
end
function DisplayJumbleHelp(curUser)
if(curUser.bOperator) then
curUser:SendData(sBotName, sHelpOutput..sOpHelpOutput);
else
curUser:SendData(sBotName, sHelpOutput);
end
end
function DisplayJumbleScores(curUser)
curUser:SendData(sBotName, sScoresOutput);
end
function DisplayMyJumbleScore(curUser)
iRank = tScoresByName[curUser.sName][3];
iRankTotal = table.getn(tScores);
iUserScore = tScoresByName[sUserName][2];
if(tScoresByName[curUser.sName]) then
curUser:SendData(sBotName, StrReplace(tStringTable[10]));
else
curUser:SendData(sBotName, StrReplace(tStringTable[11]));
end
end
function DisplayJumbleHint(curUser)
if(iTimeCount >= iHintTime) then
curUser:SendData(sBotName, sHintOutput);
end
end
function JoinJumble(curUser)
if(iChannelCount and tChannelUsers[curUser.sName] == nil) then
SendToAll(sBotName, StrReplace(tStringTable[12]));
curUser:SendPM(sBotName, StrReplace(tStringTable[13]));
curUser.SendData = curUser.SendPM;
DisplayJumblePhrase(curUser);
DisplayJumbleHint(curUser);
tChannelUsers[curUser.sName] = 1;
iChannelCount = iChannelCount + 1;
end
end
function LeaveJumble(curUser)
if(iChannelCount and tChannelUsers[curUser.sName]) then
sUserName = curUser.sName;
SendToAll(sBotName, StrReplace(tStringTable[14]));
tChannelUsers[curUser.sName] = nil;
iChannelCount = iChannelCount - 1;
if(iChannelCount <= 0) then
iChannelCount = 0;
StopJumbleGame();
end
end
end
function SetPrivateJumbleGame(curUser)
if(iChannelCount == nil) then
SendToAll = SendToAllInChannel;
iChannelCount = 0;
end
end
function SetPublicJumbleGame(curUser)
if(iChannelCount) then
SendToAll = OldSendToAll;
tChannelUsers = {};
iChannelCount = nil;
end
end
-- Jumble Phrase Functions --
function JumbleString(str)
local tStr = { n = 0; };
local newString = "";
string.gsub(str, "(.)", function(c) table.insert(tStr, c); end);
math.randomseed(os.clock());
-- Fisher-Yates shuffle
for n = table.getn(tStr), 1, -1 do
local pos = math.random(n);
newString = tStr[pos].." "..newString;
tStr[pos] = tStr[n];
end
return newString;
end
function JumblePhrase(phr)
return string.sub(string.gsub(phr, "(%S+)", function (w) return JumbleString(w).." "; end), 1, -2);
end
function StartJumblePhrase()
local hFile,Er = io.open(sJumbleWordsFile, "r");
if(hFile == nil) then
SendToAll(sBotName, "Error opening "..sJumbleWordsFile);
return;
end
local _, phr = nil, nil;
local iFileSize = hFile:seek("end")
math.randomseed(os.clock());
while(phr == nil) do
hFile:seek("set", math.random(iFileSize)-1);
_, phr = hFile:read( "*l", "*l");
end
hFile:close();
sActualPhrase = string.upper(phr);
sNoSpacePhrase = string.gsub(sActualPhrase, "%s", "");
sJumblePhrase = JumblePhrase(sActualPhrase);
iLength = string.len(sNoSpacePhrase);
SetJumbleHint();
SendToAll(sBotName, StrReplace(tStringTable[9]));
iTimeCount = 0;
bGameRunning = 1;
bGamePaused = nil;
StopTimer(); StartTimer();
end
function StopJumblePhrase()
SendToAll(sBotName, StrReplace(tStringTable[15]));
sActualPhrase, sNoSpacePhrase, sJumblePhrase = nil, nil, nil;
iTimeCount = 0;
bGamePaused = 1;
iGameNoReplyCount = iGameNoReplyCount + 1;
end
-- String Functions --
function StrReplace(sString)
sString = string.gsub(sString, "%$(%w+)", function (w)
if(string.sub(w,1,1) == "$") then
return string.sub(w,2,-1);
else
return _G[w] or "nil";
end
end);
return sString;
end
-- Score Functions --
function SetScores(sName)
local iCount = table.getn(tScores);
iDisplayCount = iDisplayScores or iCount
if(iDisplayScores) then
sScoresOutput = StrReplace(tStringTable[16]);
else
sScoresOutput = StrReplace(tStringTable[17]);
end
if(iCount == 0) then
sScoresOutput = StrReplace(tStringTable[18]);
else
table.sort(tScores, function(a, b) return a[2] > b[2]; end);
for i = 1, iCount, 1 do
tScores[i][3] = i; -- set ranks for all users
end
for i = 1, math.min(iDisplayCount, iCount), 1 do
iPos = i;
sUserName = tScores[iPos][1];
iUserScore = tScores[iPos][2];
sScoresOutput = sScoresOutput..StrReplace(tStringTable[19]);
end
end
sUserName = sName;
if(sName) then
return tScoresByName[sName][3];
end
end
function ReadScoresFromFile()
dofile(sJumbleScoresFile);
for i = 1, table.getn(tScores), 1 do
tScoresByName[tScores[i][1]] = tScores[i];
end
end
function ToArrival(user, data)
ChatArrival(user, data)
end
function WriteScoresToFile()
local hFile,Er = io.open(sJumbleScoresFile, "w");
hFile:write("tScores = {\n");
for i = 1, table.getn(tScores), 1 do
hFile:write("["..i.."] = {"..string.format("%q", tScores[i][1])..","..tScores[i][2].."},\n");
end
hFile:write("n="..table.getn(tScores).."\n");
hFile:write("};");
hFile:close();
end
-- Hint Functions --
function SetJumbleHint()
local tRevealArray = { };
local iReveal = assert(loadstring(StrReplace(sHintFormula)))();
local iPos = nil;
while(iReveal > 0) do
repeat iPos = math.random(iLength); until tRevealArray[iPos] == nil
tRevealArray[iPos] = 1;
iReveal = iReveal - 1;
end
tRevealArray.iPos = 1;
sHint = string.gsub(sActualPhrase, "(%S)", function (c)
if (c == nil) then return ""; end
local out, tTemp = nil, tRevealArray;
if(tTemp[tTemp.iPos]) then
out = c;
else
out = sHintChar;
end
tTemp.iPos = tTemp.iPos + 1;
return out.." ";
end);
sHint = string.sub(sHint, 1, -2);
sHintOutput = StrReplace(tStringTable[20]);
end
-- Channel Functions --
function SendToAllInChannel(sSender, sRawOutput)
if(sSender) then
local _;
if(sRawOutput == nil) then
sRawOutput = sSender;
_, _, sSender = string.find(sRawOutput, "^%<(.-)%>");
else
sRawOutput = "<"..sSender.."> "..sRawOutput;
end
for nick, val in tChannelUsers do
if(nick ~= sSender) then
SendToNick(nick, "$To: "..nick.." From: "..sBotName.." $"..sRawOutput);
end
end
end
end
--------------------------------------------------------------------------------
De woorden:
dutch.txt
aanslag
aansteker
aantal
aardbei
aarde
abraham
adem
admiraal
adres
albino
arbeid
archief
asfalt
atleet
auto
banaan
batterij
begin
beker
benzine
bericht
beroep
bestek
bezem
bingo
bioscoop
bliksem
bloem
bodem
boek
bonus
boogschutter
boom
boter
braadworst
brandslang
breedband
brief
bril
broek
broer
brommer
brood
buro
bushalte
bushokje
camera
carnaval
cavia
champagne
chaos
chemie
chips
chloor
cijfer
cirkel
cognac
compagnon
computer
crisis
datum
deegrol
deksel
deur
diepvries
doelpunt
dolfijn
doos
draak
drama
drinken
drogist
dwaas
eieren
egel
eten
euro
extra
ezel
fiets
film
fluit
fototoestel
fruit
gebak
geel
gezicht
gezin
gordijn
graan
grap
gratis
hamer
haven
helikopter
hengel
hoed
holland
homepage
hommel
honing
hond
horloge
hotel
idool
ijs
ijzerdraad
imker
inderdaad
inktvis
internet
jawoord
joint
juweel
kaas
kalender
kanaal
karnemelk
kat
kazerne
keizer
kermis
ketel
keuken
kever
kikker
kinderen
klamboe
klem
klok
klont
knikker
koelkast
koffie
koffiemelk
kom
komedie
kompas
konijn
koning
kozijn
kreeft
krentebol
kubus
kwaliteit
lamp
later
leeuw
legende
lepel
leren
letter
liefde
limonade
logboek
lokomotief
lopen
lucifers
maan
machine
magnetron
marmot
melk
meloen
metro
moeder
moederbord
mok
motel
motor
muis
muts
muziek
nederland
neef
neus
neushoorn
nicht
niets
nieuw
nooit
noot
nummer
oksel
olifant
oma
onder
onweer
oom
oorlog
opa
open
oranje
orkest
overal
overhemd
paard
paardebloem
pagina
pallet
papier
parkeren
penceel
perzik
pilaar
piloot
pinda
pindakaas
pistool
plafond
plakband
politie
politiek
post
postbode
posthoorn
potlood
pretpark
puzzel
quince
radio
ratelslang
rebus
regel
regen
ridder
robot
rook
schaduw
scheermes
schoen
school
schorpioen
schotel
shag
sigaar
sigaretten
sleutel
software
soldaat
spiegel
spijker
stapelbed
station
steenbok
sticker
stier
stoel
stokbrood
stoomboot
stop
suiker
surfplank
tabak
tafel
tandarts
tante
telefoon
teletekst
televisie
teller
tennis
theater
theezakje
toetsenbord
toilet
toon
totaal
tovenaar
trampoline
trein
trommel
trompet
trui
uitrusten
urn
vader
varken
veerboot
veulen
video
vierkant
vijver
vis
vliegtuig
vlinder
vloei
voetbal
vogel
voordeur
vork
vriend
vriendin
vrouw
vuilnisman
waarom
walvis
water
weegschaal
werkgever
werknemer
western
wijn
windmolen
woord
xantia
xerox
ys
zaag
zakgeld
zeem
zeester
zeilboot
zonnebloem
zonnescherm
zorg
zus
zwaaien
zwaar
zwaard
zwembad
Aanpassen mag zoals ik gedaan heb.
Maak wel een map aan in de map scripts met de naam Jumble en zet daar die in met de naam dutch.txt
Maak dan nog een bestandje aan in de map scripts met de naam jumblescores.txt en dat was het
Hi Syphrone-NL
How can you insert de commands?
I've tried many options but nothing works.
Can you tell wich command you need to insert for start the game?
I found the command a.start but it won't work.....
I've 3 files in the map scripts
1 Jumble.lua
2 Jumble\\Dutch.txt
3 Jumble.cfg
There are no errors nor others massages.
Can someone tell me what I do wrong???
download the original woordmix and try that one
it was released 2 years ago
get it here (http://www.plop.nl/ptokaxbots/Troubadour.php)
good luck
Thnx Gert it's fixed
QuoteOriginally posted by Leun
Thnx Gert it's fixed
you're welcome m8
Woordmix LUA 5
Hi, is there anyone who can help me out whit converting this script to LUA 5 ?
I have tried the converted version, but indeed the commands are not working =((. I have some users/Op's in my hub who really like to play it, so if anyone can help me out, i would be very thankfull, bows and takes hat off :D
Thanks and greetings, Gr??v?r :))
The lua5 version is allready made (i also did 1 version)
but i will not release it public.
Reason for not releasing is the old version of woordmix.
I created that one after i helped RabidWombat and asked his permission to do so.
All versions i did, i saw in other hubs wich all claimed it was done by themselves.
So when they say they can do, then lett them all do it themselves (i think)
good luck m8,
best regards,
Gert
QuoteOriginally posted by Gert
The lua5 version is allready made (i also did 1 version)
but i will not release it public.
Reason for not releasing is the old version of woordmix.
I created that one after i helped RabidWombat and asked his permission to do so.
All versions i did, i saw in other hubs wich all claimed it was done by themselves.
So when they say they can do, then lett them all do it themselves (i think)
luac.exe -o WordmixCompiled.lua Wordmix.lua
;) ;) ;)
QuoteOriginally posted by ??????Hawk??????
luac.exe -o WordmixCompiled.lua Wordmix.lua
;) ;) ;)
Your expected and usual (constant?) behaviour.
QuoteYour expected and usual (constant?) behaviour.
Is it better to have the script available Compiled for ppl to use. ?
OR
Living on his computer ONLY . ???
??????Hawk??????
QuoteOriginally posted by ??????Hawk??????
QuoteYour expected and usual (constant?) behaviour.
Is it better to have the script available Compiled for ppl to use. ?
OR
Living on his computer ONLY . ???
No, but I wouldn't obfuscate any scripts to prevent others from getting code from it. The only thing that annoys me, when people release the script using my code. That's why I license them under the GPL.
But the behaviour mentioned above is annoying indeed. So is the compilomania.