Skip to content

Commit

Permalink
Cleanup, Added implode,min,max,randseed
Browse files Browse the repository at this point in the history
  • Loading branch information
Donkie committed Sep 21, 2014
1 parent 4616ca7 commit aa73440
Show file tree
Hide file tree
Showing 2 changed files with 115 additions and 180 deletions.
69 changes: 20 additions & 49 deletions code/modules/scripting/Implementations/Telecomms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@
interpreter.SetVar("$sign" , signal)
interpreter.SetVar("$pass" , !(signal.data["reject"])) // if the signal isn't rejected, pass = 1; if the signal IS rejected, pass = 0

// Set up the script procs

/*
Telecomms procs
*/

/*
-> Send another signal to a server
Expand Down Expand Up @@ -128,49 +131,12 @@
*/
interpreter.SetProc("mem", "mem", signal, list("address", "value"))

/*
-> Delay code for a given amount of deciseconds
@format: sleep(time)
@param time: time to sleep in deciseconds (1/10th second)
*/
interpreter.SetProc("sleep", /proc/delay)

/*
-> Replaces a string with another string
@format: replace(string, substring, replacestring)
@param string: the string to search for substrings (best used with $content$ constant)
@param substring: the substring to search for
@param replacestring: the string to replace the substring with
General NTSL procs
Should probably be moved to its own place
*/
interpreter.SetProc("replace", /proc/string_replacetext)

/*
-> Locates an element/substring inside of a list or string
@format: find(haystack, needle, start = 1, end = 0)
@param haystack: the container to search
@param needle: the element to search for
@param start: the position to start in
@param end: the position to end in
*/
interpreter.SetProc("find", /proc/smartfind)

/*
-> Finds the length of a string or list
@format: length(container)
@param container: the list or container to measure
*/
interpreter.SetProc("length", /proc/smartlength)

/* -- Clone functions, carried from default BYOND procs --- */

// vector namespace
// Vector
interpreter.SetProc("vector", /proc/n_list)
interpreter.SetProc("at", /proc/n_listpos)
interpreter.SetProc("copy", /proc/n_listcopy)
Expand All @@ -179,19 +145,21 @@
interpreter.SetProc("cut", /proc/n_listcut)
interpreter.SetProc("swap", /proc/n_listswap)
interpreter.SetProc("insert", /proc/n_listinsert)

interpreter.SetProc("pick", /proc/n_pick)
interpreter.SetProc("prob", /proc/prob_chance)
interpreter.SetProc("substr", /proc/docopytext)
interpreter.SetProc("prob", /proc/n_prob)
interpreter.SetProc("substr", /proc/n_substr)
interpreter.SetProc("find", /proc/n_smartfind)
interpreter.SetProc("length", /proc/n_smartlength)

// Donkie~
// Strings
interpreter.SetProc("lower", /proc/n_lower)
interpreter.SetProc("upper", /proc/n_upper)
interpreter.SetProc("explode", /proc/string_explode)
interpreter.SetProc("explode", /proc/n_explode)
interpreter.SetProc("implode", /proc/n_implode)
interpreter.SetProc("repeat", /proc/n_repeat)
interpreter.SetProc("reverse", /proc/n_reverse)
interpreter.SetProc("tonum", /proc/n_str2num)
interpreter.SetProc("replace", /proc/n_replace)

// Numbers
interpreter.SetProc("tostring", /proc/n_num2str)
Expand All @@ -202,11 +170,14 @@
interpreter.SetProc("round", /proc/n_round)
interpreter.SetProc("clamp", /proc/n_clamp)
interpreter.SetProc("inrange", /proc/n_inrange)
interpreter.SetProc("rand", /proc/rand_chance)
// End of Donkie~
interpreter.SetProc("rand", /proc/n_rand)
interpreter.SetProc("randseed", /proc/n_randseed)
interpreter.SetProc("min", /proc/n_min)
interpreter.SetProc("max", /proc/n_max)

// Time
interpreter.SetProc("time", /proc/time)
interpreter.SetProc("time", /proc/n_time)
interpreter.SetProc("sleep", /proc/n_delay)
interpreter.SetProc("timestamp", /proc/gameTimestamp)

// Run the compiled code
Expand Down
Loading

0 comments on commit aa73440

Please sign in to comment.