View unanswered posts | View active topics It is currently Fri, November 16th, 2018, 02:09



Reply to topic  [ 4 posts ] 
How to make an fxDTSBrick event? 
Author Message
User avatar

Posts: 1175
BL Name: TheToxicRadio
BL ID: 11076
Post How to make an fxDTSBrick event?
I need to make an event under the Self target for logging and have only a vague idea as to how. I want it to look something like this:

onActivate > Self > writeLogEntry [box in which you type in the log entry]

I think the actual code needs to be something like this:[code]function fxDTSBrick::writeLogEntry(%logText)
{
%DateTime = getDateTime();
textToFileAppend("["@%DateTime@"] "@%logText, CustomLog.txt); //this is defined in another file
}

registerOutputEvent("fxDTSBrick", "writeLogEntry", "what you do to make an input box goes here");
{
"Code to assign the stuff you put in the box to %entry goes here";
writeLogEntry(%entry);
}[/code] but I don't know how to make that into the event I want. Halp pls?


Sun, December 12th, 2010, 23:14
Profile
Global Moderator
User avatar

Posts: 650
BL Name: McTwist
BL ID: 9845
Post Re: How to make an fxDTSBrick event?
First, you have to make this admin only. Else, people will spam it for sure.
Secondly, I bet you didn't read here how it works:
[url]http://forum.blockland.us/index.php?topic=133435.msg2995588#msg2995588[/url]

So it should be like this:
[code]registerOutputEvent(fxDTSBrick, writeLogEntry, "string 128", 1); // Why I don't use quotation marks is because Torque makes it strings anyway

function fxDTSBrick::writeLogEntry(%brick, %logText, %client)
{
%DateTime = getDateTime();
textToFileAppend("["@$Server::created@"] "@%logText, CustomLog.txt); //this is defined in another file
}[/code]
And please save the creation time in the $Server::created variable!

_________________
[img]http://img115.imageshack.us/img115/2213/logoqn0zp3.png[/img]


Mon, December 13th, 2010, 08:25
Profile
User avatar

Posts: 1175
BL Name: TheToxicRadio
BL ID: 11076
Post Re: How to make an fxDTSBrick event?
I need the event to be host only, and the time logged is the time the log entry was made, not the server. Thus the code needs to be like this.[code]function fxDTSBrick::writeLogEntry(%brick, %logText, %client)
{
%DateTime = getDateTime();
textToFileAppend("["@%DateTime@"] "@%logText, CustomLog.txt); //this is defined in another file
}

registerOutputEvent("fxDTSBrick", "writeLogEntry", "string 128", 1);[/code]
Also, you never told me how to assign the player input to %entry.


Mon, December 13th, 2010, 22:02
Profile
Global Moderator
User avatar

Posts: 650
BL Name: McTwist
BL ID: 9845
Post Re: How to make an fxDTSBrick event?
The isHost method can be found here:
[url]http://wiki.returntoblockland.com/index.php?title=IsHost[/url]
Then, I don't see when you ask me for player input. The %logText contains what the player wrote in the event.
Also, to make the code more compact:
[code]function fxDTSBrick::writeLogEntry(%brick, %logText, %client)
{
textToFileAppend("["@getDateTime()@"] "@%logText, CustomLog.txt); //this is defined in another file
}

registerOutputEvent("fxDTSBrick", "writeLogEntry", "string 128", 1);[/code]

_________________
[img]http://img115.imageshack.us/img115/2213/logoqn0zp3.png[/img]


Tue, December 14th, 2010, 07:39
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.