File: SCRIPT_FUNCTIONS

package info (click to toggle)
gmoo 0.5.6-11
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,412 kB
  • ctags: 2,213
  • sloc: ansic: 18,320; sh: 5,396; makefile: 385; perl: 205; sed: 93; tcl: 30
file content (86 lines) | stat: -rw-r--r-- 3,142 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
Types that are used:
  <ID>     ID of the world in question
  <BOOL>   either 0 or 1
  <INT>    any valid integer
  <STRING> Guess :)
  <VOID>   Nothing, ignore it

Namespace:  WORLD
=================

Printing text on the world screen
---------------------------------
# The functions return 1 on success and 0 on failure
  <BOOL> print   <ID> <STRING>	# Print the text, buffered till a "\n" comes
  <BOOL> println <ID> <STRING>	# Same als print, but appends a "\n"
  <BOOL> tell    <ID> <STRING>	# Alias for println
  <BOOL> msg     <ID> <STRING>   # Same als println, but prepends "% "

Sending text to the world
-------------------------
# The functions return 1 on success and 0 on failure
  <BOOL> write   <ID> <STRING>		# Write the text, buffered till a "\n" comes
  <BOOL> writeln <ID> <STRING>		# Same als write, but appends a "\n"
  <BOOL> send    <ID> <STRING>		# Alias for writeln

Get info
--------
  <STRING> name      <ID>	# Returns the name of the world
  <STRING> hostname  <ID>	# Returns the hostname of the world
  <INT>    port      <ID>	# Returns the port
  <BOOL>   connected <ID>	# Returns 1 if connected or 0 if not
  <INT>    width     <ID>	# Returns the width of the screen in chars
  <INT>    height    <ID>	# Returns the height of the screen in chars



Namespace:  CLIENT
=================

Register callbacks and timeouts
-------------------------------
  <VOID> register_macro <STRING macroname> <STRING functionname> [STRING desc]
		# functionname wil be called like:
		# functionname <ID> <STRING macroname> <STRING args>
		# the desc arg is a description of the macro
  <VOID> register_start <STRING functionname>
		# Function will be called when gmoo has been started
		# The function doesn't receive any arguments
  <VOID> register_end <STRING functionname>
		# Function will be called when gmoo will be closed
		# The function doesn't receive any arguments

Misc
----
  <STRING> version
		# returns the version ("MAJOR.MINOR.MICRO")

Dialog boxes
------------
# Dialog boxes are modal to the program
  <INT> msgbox <STRING title> <STRING type> <STRING buttons> <STRING text> [INT default]
		# title   is the title of the dialog window
		# type    is one of:
		#		"stop" or "error"	    stop sign icon
		#		"question"		    ? icon
		#		"warning" or "exclamation"  ! icon
		#		"information" or "asterix"  lamp icon
		#		"none"			    no icon
		# buttons is one of:
		#		"abortretryignore" or "ok" or "okcancel" or
		#		"retrycancel" or "yesno" or "yesnocancel"
		# text    is the message to be displayed
		# default is the button that will get focus (optional)
		#
		# Returns the button number pressed [0..2]
  <type> input <STRING title> <STRING type> <STRING desc> [default]
		# title   is the title of the dialog window
		# type    is one of:
		#		"string" or "int" or "integer"
		# varname is the variable where the return value is stored
		#		in if sucessfull, not changed if aborted
		# desc    is the text that will be displayed
		# default is the value to be displayed initially
		#
		# returns the selected value on sucsess, or undef or "" on err
		# NOTE: the type of default must be that of <type>