Ulysses
General => Developers Corner => Topic started by: feldma on February 15, 2016, 02:25:23 AM
-
Hi all.
I'm working on stuff and I need to know if a few things are possible:
Firstly, is it possible to restrict a ULX command to once every, let's say, TTT round?
And is it possible to have a command that saves (such as "every round do this", but you can override that with a different command)?
I know this will require a fair amount of coding, but yeah, if anyone could point me in the right direction (if it's even possible).
Chances are I'll need to create an entirely new addon for this, no doubt.
Thanks,
Feldma.
-
Firstly, is it possible to restrict a ULX command to once every, let's say, TTT round?
Yes, but there isn't any premade ULib/ULX way to do it. Just slap an if statement in your code checking if a TTT round has passed since the last time it was called.
And is it possible to have a command that saves (such as "every round do this", but you can override that with a different command)?
Not exactly sure what you're asking for. If you want something to happen every round you can go ahead and put it in a hook (I would assume TTT has some round hooks). Then just have another command to remove that hook when called.
-
Not exactly sure what you're asking for. If you want something to happen every round you can go ahead and put it in a hook (I would assume TTT has some round hooks). Then just have another command to remove that hook when called.
They do indeed. They're listed here: http://ttt.badking.net/guides/hooks
-
Nevermind the last question, I'm going to need to think of a better way of doing what I want to do.
However, regarding the hooks, if I wished to use TTTPrepareRound(), would I do it like:
if TTTPrepareRound() then
-- code
end
Since I'm horrible at coding and hooks, I'm not sure if that would work.
-
Nevermind the last question, I'm going to need to think of a better way of doing what I want to do.
However, regarding the hooks, if I wished to use TTTPrepareRound(), would I do it like:
if TTTPrepareRound() then
-- code
end
Since I'm horrible at coding and hooks, I'm not sure if that would work.
No. You add hooks like this.
hook.Add(string eventname, string uniquehookname, function callback)
So, an example (for TTTBeginRound) would be:
hook.Add( "TTTBeginRound", "unique_name_goes_here", function()
-- code goes here
end
edit: whew it's been a while
-
Ahh, yes. I see now how that works.
Thanks.