• Register

The game you are trying to view has ceased development and consequently been archived. If you are a member of this game, can demonstrate that it is being actively developed and will be able to keep this profile up to date with the latest news, images, videos and downloads, please contact us with all details and we will consider its re-activation.

Cerebro - OS is a Multiplayer-Hacker-Simulation based on Uplink and the original DarkSigns. Players will be able to create own scripts and ingame-websites with LUA.

Forum Thread
  Posts  
Lua Functions (Games : Cerebro OS : Forum : General Discussion : Lua Functions) Locked
Thread Options
Apr 16 2014 Anchor

Hello, here is a list of supported Lua Functions and objects to use within the game.

--**********************
--*Predefined Variables*
--**********************

--this
--Contains the Console which started the Script
--Not available if script was run through the Editor
this.WriteLine(string text);

--Events
--Contains timed Events
--Like 'Every_10_Minutes'
--Register Function for Event
Events.Every_5_Seconds:Fire(function);
Events.Every_1_Minute:Fire(function);
Events.Every_5_Minutes:Fire(function);
Events.Every_10_Minutes:Fire(function);

--Player
--At the moment only contains
--The Username of the Player
Player.Username;

--********
--*Window*
--********

--Create a Window
--Window(string Title, int Height, int Width)
local window = Window("Title", 200,200);

--Change the Height and Width
window.Height = 240;
window.Width = 100;

--Add Controls
window:Add(Control);


--**********
--*Controls*
--**********

--Button
local button = Controls.Button();

--Textbox
local textbox = Controls.Textbox();

--Checkbox
local checkbox = Controls.Checkbox();

--Progressbar
local progressbar = Controls.Progressbar();

--Radiobutton
local radiobutton = Controls.Radiobutton();

--Slider
local slider = Controls.Slider();

--Textblock
local textblock = Controls.Textblock();


--******
--*Math*
--******

--Create a new Vector4F
--Math.Vector4F(int x, int y, int w, int z)
local vector = Math.Vector4F(4,4,4,4);

--*******************
--*Advanced Controls*
--*******************

--Properties shared by all Controls

--Aligning the Button horizontal
--Can be "left", "right", "center", "stretch"
Control.HorizontalAlignment = "left";

--Aligning the Button vertical
--Can be "bottom", "top", "center", "stretch"
Control.VerticalAlignment = "bottom";

--Defining Height and Width
--Can be any positive INT
Control.Height = 30;
Control.Width = 40;

--Defining the Margin
Control.Margin = Math.Vector4F(4,4,4,4);

--*****************
--*Advanced Button*
--*****************

--Display Text on a button
button.Text = "Text";

--Register a function for the Click-Event
button:click(clickfunction);


--******************
--*Advanced Textbox*
--******************

--Getting the Text from a Textbox
local text = textbox.Text;


--***********************************
--*Advanced Checkbox and RadioButton*
--***********************************

--Set if it's checked
radiobutton.isChecked = true/false;
checkbox.isChecked = true/false;

--Get if it's checked
local check = radiobutton.isChecked;
local check = checkbox.isChecked;

--*********************************
--*Advanced Progressbar and Slider*
--*********************************

--Get the current Value INT
local value = progressbar.Value;
local value = slider.Value;

--Set current Value INT
progressbar.Value = 12;
slider.Value = 12;

--Set Maximum Value
progressbar.Maximum = 20;
slider.Maximum = 20;

--Set Minimum Value
progressbar.Minimum = 0;
slider.Minimum = 0;

--********************
--*Advanced Textblock*
--********************

--Set Text
textblock.Text = "Text";

Edited by: MitoG

Reply to thread
click to sign in and post

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.