IUrixl / VasaltScript

Work in progress

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

VasaltScript

Vasalt is a "programming language" made to see how far i can go using only batch. It's not intended to be a professional language so don't expect big things (building into .exe is not avaliable).

Batch Version

Download

You only need to download vasalt.bat, the other things can be deleted from your download :).

Index

Basic guide

Creation of files

To create a VasaltScript file, name your file to whatever you want and then add .vlt at the end.

Executing a file

In order to execute your file, you must go to the cmd and then type:

vasalt --run <file>.vlt

Check current version

If you want to check what version of Vasalt are you using type in the cmd the following command.

vasalt --version

Updating vasalt

If your version is uptodate, you must update vasalt. To do that, go to the cmd andtype:

vasalt --update

Vasalt cmdline

If you doubleclick vasalt you will open the cmdline of vasalt, meanwhile opening it from cmd while use the compiler mode.

Other method to run the cmdline is calling it by the cmd.

    vasalt --cmd

Vasalt help

    vasalt --help

Syntaxis basics

Commands syntaxis

Here at Vasalt, to use a command you must use "[]" instead of "()" like in other languages.

Command concatenation

Another function of Vasalt is concatenation, so in a specified list of command you can concate arguments.

Crash characters

The following characters may crash your script (depending on witch batch version are you using)

  ?

Exceptions: Os concatenation allow spaces at the beggining and tabulations.

Variables

Variables cannot be concatenated at the moment, to store multiple values on the same line you must create a StringBasedVar.

Normal variables

  $myVar Value1

StringBasedVars

  $myStringBasedVar "Value1 Value2"

Print

Basic print scripts

  print[Hello World]
  $myStringBasedVar "Hello World"
  print[$myStringBasedVar]
  $myStringBasedVar "How are you"
  print[Hello World $myStringBasedVar]

Os

Using os commands you can execute batch commands in a vasalt script.

Normal Os

  os[echo 1]
  os[cls]
  os[exit]

Concat Os

Concat a list of batch commands to be executed.

  os[concat
    cls
    echo 1
    echo 2
    echo 3
    exit
  ]

Wait

Normal Wait

Basic script example

print[Waiting 1 second]
wait[1]
print[Time waited succesfully]

Variable Wait

Basic script example

$secs = 4
print[Waiting $secs]
wait[$secs]
print[Succesfully waited $secs]

If

Tag can be changed to any text, it only works to identify the if to be closed and defined.

Boolean If

 $boolean true
 
 if $boolean [tag
    print[it's true]
 #else
    print[it's false]
 tag]

Params if

Params :

 equ = equal
 neq = not equal
 gtr = greater
 lss = less
 leq = less or equal
 geq = greater or equal
$myVar 1

if $myVar neq 0 [tag
    print[it's not 0]
#else
    print[it's 0]
tag]

Functions

Basic function example

function myFunc [
    print[Hello world]
>]

>myFunc

Passing args

function myFunc [
    {1} argInPos1
    print[$argInPos1]
>]

>myFunc "Hello world
print[My arg was $argInPos1]

Variable as argument

$var "Hello world"

function myFunc [
    {1} arg
    print[$arg]
>]

>myFunc $var
print[The var i sent was $var & the argument i recieved was $arg]

Import

Normal import

Don't add the .vlt at the end.

import file

As import

import file as f

Maths

Normal math

Spaces are not important here.

=[returnVar] 1+1
=[rV] 1 + 1

print[$returnVar & $rv]

Variable maths

Spaces are very important here.

$num1 1
$num2 5

=[rV] $num1 + $num2

print[rV]

Input

$textSample "works with vars too"
input[returnVar] Did you knew that inputs $textSample

print[$returnVar]

Input space at the end

input[rV] Input your age : \

print[$rV]

Quit

Makes the code quit running.

    quit

For

Range for

$start 1
$end 10
    
for yourVarIndex|yourContentVar r[$start|$end] [tag
    print[$yourVarIndex]
tag]
for i|v r[1|20] [f
    print[$i]
f]

String for

$myStr "Hello world this is my string"
    
for i|v $myStr [f
    print[Index : $i & Content $v]
f]

Libraries

Types of libraries

Basic libraries

They don't require to use import as, using import will work with them.

Advanced libraries

They require to use import as.

Importing

To import a library you must use import as

import myCoolLibrary as lib

Creating libraries

Basic

Basic library's functions can only be executed by the name written on the declaration.

function mylib.main [
    {1} arg
    print[$arg]
]
import mylib

>mylib.main "hello world"

Advanced

Advancd library's function's name can be assigned by the users using the import as method.

function -#-.main [
    {1} arg
    print[$arg]
]

import mylib as lib

>lib.main "hello world"

About

Work in progress

License:Other


Languages

Language:Batchfile 100.0%