Sanny Builder Syntax

springfield

Well-Known Member
Staff member
Joined
Feb 18, 2005
Messages
2,931
Likes
6
Points
38
Website
www.ugbase.eu
#1
First of all, what does syntax mean? I'm too dumb to explain it myself so i'll quote wikipedia  :trollface:

In linguistics, syntax is "the study of the principles and processes by which sentences are constructed in particular languages."

How does that relate to SB? Well, sanny can understand and compile code in two syntaxes;
- Low level coding/statements
- High level coding/statements

Low level is mostly relying on labels:)start, @start, jump @start, jf @start)
It's messy and hard to understand if you code is bigger or more complex.
It's also the way sanny outputs decompiled scripts.

Example;


High level is logical, simpler to use and easier with bigger and complex scripts. It also looks more clean.

Example;



They basically work the same, there's nothing you can do in one and not the other. It all depends on how easier each one is for you. If you're new to cleo scripting i suggest using a mix of both.

Low level statements:


Code:
:label
Defines the name and start of the label.
Like said above low level is based on labels, so naming them is important, also you can't have more labels with the same name.

Code:
jump [member=23507]Label[/member]
Intrerupts the flow of the script by jumping to given label.


Code:
jf [member=23507]Label[/member]
else_jump [member=23507]Label[/member]
jump_if_false [member=23507]Label[/member]
Conditional check, to be used with a condition. If the condition is false then intrerupts the flow of the script and jump to given label.



High level statements:

Code:
while true - end
Every script is one big loop, and can contain more loops, loopception.  :face_palm:
do i even make sense?  :dont_care:
You'll be using this for the main script mostly. It's a simple loop which repeats infinitely.


Code:
while - end
Conditional check, while condition is true repeat everything in a loop until condition is false.
Condition is read first, if condition is true the loop won't be executed.


Code:
repeat - until
Repeats everything in a loop until conditon is true.


Code:
repeat - until true
The loop will only execute once.
Code:
repeat - until false
The loop will execute infinitely untill the loop is stopped.

Code:
if - then - else - end
You'll be using these a lot in your script. They're condition checks.


Code:
for - end
This will loop only for a number of iterations.
Code:
for [email protected] = <start val>  TO/DOWNTO <end val> step <n>


Code:
BREAK and CONTINUE
break - is used to break the current loop.
continue - is used to jump to the next condition check/iteration.

You can use break and continue in low level coding too;
Code:
jf BREAK
jf CONTINUE
BREAK and CONTINUE can be only used inside of a  loop.

Sorry for any mistakes, either code or grammar. Point them out in the comments and i will fix them.
 

ThermaL

Well-Known Member
Joined
Oct 23, 2013
Messages
1,594
Likes
0
Points
36
#4
That's what I call an useful tutorial!
FK you blackhat! :lol:
 

blackHat

Well-Known Member
Joined
Jul 28, 2013
Messages
931
Likes
0
Points
16
#5
[member=111]springfield[/member]  nice , good work bro :)

i'm happy you niggers finally decided to do something useful instead of just swagging  :eek:h_stop_it_u:

TH3RM4L link said:
That's what I call an useful tutorial!
FK you blackhat! :lol:
:eek:key:
 

Fu$10N

Well-Known Member
Joined
Mar 5, 2014
Messages
1,105
Likes
0
Points
36
#6
It's like coding in C# and C++  :somuchwin: GoodJob :urtheman:
 

Mennims

Active Member
Joined
Mar 18, 2014
Messages
41
Likes
0
Points
6
#10
I can't compile my code if I use Break and continue in it. I get an unknown directive error. Any idea how to fix this?
 

Mennims

Active Member
Joined
Mar 18, 2014
Messages
41
Likes
0
Points
6
#12
springfield said:
springfield said:
BREAK and CONTINUE can be only used inside of a  loop.
Mennims said:
I can't compile my code if I use Break and continue in it. I get an unknown directive error. Any idea how to fix this?
I did use it inside a loop. I tried typing it in a while loop but again I get the same error
 
Top