rejetto forum

Macros

Mars · 231 · 128915

0 Members and 2 Guests are viewing this topic.

Offline Foggy

  • Tireless poster
  • ****
    • Posts: 806
    • View Profile
they are some good ideas, I especially like the anti virus example. md5 I think can already be automatically generated, have a look inside the fingerprints menu.


Offline Foggy

  • Tireless poster
  • ****
    • Posts: 806
    • View Profile
to go with append, a macro to write at the beginning of a file could be quite useful. I know I would use such a macro so that I can load the file and execute and/or list the data in a certain order. I think the correct term for it is prepend.


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
instead of writing to file, prepend in a variable. {{set|x|here{{^x}}}}
at the end of it all, you'll save the variable in a file.


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2059
    • View Profile
{{save | file.txt|YOUR MESSAGE <br>{{load | chat.txt}} /save}}

to add at beginning of file

{{if|{{filesize | file.txt}}>lengthmax}}|
  {{save | file.txt|{{cut||maxfile|{{load | file.txt}} }} /save}}

to cut file if he is too long

it is what i use in chat.tpl


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
What about a macro that makes hfs execute an executable/bat?

i will think on it


Offline Foggy

  • Tireless poster
  • ****
    • Posts: 806
    • View Profile
This one is probably a big ask, but are arrays possible?


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
talk about your needs. how would you use it?


Offline Foggy

  • Tireless poster
  • ****
    • Posts: 806
    • View Profile
currently I am writing to a file a list, that is then parsed each time the page is loaded to get the most recent 25 entries and then 25 more in for each page.

problem is as you go further into the pages, the load on the server is greater because to find the items for that page I have to start start from the start of the list and loop through X times to eliminate the pages before the current one.

basically it would be eliminating this macro, because with an array I can just use a for loop directly on the values I am after. {{if|{{or|{{{{?p}}=1}}|{{not|{{?p}}}}}}||{{\{{for|B|1|{{sub|{{mul|{{^topic-limit}}|{{?p}}}}|25}}|{{\{{set|topic-order|{{cut|{{add|{{length|{{substring||;|{{^topic-order}}}}}}|2}}||{{^topic-order}}}}}}/}}/for}}/}}/if}}

the list is written like 1;2;3;4;5;... etc

on a side note I first tried that macro using if not but it had trouble with the quoting of the commands to execute.

I hope that made sense  :P


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
Next beta will be able to correctly run
Code: [Select]
{{random{{for|x|1|10|{{\|{{^x}}/}}/for}}/random}}
that is: a nestd macro will be able to expand to multiple parameters for the outer macro.
currently you are limited to just 1.


Offline TSG

  • Operator
  • Tireless poster
  • *****
    • Posts: 1935
    • View Profile
    • RAWR-Designs
I have 2 bugs.

1. Macro sections are giving me a line break again all of a sudden. Which breaks the code in places. (it happens on a sub page) the root is fine.

2. The load macro doesn't seem to work with a path... I need it to work with a path for my language files :)
« Last Edit: January 18, 2008, 07:43:36 AM by That_Stevens_Guy »


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
1. i made a test and it works just as #171. can you provide a way to reproduce it?

2. i made a test and it worked with path\file with ..\path\file and with \path\file
double check


Offline TSG

  • Operator
  • Tireless poster
  • *****
    • Posts: 1935
    • View Profile
    • RAWR-Designs
1. Yes, it happens on every sub directory for me... i've tested 172 and now 174. I go into sub directory and the macro gives a line break after the text.

2. I have this and it does nothing... {{load|..\template\rawr_default\languages\en_au.txt}}


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
1. i'm asking you to provide an example in form of template code. the smaller is the code, the better.

2. that is a relative path. relative paths are based on the HFS folder. is "template" folder right outside the folder you are running hfs.exe ?


Offline TSG

  • Operator
  • Tireless poster
  • *****
    • Posts: 1935
    • View Profile
    • RAWR-Designs
The template folder is next to hfs.exe and {{load isnt even appearing in the macro.log.
[special:strings]
{{load|template/rawr_default/languages/en_au.txt}} < the macro doesnt even appear in the log, even when i put the load part into a section.


and for the first thing an example would be.

var theme="{{$theme}}"

In root directory:
var theme="rawr_blue";

In sub directories:
var theme="rawr_blue
";

The sections where working fine everywhere until today... i was using 172 till a few mins ago.
« Last Edit: January 18, 2008, 08:13:05 AM by That_Stevens_Guy »


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
1. I just tested with #174
this was the test template
Code: [Select]
[theme]
hey
[]
"{{$theme}}"

then accessed / and it printed "hey"
then accessed /new%20folder/ and it printed "hey"

2. since load is never executed, it is not a bug in {{load}}
Indeed special:strings is considered simple text and macros are never executed.
I see 2 solutions, to be weighed:
a) to run macros in special:strings
b) to make HFS use variable {{^special:string}} (that you can load with the file), and if it's empty, use [special:strings]