Login

Fancade Wiki

Deleted Fanscript/Fancade Text Code Format.md

... ...
@@ -1,271 +0,0 @@
1
A Pseudo-Coding Language Format Developed by (**@Isaglish** , me **@JP16D** , **@Qma** and **@Vex Ave**) base from Fancade's Coding.
2
3
(*Note: this is not a real or existent coding language as the word "Pseudo" declares this is just a code format that can be used in scripting discussions)
4
5
6
This Format will be a basis when sharing or suggesting some codes and code solutions during script discussions. Take this as an easier way to share or suggest a code program instead doing it in fancade and go back to fancade server #scripting channel. Well in case of people that couldn't understand this just do the thing in fancade , screenshot it and share it to them.
7
8
Here is the documentation of what we have done so far ...
9
10
### Introduction
11
This format is based on C# syntax. Most of things are simplified for the better understanding.
12
13
As you know, Fancade's script blocks are located in different folders. To make it easier to understand, what do you mean, use their names as in the example below. It's not necessary and takes such a time to write, but please pay attention to it when you're explaining script to the new user or there are namesake custom blocks.
14
15
Following the C# syntax, let's imagine that each folder is a separate class with its own fields and functions. So, to represent Get Frame block, you need to type `Game.Current_Frame`. Again, it's not necessary, just `Current_Frame` is fine too.
16
17
All the cases:
18
```
19
//If block has yellow wires, add () at the end of the name
20
Game.Win();
21
Sound.Play_Sound();
22
23
//If block has inputs, count them and their type in the brackets
24
Objects.Set_Position(obj object, vec position, rot rotation);
25
26
//If block has more than one output. Get position as example
27
Objects.Get_Position(target_object).position;
28
29
//Math block counts like this, except the basic ones listed below
30
vec result = Math.Line_vs_Plane(L_from, L_to, P_normal, P_point);
31
32
//If block has only outputs, don't do anything
33
num frame = Game.Get_Frame;
34
}
35
```
36
37
## _______________________________________________________________
38
### Basics
39
## _____________________________
40
**Value Types** :
41
```
42
Num varName = 0;
43
Tru varName = true/false;
44
Vec varName(x , y , z);
45
Rot varName(x , y , z);
46
Obj varName = Object;
47
48
//Any variable can be used as list. Format: varName[index]
49
```
50
## _____________________________
51
### Basic Math Operators
52
53
```
54
//Add Numbers
55
2 + 2
56
57
//Subtract Numbers
58
2 - 2
59
60
//Multiply Numbers
61
2 * 2
62
63
//Divide Numbers
64
2 / 2
65
66
//Power
67
2 ^ 2
68
69
//Modulo
70
2 % 2
71
72
//Increase
73
num++
74
75
//Decrease
76
num--
77
```
78
## _____________________________
79
### Basic Boolean Operators
80
```
81
//Boolean logic (AND, OR, NOT)
82
83
tru smart = ((NOT dumb) AND (has_brain)) OR already_smart;
84
85
//Math (Greater, Less, Equal)
86
87
tru equal = a == b;
88
89
tru greater = a > b;
90
91
tru less = a < b;
92
```
93
94
## _______________________________________________________________
95
### Game
96
```
97
Game.Win();
98
99
Game.Lose();
100
101
Game.Set_Score(num Score);
102
103
Game.Set_Camera(vec Position, rot Rotation, num Distance);
104
105
Game.Set_Light(vec Position, rot Rotation);
106
107
Game.Screen_Size.x
108
Game.Screen_Size.y
109
110
Game.Accelerometer
111
112
Game.Current_Frame
113
```
114
115
## _______________________________________________________________
116
### Objects
117
```
118
Objects.Get_Position(obj).Position
119
Objects.Get_Position(obj).Rotation
120
121
Objects.Set_Position(obj Object, vec position, rot Rotation);
122
123
//alternative
124
//get
125
vec = obj.position;
126
//set
127
obj.position = vec;
128
129
Objects.Raycast(vec, vec).Hit?
130
Objects.Raycast(vec, vec).Hit_Pos
131
Objects.Raycast(vec, vec).Hit_Obj
132
133
Objects.Get_Size(obj Object).Min
134
Objects.Get_Size(obj Object).Max
135
136
//alternative
137
vec = obj.size.min;
138
139
Objects.Create_Object(obj Object);
140
141
Objects.Destroy_Object(obj Object);
142
```
143
144
## _______________________________________________________________
145
### Sound
146
```
147
Sound.Play_Sound(num Volume, num Pitch);
148
Sound.Play_Sound.Channel
149
150
Sound.Stop_Channel(num Channel);
151
152
Sound.Volume_Pitch(num Channel, num Volume, num Pitch);
153
```
154
155
## _______________________________________________________________
156
### Physics
157
```
158
//I regret doing this, sorry
159
```
160
161
162
## _______________________________________________________________
163
### Control
164
```
165
//Basic if operator
166
If (condition) {
167
function_true;
168
} else {
169
function_false;
170
}
171
172
//Or ternary
173
condition ? true : false;
174
//Note: Fancade doesn't have ternary operator at the moment of writing. This is just a shortcut for scripting discussions
175
176
Loop(num start = 0, num end = 0) {
177
//Output
178
self.Counter
179
}
180
181
Touch_Sensor() {
182
//Outputs
183
self.Screen_X
184
self.Screen_Y
185
}
186
187
Collision(obj Physical_Object) {
188
//Outputs
189
self.Second_Object
190
self.Normal
191
self.Impulse
192
}
193
194
Swipe_Sensor() {
195
//Output
196
self.Direction
197
}
198
199
BoxArt() {
200
}
201
202
PlaySensor() {
203
}
204
205
LateUpdate() {
206
}
207
```
208
209
## _______________________________________________________________
210
### Math
211
```
212
Math.Negate(num Num)
213
214
Math.Inverse(rot Rot)
215
216
vec.Scale(num Num)
217
218
vec.Rotate(rot Rot)
219
220
rot.Combine(rot Rot2)
221
222
Math.Random(num Min = 0, num Max = 1)
223
224
Math.Random_Seed(num Seed);
225
226
Math.Min(num Num1, num Num2)
227
228
Math.Max(num Num1, num Num2)
229
230
Math.Sin(num Num)
231
232
Math.Cos(num Num)
233
234
Math.Round(num Num)
235
236
Math.Floor(num Num)
237
238
Math.Ceiling(num Num)
239
240
Math.Absolute(num Num)
241
242
Math.Logarithm(num Number, num Base)
243
244
num vec.x
245
num vec.y
246
num vec.z
247
248
vec.Normalize()
249
250
vec.Dot(vec Vector)
251
252
vec.Cross(vec Vector)
253
254
num rot.x
255
num rot.y
256
num rot.z
257
258
Math.Distance(vec Vec1, vec Vec2)
259
260
LERP(rot From, rot To, num Amount)
261
262
Math.Axis_Angle(vec Axis, num Angle)
263
264
Math.Screen_To_World(num Screen_X, num Screen_Y)
265
266
Math.World_To_Screen(vec World_Pos)
267
268
Math.Line_vs_Plane(vec Line_From, vec Line_To, vec Plane_Point, vec Plane_Normal)
269
270
Math.Look_Rotation(vec Direction, vec Up)
271
```
Fancade Wiki