slidescript/misc/api/functions.html

105 lines
3.9 KiB
HTML

<!DOCTYPE html>
<html lang="en-US">
<head>
<title>SlideScript API: Functions &amp; built-in's ~ The Lazy Language</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<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!" />
<link href="../style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table><tr><td>
<div class="header">
<img src="../sslogo.png" class="logoimg" title="SlideScript logo" alt="SlideScript" />
</div>
</td></tr><tr><td>
<div class="menu"><!--
--><a href="../index.html">Home</a><!--
--><a href="index.html">Documentation</a><!--
--><a href="https://notabug.org/Pentium44/slidescript">Git</a><!--
--></div>
</td></tr></table>
<div class="container">
<p>Now that most of the basic built-in functions are aware, time to
start playing with some of the more interesting parts of SlideScript.
SlideScript does indeed seem more shell-like than anything but has its
own unique abilities unlike other scripting languages.</p>
<h2>Loop, comp, and if(n) statements</h2>
<p>
You can indeed compare values / process based on what's found around.
For example, file functions like isdir and isfile return a true or false
based on what they find. These returns can be used by some of the
statement handling built into SlideScript's lexer.<br />
<b>if(n):</b>
<pre><code>
#!/usr/bin/slidescript
# Using isfile/isdir and if/ifn for determining when something needs to be done
doesitexist=`isfile "test.txt"` # returns 0 / false
ifn: %doesitexist%; write "test.txt" "created..." # If false, write
if: %doesitexist%; cat "test.txt" "adding to file..." # if true, catenate
</code></pre>
<b>comp(are):</b>
<pre><code>
#!/usr/bin/slidescript
# Using compare and if/ifn for determining if a string is similar or different
string1=Testing strings
string2=String testings
match=`comp: "%string1%" "%string2%"`
ifn: %match%; print "Different" # If false, different
if: %match%; print "Same" # if true, same
</code></pre>
<b>loop:</b>
<pre><code>
#!/usr/bin/slidescript
# Using compare and if/ifn for determining when something needs to be done
count=5
loop: %count%; print "Printing %count% times..."
</code></pre>
</p>
<h2>Other system functions</h2>
<p>
SlideScript is a list of other functions that can be used at a given time
or place: time, and sleep.
<pre><code>
#!/usr/bin/slidescript
# Time example:
time
# Sleep example:
sleep "3"
print "Will print after 3 seconds..."
</code></pre>
</p>
<h3>IRC server</h3>
<p>
Still need help? Want to report a bug? Join us!<br /><br />
IP/Port: cddo.cc/1337<br />
Main hang channel: <b>#theroot</b><br />
FreeBox channel: <b>#freebox</b><br />
FreonLinux channel: <b>#freonlinux</b>
</p>
</div>
<div class="footer">
&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 />
<p>
Powered by:<br />
<a href="https://freedns.afraid.org/">
<img style="width:100px;" src="https://freedns.afraid.org/images/freedns_crop.png" />
</a>
<a href="https://letsencrypt.org/">
<img style="width: 100px;" src="https://letsencrypt.org/images/le-logo-wide.png" />
</a>
<a href="http://jigsaw.w3.org/css-validator/check/referer">
<img style="border:0;width:80px" src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS!" />
</a>
</p>
</div>
</body>
</html>