StonedYoda
Coding-Content Moderator
- Messages
- 45
- Reaction score
- 73
- Points
- 368
Tutorial:
1) add a new script-file called "Keyboard"
2) Add all this code to your "Keyboard" script-file:
3) Put this Text on your "onPlayerSpawned" function
4) Add this Code to your overflowfix:
- StonedYoda
1) add a new script-file called "Keyboard"
2) Add all this code to your "Keyboard" script-file:
Code:
lozKeyboard()
{
self endon("disconnect");
self.isMenuLocked = true;
self.keyboardVars["isOpen"] = true;
self.keyboardVars["isCaps"] = false;
level.varsArray["isPlayingInputMsg"] = false;
self.keyboardVars["currentResult"] = "";
self.lozKeyboard = [];
//closeMenu();
self.lozKeyboard["bg"] = self createShader("white", "CENTER", "CENTER", 0, 18, 200, 99, (0,0,0), .8, 1);
self.lozKeyboard["bg2"] = self createShader("white", "CENTER", "CENTER", 0, -44, 2000, 24, (0,0,0), .8, 1);
self.lozKeyboard["bg3"] = self createShader("white", "CENTER", "CENTER", 0, 113, 120, 90, (0,0,0), .8, 1);
self.lozKeyboard["info"] = self drawTextloz(self.keyboardVars["infoText"], "objective", 1.2, "CENTER", "CENTER", 0, 77, (1,1,1), 1, (0,0,0), 0, 3);
self.lozKeyboard["result"] = self drawTextloz("", "objective", 1.5, "CENTER", "CENTER", 0, -44, (1,1,1), 1, (0,0,0), 0, 3);
for(i = 0; i < self.keyboardVars["keysLow"].size; i++)
self.lozKeyboard["keys"+i] = self drawTextloz(self.keyboardVars["keysLow"][i], "smallfixed", 1, "LEFT", "CENTER", -95 + (i * 20), -20, (1,1,1), 1, (0,0,0), 0, 3);
startX = self.lozKeyboard["keys0"].x+5;
startY = self.lozKeyboard["keys0"].y;
self.lozKeyboard["scrollbar"] = self createShader("white", "CENTER", "CENTER", startX, startY, 14, 15, (.9, .6, 0), .8, 2);
curs = 0;
keyCurs = 0;
final = "";
wait .3;
for(;;)
{
if(self actionSlotOneButtonPressed() || self actionSlotTwoButtonPressed() || self actionSlotThreeButtonPressed() || self actionSlotFourButtonPressed())
{
curs += self actionSlotTwoButtonPressed();
curs -= self actionSlotOneButtonPressed();
keyCurs += self actionSlotFourButtonPressed();
keyCurs -= self actionSlotThreeButtonPressed();
if(curs < 0)
curs = 4;
if(curs > 4)
curs = 0;
if(keyCurs < 0)
keyCurs = 9;
if(keyCurs > 9)
keyCurs = 0;
if(self actionSlotOneButtonPressed() || self actionSlotTwoButtonPressed())
{
if(curs == 0)
self.lozKeyboard["scrollbar"].y = startY;
else
self.lozKeyboard["scrollbar"].y = startY + (17 * curs);
}
if(self actionSlotThreeButtonPressed() || self actionSlotFourButtonPressed())
{
if(keyCurs == 0)
self.lozKeyboard["scrollbar"].x = startX;
else
self.lozKeyboard["scrollbar"].x = startX + (20 * keyCurs);
}
wait .1;
}
if(self changeSeatButtonPressed())
{
if(!self.keyboardVars["isCaps"])
{
self.keyboardVars["isCaps"] = true;
self iPrintLn("Caps ^2Enabled");
for(i = 0; i < self.keyboardVars["keysLow"].size; i++)
self.lozKeyboard["keys"+i] setSafeText(self.keyboardVars["keysBig"][i]);
}
else
{
self.keyboardVars["isCaps"] = false;
self iPrintLn("Caps ^1Disabled");
for(i = 0; i < self.keyboardVars["keysLow"].size; i++)
self.lozKeyboard["keys"+i] setSafeText(self.keyboardVars["keysLow"][i]);
}
wait .1;
}
if(self jumpButtonPressed())
{
if(final.size != 64)
{
if(!self.keyboardVars["isCaps"])
final += self.keyboardVars["fixedKeysLow"][keyCurs][curs];
else
final += self.keyboardVars["fixedKeysBig"][keyCurs][curs];
wait .02;
self.lozKeyboard["result"] setSafeText(final);
self.keyboardVars["currentResult"] = final;
}
else
self iPrintLn("^1Warning^7 : Max String Length Reached");
wait .1;
}
if(self stanceButtonPressed())
{
if(final.size != 0)
{
fixed = "";
for(x = 0; x < final.size-1; x++)
fixed += final[x];
final = fixed;
if(final.size == 0)
self.lozKeyboard["result"] setSafeText("");
else
self.lozKeyboard["result"] setSafeText(final);
self.keyboardVars["currentResult"] = final;
}
wait .1;
}
if(self useButtonPressed())
{
if(level.varsArray["isPlayingInputMsg"])
self iPrintLn("^1Warning^7 : Wait Until Last Message Finishes");
else
{
if(final.size != 0)
{
level thread printFinalInput(final);
break;
}
}
wait .1;
}
if(self meleeButtonPressed())
{
break;
}
wait .05;
}
toDelete = getArrayKeys(self.lozKeyboard);
foreach(hud in toDelete)
self.lozKeyboard[hud] destroy();
self.keyboardVars["isOpen"] = false;
self.isMenuLocked = false;
}
printFinalInput(string)
{
if(!level.varsArray["isPlayingInputMsg"])
{
level.varsArray["isPlayingInputMsg"] = true;
level.varsArray["currentInputMsg"] = string;
level.varsArray["inputMsgString"] = level drawLevelText(string, "bigfixed", 1.2, "CENTER", "CENTER", 0, 50, (1,1,1), 0, (0,0,0), 0, 2);
level.varsArray["inputMsgString"] fadeOverTime(1);
level.varsArray["inputMsgString"].alpha = 1;
wait 8;
level.varsArray["inputMsgString"] fadeOverTime(2);
level.varsArray["inputMsgString"].alpha = 0;
wait 2;
level.varsArray["inputMsgString"] destroy();
level.varsArray["isPlayingInputMsg"] = false;
}
}
drawTextloz(text, font, fontScale, align, relative, x, y, color, alpha, glowColor, glowAlpha, sort)
{
hud = self createFontString(font, fontScale);
hud setPoint(align, relative, x, y);
hud.color = color;
hud.alpha = alpha;
hud.glowColor = glowColor;
hud.glowAlpha = glowAlpha;
hud.sort = sort;
hud.alpha = alpha;
hud setSafeText(text);
hud.foreground = true;
hud.hideWhenInMenu = true;
return hud;
}
drawLevelText(text, font, fontScale, align, relative, x, y, color, alpha, glowColor, glowAlpha, sort)
{
hud = level createServerFontString(font, fontScale);
hud setPoint(align, relative, x, y);
hud.color = color;
hud.alpha = alpha;
hud.glowColor = glowColor;
hud.glowAlpha = glowAlpha;
hud.sort = sort;
hud.alpha = alpha;
hud setSafeText(text);
hud.foreground = true;
hud.hideWhenInMenu = true;
return hud;
}
drawShader(shader, x, y, width, height, color, alpha, sort)
{
hud = newClientHudElem(self);
hud.elemtype = "icon";
hud.color = color;
hud.alpha = alpha;
hud.sort = sort;
hud.children = [];
hud setParent(level.uiParent);
hud setShader(shader, width, height);
hud.x = x;
hud.y = y;
hud.hideWhenInMenu = true;
return hud;
}
createShader(shader, align, relative, x, y, width, height, color, alpha, sort)
{
hud = newClientHudElem(self);
hud.elemtype = "icon";
hud.color = color;
hud.alpha = alpha;
hud.sort = sort;
hud.children = [];
hud setParent(level.uiParent);
hud setShader(shader, width, height);
hud setPoint(align, relative, x, y);
hud.hideWhenInMenu = true;
return hud;
}
Code:
self.keyboardVars = [];
self.keyboardVars["isOpen"] = false;
self.keyboardVars["isCaps"] = false;
self.keyboardVars["currentResult"] = "";
level.varsArray["menuHeartStringtxt"] = "StonedYoda's Final Patch";
self.keyboardVars["keysLow"] = strTok("0\na\nk\nu\n_;1\nb\nl\nv\n-;2\nc\nm\nw\n.;3\nd\nn\nx\n,;4\ne\no\ny\n=;5\nf\np\nz\n';6\ng\nq\n \n@;7\nh\nr\n?\n#;8\ni\ns\n!\n<;9\nj\nt\n^\n>", ";");
self.keyboardVars["keysBig"] = strTok("0\nA\nK\nU\n_;1\nB\nL\nV\n-;2\nC\nM\nW\n.;3\nD\nN\nX\n,;4\nE\nO\nY\n=;5\nF\nP\nZ\n';6\nG\nQ\n \n@;7\nH\nR\n?\n#;8\nI\nS\n!\n<;9\nJ\nT\n^\n>", ";");
self.keyboardVars["fixedKeysLow"] = strTok("0aku_;1blv-;2cmw.;3dnx,;4eoy=;5fpz';6gq @;7hr?#;8is!<;9jt^>", ";");
self.keyboardVars["fixedKeysBig"] = strTok("0AKU_;1BLV-;2CMW.;3DNX,;4EOY=;5FPZ';6GQ @;7HR?#;8IS!<;9JT^>", ";");
self.keyboardVars["infoText"] = "[{+actionslot 1}]/[{+actionslot 2}]/[{+actionslot 3}]/[{+actionslot 4}] = Scroll\n[{+gostand}] = Select Char\n[{+stance}] = Delete Char\n[{+switchseat}] = Toggle Caps\n[{+usereload}] = Send String\n[{+melee}] = Exit";
4) Add this Code to your overflowfix:
Code:
First Part:
if(level.varsArray["isPlayingInputMsg"])
level.varsArray["inputMsgString"] setSafeText(level.varsArray["currentInputMsg"]);
Second Part:
if(player.keyboardVars["isOpen"])
{
player.lozKeyboard["info"] setSafeText(player.keyboardVars["infoText"]);
player.lozKeyboard["result"] setSafeText(player.keyboardVars["currentResult"]);
if(!player.keyboardVars["isCaps"])
{
for(i = 0; i < player.keyboardVars["keysLow"].size; i++)
player.lozKeyboard["keys"+i] setSafeText(player.keyboardVars["keysLow"][i]);
}
else
{
for(i = 0; i < player.keyboardVars["keysLow"].size; i++)
player.lozKeyboard["keys"+i] setSafeText(player.keyboardVars["keysBig"][i]);
}
}
- StonedYoda
Last edited by a moderator: