rejetto forum

Macros

Mars · 231 · 127986

0 Members and 1 Guest are viewing this topic.

Offline TSG

  • Operator
  • Tireless poster
  • *****
    • Posts: 1935
    • View Profile
    • RAWR-Designs
Rejetto is correct, an extended version of my shoutbox would make a guestbook.

SilentPliz and Mars have put together a chat, I think using the methods in mine and javascript used in their chat would make a nice guestbook. I would have a play but I haven't got the time. I am focusing my attention to releasing RAWR-Player with FLV support, Terayon written on the base code of RAWR-Template and TPGen (we are up to making the interface).

Thanks rejetto for the macro. Will try it out with next release, most likely when RAWR-Player has FLV support I will release new builds of the templates.


Offline Andrew-Sirius

  • Occasional poster
  • *
    • Posts: 16
    • View Profile
if they made a shoutbox, you can make a guestbook

But shoutbox uses external server. My HFS is established in the local network without the output into the Internet; therefore I want so that the messages in the guest book would remain locally in the same machine, where was established HFS


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
the shoutbox embedded in the RAWR template doesn't use external servers to provide the shoutbox.


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2059
    • View Profile
Quote
the shoutbox embedded in the RAWR template doesn't use external servers to provide the shoutbox.

Yes it is , as this link https://silentplizssl.serveftp.net/chat/
login anonymous
pass anonymous

all is made with internal template


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile

Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2059
    • View Profile
I did not find normal that the use of the value true or quite other text is the opposite of 0 or an empty string

So, with these two functions  modified in main.pas it is possible to restore the correctness of the values.

A negation will be represented well by an empty string, 0 or false.

I insist with Rejetto so that he made them appear constantly in the future versions of HFS ;)

Quote
  function isFalse(s:string):boolean;
  begin
  s:=trim(s);                                                                 ///mars
  result:=(lowercase(s)='false') or stringExists(s, ['','0']);   ///mars
  end;

  function isTrue(s:string):boolean; inline;
  begin
  result:=(lowercase(trim(s))='true') or not isFalse(s);       ///mars
  end;

With it you can use macro requiring a parameter true or false without asking you the question to know which syntax to use.

To test a template it will be more understandable to write
{.If|false|.... .}, {.If|FALSE|.... .}, {.If|   false   |.... .} at choice rather than  {.if||.... .} or {.if|0|.... .}


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
it's widely accept in the technical world that special cases should be kept at a minimum. I fear having more special strings for false could create problems.
About the reason you report, use "if not" instead. It's very readable, isn't it?
If you have other reasons, we can discuss them.

in the while, i can suggest you that stringExists is case insensitive, so you can use
result:=stringExists(trim(s), ['','0','false'])
if you like...


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2059
    • View Profile
Quote
in the while, i can suggest you that stringExists is case insensitive, so you can use
result:=stringExists(trim(s), ['','0','false'])
if you like...

The syntax is good and reacts as I wish it, it is accepted for my part and already in the French version of silentpliz

****************************

One the other macro is incorporated into it:  {.add to log| your text.}  ( ;) to Rejetto)
Quote
  if name = 'add to log' then  //Add by mars
    begin
    mainfrm.add2log(p);
    result:='';
    end;
this macro put  'your text' in the log box of hfs.
I use it rather often to test the templates, instead of the dialog macro.





Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
and what about this
Code: [Select]
    if name = 'add to log' then
      begin
      mainfrm.add2log(p, md.cd, StringToColor(parEx(1,'color')) );
      result:='';
      end;


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2059
    • View Profile
and what about this
Code: [Select]
    if name = 'add to log' then
      begin
      mainfrm.add2log(p, md.cd, StringToColor(parEx(1,'color')) );
      result:='';
      end;


I give the good macro syntax, but the macro code has a bug ;)

{.add to log| message blue |$F00000.}   {.add to log| message blue |ClBlue.}
{.add to log| message green |$00F000.}   {.add to log| message green |ClGreen.}
{.add to log| message red |$0000F0.}   {.add to log| message red |ClRed.}

 but the macro code has a bug, to correct it:

Quote
    if name = 'add to log' then
      begin
      mainfrm.add2log(p, NIL , StringToColor(parEx(1,'color')) );
      result:='';
      end;

Otherwise the macro does not work when it is used in the hfs.events because there is no active connection during its call ;)

The ideal would be to have as possible syntax:

{.add to log| message blue |$F00000| message green |$00F000| message red |$0000F0.}

And to obtain in the log the result following on a line
00:13:11 message blue message green message red

It is just a little work in more for rejetto in the conception of the procedure add2log() ...

I count on him to take up the challenge, and to find us a solution which is as high as my waits. ;) ;D
« Last Edit: February 01, 2009, 11:25:25 PM by mars »


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
i think that's not the right way to fix it.
in event scripts md.cd should just be NIL, and thus equivalent to your constant NIL.
what's missing is the clearing of md.
fixed in next build.

about colors: it's nice, but don't know if it's important enough to take all parameters of "add to log". We may need additional parameters in the future.


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2059
    • View Profile
Quote
about colors: it's nice, but don't know if it's important enough to take all parameters of "add to log". We may need additional parameters in the future.

It would allow to put in evidence of the particular elements in the string shown by the log, for example certain variables as %user%  and other , or to put in evidence in red of the specific alerts in the middle of a sentence and many other possibilities, if I make the demand it is that that will allow to see all this with a little more colour ;)


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
i didn't say i don't understand how it would be useful. re-read. ;)


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2059
    • View Profile
Then you will want to use maybe rather this syntax  ;D

{.add to log| [ color=blue] message blue [ /color] [ color=green] message green [ /color] [ color=red] message red [ /color] .}


Offline Chrisp6825

  • Occasional poster
  • *
    • Posts: 20
    • View Profile
Hi. How would I do this? :


Code: [Select]
<script type="text/javascript">
var path = document.location.pathname;
var dir = path.substring(path.indexOf('/', 1)+1, path.lastIndexOf('/'));
</script>

{.set|directory|dir.}

Where it sets 'directory' to equal the value of 'dir' in javascript...
I cant figure it out.