Blockland Forums > Modification Help
Help a starter scripter
Chefzor:
Ill try to make something with that, thanks :) but i'd still like to get the script working.
Any ideas why it doesnt work?
Headcrab Zombie:
Post the error?
MagicAhrim:
--- Quote from: Headcrab Zombie on August 20, 2010, 07:29:32 PM ---Post the error?
--- End quote ---
Incase you don't understand just start blockland server then close go to your blockland folder contains addons folder and open console.txt and find your script and then post the error report.
Syntax:
Lol, or you can use an array
%this[0]="randomname";
%this[1]="randomname2";
%this[2]="randomname3";
%maxArray=2;
etc
then
%client.suffix/prefix=%this[getRandom(0,%maxArray)];
MegaScientifical:
--- Quote from: code ---function servercmdTavernPot(%client) {
switch(getrandom(1,10)) {
case 1:
%client.prefix=”handicapped”;
case 2:
%client.prefix=”Cozy”;
case 3:
%client.prefix=”Sleeping”;
case 4:
%client.prefix=”Traveling”;
case 5:
%client.prefix=”Wandering”;
case 6:
%client.prefix=”Lovely”;
case 7:
%client.prefix=”Curious”;
case 8:
%client.prefix=”Sleepy”;
case 9:
%client.prefix=”Harmless”;
case 10:
%client.prefix=”Dangerous”;
}
switch(getrandom(1,10)) {
case 1:
%client.suffix=”Pillow”;
case 2:
%client.suffix=”Bed”;
case 3:
%client.suffix=”Blanket”;
case 4:
%client.suffix=”Donkey”;
case 5:
%client.suffix=”Shoe”;
case 6:
%client.suffix=”Owl”;
case 7:
%client.suffix=”Monstrosoty”;
case 8:
%client.suffix=”Traveler”;
case 9:
%client.suffix=”Willow”;
case 10:
%client.suffix=”Dream”;
}
messageAll(%client,"<color:FFFFFF>" @ %client.prefix @ " <color:FFFF00>" @ %client.name @ "<color:FFFFFF>" @ %client.suffix @ " <color:FF00FF>might be a good name!");
}
--- End quote ---
What I came up with before reading the last message. I could make one his way, but don't feel like putting both in one message. (Don't know which he'd prefer.)
Edit: His method:
--- Quote from: code ---$RandCT::PreN = 0;
$RandCT::Pre[$RandCT::PreN++] = "handicapped";
$RandCT::Pre[$RandCT::PreN++] = "Cozy";
$RandCT::Pre[$RandCT::PreN++] = "Sleeping";
$RandCT::Pre[$RandCT::PreN++] = "Traveling";
$RandCT::Pre[$RandCT::PreN++] = "Wandering";
$RandCT::Pre[$RandCT::PreN++] = "Lovely";
$RandCT::Pre[$RandCT::PreN++] = "Curious";
$RandCT::Pre[$RandCT::PreN++] = "Sleepy";
$RandCT::Pre[$RandCT::PreN++] = "Harmless";
$RandCT::Pre[$RandCT::PreN++] = "Dangerous";
$RandCT::SufN = 0;
$RandCT::Suf[$RandCT::SufN++] = "Pillow";
$RandCT::Suf[$RandCT::SufN++] = "Bed";
$RandCT::Suf[$RandCT::SufN++] = "Blanket";
$RandCT::Suf[$RandCT::SufN++] = "Donkey";
$RandCT::Suf[$RandCT::SufN++] = "Shoe";
$RandCT::Suf[$RandCT::SufN++] = "Owl";
$RandCT::Suf[$RandCT::SufN++] = "Monstrosoty";
$RandCT::Suf[$RandCT::SufN++] = "Traveler";
$RandCT::Suf[$RandCT::SufN++] = "Willow";
$RandCT::Suf[$RandCT::SufN++] = "Dream";
function servercmdTavernPot(%client) {
messageAll(%client, "<color:FFFFFF>" @ (%client.prefix = $RandCT::Pre[getRandom($RandCT::PreN)]) @ " <color:FFFF00>" @ %client.name @ "<color:FFFFFF>" @ (%client.suffix = $RandCT::Suf[getRandom($RandCT::SufN)]) @ " <color:FF00FF>might be a good name!");
}
--- End quote ---
That should work. RandCT = Random Clantag. Pre = Prefix. Suf = Suffix. N = Num.