functions.html 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <!DOCTYPE html>
  2. <html lang="en-US">
  3. <head>
  4. <title>SlideScript API: Functions &amp; built-in's ~ The Lazy Language</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  6. <meta name="viewport" content="width=device-width, initial-scale=1" />
  7. <meta name="description" content="SlideScript API and Documentation section - SlideScript is a micro stripting language with the intent to give the world an effective shell like experience with the ability to use a sloppy syntax! SlideScript can do simple every day shell tasks like manipulating and working with files, and directories, piping, variable support, and backquoting, with a bit of spice like: built-in md5, and encoder / decoder, webserver, networking functions, tar and compression functions, PLUS MORE!" />
  8. <link href="../style.css" rel="stylesheet" type="text/css" />
  9. </head>
  10. <body>
  11. <table><tr><td>
  12. <div class="header">
  13. <img src="../sslogo.png" class="logoimg" title="SlideScript logo" alt="SlideScript" />
  14. </div>
  15. </td></tr><tr><td>
  16. <div class="menu"><!--
  17. --><a href="../index.html">Home</a><!--
  18. --><a href="index.html">Documentation</a><!--
  19. --><a href="https://notabug.org/Pentium44/slidescript">Git</a><!--
  20. --></div>
  21. </td></tr></table>
  22. <div class="container">
  23. <p>Now that most of the basic built-in functions are aware, time to
  24. start playing with some of the more interesting parts of SlideScript.
  25. SlideScript does indeed seem more shell-like than anything but has its
  26. own unique abilities unlike other scripting languages.</p>
  27. <h2>Loop, comp, and if(n) statements</h2>
  28. <p>
  29. You can indeed compare values / process based on what's found around.
  30. For example, file functions like isdir and isfile return a true or false
  31. based on what they find. These returns can be used by some of the
  32. statement handling built into SlideScript's lexer.<br />
  33. <b>if(n):</b>
  34. <pre><code>
  35. #!/usr/bin/slidescript
  36. # Using isfile/isdir and if/ifn for determining when something needs to be done
  37. doesitexist=`isfile "test.txt"` # returns 0 / false
  38. ifn: %doesitexist%; write "test.txt" "created..." # If false, write
  39. if: %doesitexist%; cat "test.txt" "adding to file..." # if true, catenate
  40. </code></pre>
  41. <b>comp(are):</b>
  42. <pre><code>
  43. #!/usr/bin/slidescript
  44. # Using compare and if/ifn for determining if a string is similar or different
  45. string1=Testing strings
  46. string2=String testings
  47. match=`comp: "%string1%" "%string2%"`
  48. ifn: %match%; print "Different" # If false, different
  49. if: %match%; print "Same" # if true, same
  50. </code></pre>
  51. <b>loop:</b>
  52. <pre><code>
  53. #!/usr/bin/slidescript
  54. # Using compare and if/ifn for determining when something needs to be done
  55. count=5
  56. loop: %count%; print "Printing %count% times..."
  57. </code></pre>
  58. </p>
  59. <h2>Other system functions</h2>
  60. <p>
  61. SlideScript is a list of other functions that can be used at a given time
  62. or place: time, and sleep.
  63. <pre><code>
  64. #!/usr/bin/slidescript
  65. # Time example:
  66. time
  67. # Sleep example:
  68. sleep "3"
  69. print "Will print after 3 seconds..."
  70. </code></pre>
  71. </p>
  72. <h3>IRC server</h3>
  73. <p>
  74. Still need help? Want to report a bug? Join us!<br /><br />
  75. IP/Port: cddo.cc/1337<br />
  76. Main hang channel: <b>#theroot</b><br />
  77. FreeBox channel: <b>#freebox</b><br />
  78. FreonLinux channel: <b>#freonlinux</b>
  79. </p>
  80. </div>
  81. <div class="footer">
  82. &copy; Chris Dorman, 2021 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode">CC BY-NC-SA 4.0</a> - Software GPLv2 licensed<br />
  83. <p>
  84. Powered by:<br />
  85. <a href="https://freedns.afraid.org/">
  86. <img style="width:100px;" src="https://freedns.afraid.org/images/freedns_crop.png" />
  87. </a>
  88. <a href="https://letsencrypt.org/">
  89. <img style="width: 100px;" src="https://letsencrypt.org/images/le-logo-wide.png" />
  90. </a>
  91. <a href="http://jigsaw.w3.org/css-validator/check/referer">
  92. <img style="border:0;width:80px" src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS!" />
  93. </a>
  94. </p>
  95. </div>
  96. </body>
  97. </html>