Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Greek2me

Pages: 1 ... 3 4 5 6 7 [8] 9 10
106
I always thought that there needed to be a default function to do this, but there isn't, so here you go:



Code: (addKeyBind) [Select]
function addKeyBind(%div,%name,%cmd,%device,%action,%overWrite)
{
if(%device !$= "" && %action !$= "")
{
if(moveMap.getCommand(%device,%action) $= "" || %overWrite)
moveMap.bind(%device,%action,%cmd);
}

%divIndex = -1;
for(%i=0; %i < $RemapCount; %i++)
{
if($RemapDivision[%i] $= %div)
{
%divIndex = %i;
break;
}
}

if(%divIndex >= 0)
{
for(%i=$RemapCount-1; %i > %divIndex; %i--)
{
$RemapDivision[%i+1] = $RemapDivision[%i];
$RemapName[%i+1] = $RemapName[%i];
$RemapCmd[%i+1] = $RemapCmd[%i];
}

$RemapDivision[%divIndex+1] = "";
$RemapName[%divIndex+1] = %name;
$RemapCmd[%divIndex+1] = %cmd;
$RemapCount ++;
}
else
{
$RemapDivision[$RemapCount] = %div;
$RemapName[$RemapCount] = %name;
$RemapCmd[$RemapCount] = %cmd;
$RemapCount ++;
}
}
This adds a keybind, and if desired can forcibly or non-forcibly bind it to a key.

Code: (EXAMPLE) [Select]
addKeyBind("Division","Name","command","keyboard","alt f",0);Division - If the division used already exists, the bind will be added under the existing division.
Name - The name of the bind.
Command - The command called when this bind is used. The function called has one variable for the state of the bound key (bool up/down).
Device - This is not needed for normal use! This is used when setting the bind to a key. (keyboard/mouse)
Action - This is not needed for normal use! This is used when setting the bind to a key. Set this to an action such as "shift G" or "alt v".
Overwrite - This is not needed for normal use! This is used when setting the bind to a key. If this is true, any existing binding using the specified device/action will be overwritten. (bool)




Code: (removeKeyBind) [Select]
function removeKeyBind(%div,%name,%cmd)
{
%binding = moveMap.getBinding(%cmd);
%device = getField(%binding,0);
%action = getField(%binding,1);

if(%device !$= "" && %action !$= "")
moveMap.unBind(%device,%action);

for(%i=0; %i < $RemapCount; %i++)
{
%d = $RemapDivision[%i];
%n = $RemapName[%i];
%c = $RemapCmd[%i];

%start = 0;

if(%n $= %name && %c $= %cmd && (%d $= %div || %lastDiv $= %div))
{
%start = %i + 1;
break;
}

if(%d !$= "")
%lastDiv = %d;
}

if(%start > 0)
{
for(%i=%start; %i < $RemapCount; %i++)
{
$RemapDivision[%i-1] = $RemapDivision[%i];
$RemapName[%i-1] = $RemapName[%i];
$RemapCmd[%i-1] = $RemapCmd[%i];
}

%d = $RemapDivision[%start-1];
if(%d $= "")
$RemapDivision[%start-1] = %div;

$RemapDivision[$RemapCount-1] = "";
$RemapName[$RemapCount-1] = "";
$RemapCmd[$RemapCount-1] = "";

$RemapCount --;
}
}
This removes an existing keybind properly.

Code: (EXAMPLE) [Select]
removeKeyBind("Division","Name","command");Division - This division will remain if there are still other binds under it.
Name - The name of the bind.
Command - The command called when this bind is used.



Hope this helps people!

107
Chat is a sensitive thing that breaks if you don't do things right, so please check my function to make sure I'm not doing anything wrong.

Code: [Select]
function servercmdMessageSent(%client,%msg)
{
%msg = stripMLControlChars(trim(%msg));
%time = getSimTime();

if(%msg $= "")
return;

%mini = getMinigameFromObject(%client);
%team = %client.getTeam();

%name = %client.getPlayerName();
%pre  = %client.clanPrefix;
%suf  = %client.clanSuffix;

if(%mini.isSlayerMinigame)
{
if(%client.dead() && !%mini.allowDeadTalk)
{
messageClient(%client,'',"\c5No, you can't talk. How many dead people do you know that can talk?");
return;
}

if(isObject(%team))
{
%tColor = %team.getPref("Chat","Name Color");
if(%tColor $= "" || strLen(%tColor) != 6)
%color = %team.getColorHex();
else
%color = "<color:" @ %tColor @ ">";

switch(%mini.chat_teamDisplayMode)
{
case 1:
%all  = '%5%1\c3%2%5%3\c6: %4';

case 2:
%all  = '\c7%1%5%2\c7%3\c6: %4';

case 3:
%all  = '\c7[%5%6\c7] %1\c3%2\c7%3\c6: %4';
}
}
}

if(%all $= "")
%all  = '\c7%1\c3%2\c7%3\c6: %4';

//did they repeat the same message recently?
if(%msg $= %client.lastMsg && %time-%client.lastMsgTime < $SPAM_PROTECTION_PERIOD)
{
if(!%client.isSpamming)
{
messageClient(%client,'',"\c5Do not repeat yourself.");
if(!%client.isAdmin)
{

%client.isSpamming = 1;
%client.spamProtectStart = %time;
%client.schedule($SPAM_PENALTY_PERIOD,spamReset);
}
}
}

//are they sending messages too quickly?
if(!%client.isAdmin && !%client.isSpamming)
{
if(%client.spamMessageCount >= $SPAM_MESSAGE_THRESHOLD)
{
%client.isSpamming = 1;
%client.spamProtectStart = %time;
%client.schedule($SPAM_PENALTY_PERIOD,spamReset);
}
else
{
%client.spamMessageCount ++;
%client.schedule($SPAM_PROTECTION_PERIOD,spamMessageTimeout);
}
}

//tell them they're spamming and block the message
if(%client.isSpamming)
{
spamAlert(%client);
return;
}

//eTard Filter, which I hate, but have to include
if($Pref::Server::eTardFilter)
{
%list = strReplace($Pref::Server::eTardList,",","\t");

for(%i=0; %i < getFieldCount(%list); %i++)
{
%wrd = getField(%list,%i);
if(strStr(" " @ %msg @ " ",%wrd) != -1)
{
messageClient(%client,'',"\c5This is a civilized game. Please use full words.");
return;
}
}
}

//URLs
%pos = striPos(%msg,"http://");
if(%pos >= 0)
{
%url = getSubStr(%msg,%pos+7,striPos(%msg," ",%pos));
%msg = strReplace(%msg,"http://" @ %url,"<a:" @ %url @ ">" @ %url @ "</a>");
}

commandToAll('chatMessage',%client,'','',%all,%pre,%name,%suf,%msg,%color,%team.name);
echo(%client.getPlayerName() @ ":" SPC %msg);

%client.lastMsg = %msg;
%client.lastMsgTime = %time;

if(%mini.isSlayerMinigame)
{
if(isFunction("Slayer_" @ %mini.mode @ "_onChat"))
call("Slayer_" @ %mini.mode @ "_onChat",%mini,%client,%msg);
}
}

108
Modification Help / TypeMasks, what are they?
« on: December 06, 2011, 06:49:39 PM »
What are typemasks and are they server or client-sided? I know that doing something like (%player.getType() & $TypeMasks::PlayerObjectType) returns whatever $TypeMasks::PlayerObjectType is, but that's about all I know.

109
Modification Help / [Resource] Unofficial? Torque Documentation
« on: December 06, 2011, 06:33:03 PM »
I just stumbled across a document called "Notes on Torque Game Engine" that appears to be unofficial documentation.

It's a 71 page word document that appears to contain:
 - history of the engine
 - details of scripting in Torquescript (including some very handy datablock/object/function references)
 - datablocks and the class/type system
 - examples! (animation, teleporter, racing, door, weapon, players/bots, damage, rifle scoping, capture the flag, AI system)
 - GUI creation
 - exporting models so they can be used ingame

Download - It's hosted on a random site I found on Google.
Word 2003 Document (.doc), 1.1 MB

110
Modification Help / Strip Trailing Zeros
« on: November 11, 2011, 08:40:13 PM »
Is there a default function to trim the trailing zeros from an integer? For example, 1.0 would become 1, 2.5300 would become 2.53, etc.

Now I know that this is really easy to do when the number is stored as an integer, but in this case it's stored as a string. Also, simply returning the integer using eval("return" SPC %int @ ";"); won't work because there's the possibility that %int could be a non-integer string since this will be used in a function that checks if something is an integer.


Please see below.

111
Not sure where to post this exactly, but anyway...

If someone plants a spawn brick and then leaves the server, will other people still spawn at the spawn brick they planted?

112
Gallery / [SS] ScatteredSpace Dogfight Server
« on: October 09, 2011, 07:59:57 PM »

          - DOGFIGHT SERVER









Yes, it's finally back! The ScatteredSpace Dogfight! After more than eight months of work, we've finally finished it. Come check it out for yourself, but first, here's some pictures for you!





The server has been completely remade, including new weapons, new vehicles, a new map and build, and new scripts.




Ground vehicles on the larger island allow for a mixture of aerial and ground based warfare.




A central bridge acts as a flashpoint for ground warfare, with several bases built on top of the hills that offer a strategic advantage and a dangerous archway beneath it.




Sniping towers and control points dot the smaller ring islands. In the background you can see the aircraft carriers that are signature of ScatteredSpace dogfights.




Several hangars are situated on the main island that are control points and provide a plane if you're stranded.




The setup is roughly symmetrical to provide fair game-play for both teams.




Many bases located on the islands provide a place to take cover and rest, as well as housing control points.




The interiors of the bases are fairly open, allowing for a nice breeze in the summer (and to make fighting easier).




The archway under the bridge is quite dangerous, especially for vehicles. "Dragon's Teeth" restrict vehicle travel, encouraging hand-to-hand combat. In addition, several barrels of explosives are contained in the structure, so be careful where you shoot.




Control points can be strategically important, depending on the gamemode. In the future, controlling a certain percentage of them will win the game for your team! In addition, they can contain items like pills and guns.




Of course, the hallmark ScatteredSpace aircraft carriers are included, with two per team.




A map provides a reference of where control points are located. The boat deck can be seen in the background.




What are you waiting for? Join the server now to see for yourself!









Please feel free to rate the server and the build in the X/10 form. However, this is NOT a complaint thread! Bring your complaints about bans here, and anything else to Drama!

113
Modification Help / Parent-Child relations
« on: September 22, 2011, 08:47:54 PM »
So I created a scriptObject using the code below:
Code: [Select]
%this.Mini = new scriptObject()
{
class = SlyrMinigameSO;
superClass = MinigameSO;
};

What I want to happen is that when someone packages a function like MinigameSO::Reset() that packaged function is also called when SlyrMinigameSO::Reset() is called. Is that possible?

114
Modification Help / Slayer
« on: September 18, 2011, 09:39:34 PM »
Slayer
That Game Mode With Teams

Important Links
New Forum Topic & DOWNLOADS
Bitbucket Page
mods.greek2me.us

If anyone wants to script one of these gamemodes, please go ahead:
  • Rush - It's pretty much just Search & Destroy but with multiple bombs. When a CP is captured players can spawn there.
  • Cops & Robbers - Standard Cops & Robbers game. When robber is hit by hammer (or maybe killed) they go to jail. Others can break them out. Goal of Cops is to jail all robbers. Goal of Robbers is ??? (maybe to capture the money and escape with it?)
v21 Blockland Game Modes
Slayer v3.4 allows Game Mode makers to use Slayer in place of the BL dedicated minigame.

To use Slayer in your game mode:
  • Create a Slayer minigame and set it up the way you want it for the game mode.
  • End the minigame.
  • Go to "config/server/Slayer" and find the file called "config_last.cs".
  • Rename the file to "config_slayer.cs" and place it in GameMode_YourGameMode.zip.
  • Add the line "ADDON Gamemode_Slayer" to your gameMode.txt file.
  • Make sure that "$Minigame::Enabled 1" is not in your gameMode.txt file.
Documentation (VERY Out of date)
Download
This includes modding documentation.

News
  • 5/19/14 - Development topic locked.
  • 4/13/14 - Version 3.8 released.
  • 2/23/13 - Version 3.7 released. (fly-through cameras)
  • 12/10/12 - Version 3.6 released.
  • 11/1/12 - Version 3.5.1 released.
  • 10/21/12 - Version 3.5 released.
  • 9/23/12 - Version 3.4.1 released.
  • 9/16/12 - Version 3.4 released.
  • 9/9/12 - Version 3.3.1 released.
  • 8/16/12 - Version 3.3 released.
  • 7/5/12 - Version 3.2 released.
  • 6/6/12 - Version 3.1.1 released.
  • 5/27/12 - Version 3.1 released.
  • 4/6/12 - Version 3.0.1 released.
  • 3/22/12 - Version 3.0 released.
  • 11/15/11 - One Man Army gamemode released.
  • 11/13/11 - Version 2.5 released.
  • 11/6/11 - Version 2.4.1 released.
  • 10/30/11 - Version 2.4 released.
  • 10/17/11 - Version 2.3.1 released.
  • 10/15/11 - Version 2.3 released.
  • 10/6/11 - Version 2.2.1 released.
  • 10/1/11 - Version 2.2 released. Check out the change log!
  • 9/19/11 - Version 2.1.1 released.
  • 9/17/11 - Version 2.1 released.
  • 9/12/11 - Version 2.0.3 released.
  • 9/11/11 - Version 2.0.1 and 2.0.2 released. Capture the Flag, Search & Destroy, Bounty Hunter, and Territory gamemodes released.
  • 9/10/11 - Slayer v2.0 released.

115
Modification Help / Check if font exists?
« on: September 01, 2011, 08:56:10 PM »
Is there a way to check if the computer running BL has a specific font loaded on it?

116
Suggestions & Requests / [BL Suggestion] Input Event Parameters
« on: August 10, 2011, 03:01:21 PM »
This is not a suggestion for add-ons! This is a suggestion for Badspot to include in a future version of Blockland.

Input Event Parameters - By Truce

They'd open up tons of new modding opportunities and clean up the input event list by allowing a single event with a parameter to take the place of many events.

An example showing the changed Events GUI. Note the parameters on the left.


There hasn't been an update to the event system in a long time, and I think this is extremely needed.

117
Modification Help / add velocity in direction player is facing
« on: August 04, 2011, 10:45:02 PM »
How do I add velocity to something in the direction a player is facing?

118
Modification Help / Weird issue with hammer copy
« on: July 07, 2011, 04:21:11 PM »
Nevermind, locking.

119
Modification Help / Default font and size
« on: June 28, 2011, 04:30:54 PM »
What's the default font and size used in GuiMLTextCtrls and stuff like that?

Nevermind, I can just use <sPush> and <sPop> to revert to normal font. Locking

120
Modification Help / HTTPObject: get line count
« on: June 23, 2011, 04:31:05 PM »
How can I get the number of lines in a file using an httpObject?

I get the file by doing: httpObject.get("url.com:80","/file.zip");

Pages: 1 ... 3 4 5 6 7 [8] 9 10