Text Script
Hi, there. If you're curious about what Fanscript is, it is basically a system where you drag-and-drop blocks and connect wires to create what we call "scripts" when they're just a bunch of blocks, really.
Similar systems have been used by other programs such as Scratch. And tell you what; all games you see inside Fancade? They're all made with those blocks! How cool is it?
Note
This is a pseudo-code you use to write in Discord instead of having to go back to Fancade, screenshot the scripts, then go back to Discord and send it. If you don't understand it then there's no other way but to go to Fancade and take a look at the scripts.
This is also just a way to predict how Fanscript is gonna look if Martin decides to make a text language for Fancade.
This page is still being re-written by @Isaglish. Ping me in Discord if you have any questions.
Folders
First of all, we have folders. These are the folders in your Inventory when you tap on the plus icon on the very far right of your hotbar.
# if you wanna use assets you've created or
# use pre-existing ones then you will have to do this:
player = MyBlocks:Player
bricks = Terrain:Bricks
grass = Terrain:Grass
particle = Decor:Particle
Variables
# set a global variable by adding '$' at the beginning of a variable name
$deltaTime = Frame()
# similar to global variables, saved variables have a '!' at the prefix
# note that this only works for Numbers type at the moment
!coinMultiplier = MenuItem("Coin Multiplier", "on/off", "10 double")
# in fancade, we have six different data types
# variables are dynamic so you don't have to specify their type
age = 10
gunSprite = MyBlocks:Pistol
positionOffset = Vector(x, y, z)
angle = Rotation(x, y, z)
banned = False
constraint = AddConstraint(base, part, pivot)
How to use each block in each folder
Game folder
Win(delay)
Lose(delay)
SetScore(score, coins, "Most Points")
SetCamera(position, rotation, range)
SetLight(rotation)
screenWidth = ScreenSize().width
screenHeight = ScreenSize().height
direction = Accelerometer()
delta = Frame()
!item = MenuItem(picture, "The name of your item", "on/off", "10 double")
Objects folder
objectPosition = GetPosition(object).position
objectRotation = GetPosition(object).rotation
SetPosition(object, position, rotation)
hit = Raycast(from, to).hit
hitPosition = Raycast(from, to).hitpos
hitObject = Raycast(from, to).hitobj
objectSizeMin = GetSize(object).min
objectSizeMax = GetSize(object).max
SetVisible(object, visible)
copiedObject = CreateObject(original)
DestroyObject(object)
Sounds folder
channel = PlaySound(volume, pitch).channel
StopSound(channel)
VolumePitch(channel, volume, pitch)
Physics folder
AddForce(object, force, applyAt, torque)
velocity = GetVelocity(object).velocity
spin = GetVelocity(object).spin
SetVelocity(object, velocity, spin)
SetLocked(object, position, rotation)
SetMass(object, mass)
SetFriction(object, friction)
SetBounciness(object, bounciness)
SetGravity(gravity)
constraint = AddConstraint(base, part, pivot)
LinearLimits(constraint, lower, upper)
AngularLimits(constraint, lower, upper)
LinearSpring(constraint, stiffness, damping)
AngularSpring(constraint, stiffness, damping)
LinearMotor(constraint, speed, force)
AngularMotor(constraint, speed, force)
Control folder
If(condition) {
# do true stuff
} else {
# do false stuff
}
PlaySensor() {
# initialize stuff here
}
LateUpdate() {
# late update stuff here
}
BoxArtSensor() {
# do stuff here
}
# TouchSensor returns Number x and Number y in a tuple format (x, y)
tapX, tapY = TouchSensor("Touching") {
# do stuff here
}
direction = SwipeSensor() {
# do stuff here
}
Button("Direction") {
# do stuff here
}
Joystick("XZ") {
# do stuff here
}
object, impulse, normal = Collision(object) {
# do stuff here
}
counter = Loop(start, end) {
# do stuff here
}
Math folder
work-in-progress