dev

textPage 11 of 208
50 messages on this page
Friday, February 25, 2022
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
Couldn't do 'first' or 'last' since those are already helpers (which get prio over data in the handlebars engine) so I went with 'isFirst' and 'isLast' instead :)
{{#times 10}}
    first: {{isFirst}}
    index: {{index}}
    last: {{isLast}}
{{/times}}
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
๐Ÿ‘€
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
I'll try and add it tonight but not sure how much PC time I'll have o.o
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
Ooh I see, looks useful for sure
Avatar for 6ceaf41ff27d04ff247f59c1bc5a9f4cc4ace95acc526862d52cdbbb8702989b
User 6ceaf4
So a {{times 10}} would do a loop ten times, allowing the use of {{@first}} {{@index}} and {{@last}}
Avatar for 6ceaf41ff27d04ff247f59c1bc5a9f4cc4ace95acc526862d52cdbbb8702989b
User 6ceaf4
Found this online for a For loop:
Handlebars.registerHelper('times', function(n, block) {
    var accum = '';
    for(var i = 0; i < n; ++i) {
        block.data.index = i;
        block.data.first = i === 0;
        block.data.last = i === (n - 1);
        accum += block.fn(this);
    }
    return accum;
});
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
What do you have in mind? I can help you write code to get this running
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
Depends on what you mean
CSMM is open source so you can always submit new code which then becomes part of core CSMM (provided that I review and approve the code ofc)
If you mean, add helpers 'during runtime', then no, I don't think that's possible with Handlebars. All helpers need to be registered when the app initializes
Avatar for 6ceaf41ff27d04ff247f59c1bc5a9f4cc4ace95acc526862d52cdbbb8702989b
User 6ceaf4
Can
I
directly add a custom helper? Or is it something only you can do?
Sunday, February 13, 2022
Avatar for 374c5d8a234dd3a84b2e7712113bccfc34abaf33083b895e688b9899a24261ca
User 374c5d
ah
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
No new feature, just an update to the docs
Avatar for 374c5d8a234dd3a84b2e7712113bccfc34abaf33083b895e688b9899a24261ca
User 374c5d
ooo what new feature?
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
Merged, many thanks for your contribution @User 59898394 โค๏ธ
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
So I can see the two changes files there
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
Clicked the create PR button which sent me to
unknown.png

unknown.png

PNG โ€ข 146.2 KB

Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
No content
unknown.png

unknown.png

PNG โ€ข 89.6 KB

Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
I think I can do it from your repo :P
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
but I think you have to make a new PR to submit the changes to the main repo
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
That looks good actually, I can see the updated images inside your frok
Saturday, February 12, 2022
Avatar for 6ceaf41ff27d04ff247f59c1bc5a9f4cc4ace95acc526862d52cdbbb8702989b
User 6ceaf4
tried again. Seems to lead me to the same place
Thursday, February 10, 2022
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
Would you mind pressing that green button again? I don't have a new PR yet
https://github.com/CatalysmsServerManager/docs/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-desc
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
Most definitly is not ๐Ÿ˜„
Avatar for 6ceaf41ff27d04ff247f59c1bc5a9f4cc4ace95acc526862d52cdbbb8702989b
User 6ceaf4
I've made a commitment in my branch... I think. gitHub is not quite noob friendly.
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
Didn't know how/where to add them
-> they're hidden 15 sub folders deep so can't blame ya :p
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
I didnt think of replacing those x.x
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
Ooh nice thanks
Avatar for 6ceaf41ff27d04ff247f59c1bc5a9f4cc4ace95acc526862d52cdbbb8702989b
User 6ceaf4
Didn't know how/where to add them
Avatar for 6ceaf41ff27d04ff247f59c1bc5a9f4cc4ace95acc526862d52cdbbb8702989b
User 6ceaf4
First and last image replacement for PR 365 changes @User 22055452
unknown.png

unknown.png

PNG โ€ข 14.8 KB

unknown.png

unknown.png

PNG โ€ข 11.3 KB

Monday, January 31, 2022
Avatar for 782482abf424b2bae1ad30d5e03e4eb15f674c2d8e68c5a057fb0bd10de0878e
User 782482
๐Ÿ˜ฎ this would have been so handy a few days ago ๐ŸŽ‰
Avatar for 6ceaf41ff27d04ff247f59c1bc5a9f4cc4ace95acc526862d52cdbbb8702989b
User 6ceaf4
It will wait if I want to, lol
{{setVar (add "player:control:" player.steamId) (date "hhmmss")}} 
{{setVar (add "player:counter:" player.steamId) 1}}
{{/if}}

{{#if (lt 10 (subtract (date "hhmmss") (getVar (add "player:control:" player.steamId)) ))}} 
{{setVar (add "player:control:" player.steamId) (date "hhmmss")}} 
{{setVar (add "player:counter:" player.steamId) 1}}
{{else}}

{{#if (gte (getVar (add "player:counter:" player.steamId)) 3)}};
    say "Command will fire {{getVar (add "player:counter:" player.steamId)}} time.";
    {{setVar (add "player:counter:" player.steamId) (add 1 (getVar (add "player:counter:" player.steamId)))}}
    {{else}}
        say "Command will fail {{getVar (add "player:counter:" player.steamId)}} time.";
        {{setVar (add "player:counter:" player.steamId) (add 1 (getVar (add "player:counter:" player.steamId)))}}
    {{/if}}
{{/if}}```
Sunday, January 30, 2022
Avatar for e5e1a1e030d906e6b0758aa714298a47ac1eb96bd571c5acc968a191bb9574fb
User e5e1a1
and allows waits
Avatar for e5e1a1e030d906e6b0758aa714298a47ac1eb96bd571c5acc968a191bb9574fb
User e5e1a1
w2l is a nice tidy way to chain hooks together :)
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
  • One hook fires when the log line you are interested in appears, this increments a counter
  • A different hook which checks the counter, if it's higher than x then it does something
  • A cronjob that resets the counter every x time. (or maybe a hook here too? Something to reset the counter)
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
Or would need a proper environment like an imperative language (js, python, smth like that)
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
It would need the conditional stuff added as custom functions I suppose
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
I don't know if this'll be possible in one hook like this
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
Hmm I think I was mistaking in thinking that I was solving your usecase :p
Avatar for bc43431b65cc8f7fb88ae66e5cfbe175a39472cbc3db92f842c7a016ee80c451
User bc4343
wait(10);
getVar("player:counter:" player.steamId)

{{#if (lte (getVar (add "player:counter:" player.steamId)) 1)}};
say "Command will fail {{getVar (add "player:counter:" player.steamId)}} time.";


{{/if}}

{{#if (gte (getVar (add "player:counter:" player.steamId)) 3)}};

say "Command will fire {{getVar (add "player:counter:" player.steamId)}} time.";


{{/if}}```
Avatar for bc43431b65cc8f7fb88ae66e5cfbe175a39472cbc3db92f842c7a016ee80c451
User bc4343
On staging, Am I on the right path here?
I get the feeling that it's still reading the
{{#if (lte (getVar (add "player:counter:" player.steamId)) 1)}};
or
{{#if (gte (getVar (add "player:counter:" player.steamId)) 3)}};
everytime the hook fires , do I need to get them out of handlebars so it doesn't get read before the wait(x) finishes, also I'm guessing the setVar at the start would need to be in {{}} so it does gets read first?
Avatar for 6ceaf41ff27d04ff247f59c1bc5a9f4cc4ace95acc526862d52cdbbb8702989b
User 6ceaf4
Pass ๐Ÿ˜› lol.
Avatar for e5e1a1e030d906e6b0758aa714298a47ac1eb96bd571c5acc968a191bb9574fb
User e5e1a1
by adding a server ๐Ÿ™‚
Avatar for 6ceaf41ff27d04ff247f59c1bc5a9f4cc4ace95acc526862d52cdbbb8702989b
User 6ceaf4
Not afraid to sound dumb, but I have no servers there, how do I access playground?
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
Aka the 'develop' branch on git ๐Ÿ˜„
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
staging.csmm.app
Avatar for 6ceaf41ff27d04ff247f59c1bc5a9f4cc4ace95acc526862d52cdbbb8702989b
User 6ceaf4
I have no idea what that means.
Avatar for bddf696212701f4e2e40cc177bb39c1f9c5f0a4ce49c307b79e8101c2a98158e
User bddf69
See the thing I replied to for the more detailed explanation