sludge-2.2.1/ 0000755 0001750 0001750 00000000000 12331153401 007771 5 0000000 0000000 sludge-2.2.1/install-sh 0000755 0001750 0001750 00000033255 12331153361 011732 0000000 0000000 #!/bin/sh # install - install a program, script, or datafile scriptversion=2011-11-20.07; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: sludge-2.2.1/NEWS 0000644 0001750 0001750 00000000000 12331153360 010402 0000000 0000000 sludge-2.2.1/doc/ 0000755 0001750 0001750 00000000000 12331153401 010536 5 0000000 0000000 sludge-2.2.1/doc/SLUDGEDevKitHelp/ 0000755 0001750 0001750 00000000000 12331153401 013441 5 0000000 0000000 sludge-2.2.1/doc/SLUDGEDevKitHelp/The_Worlds_Easiest_Load_Save_Mechanism.html 0000755 0001750 0001750 00000006334 12325304775 023727 0000000 0000000
In order to give your game a unique look and feel, it's entirely reasonable to want to code your own load and save routines with text entry, lists of existing games and so on. However, if you're just getting started on a game, here's the simplest way to get a loading and saving mechanism working. Set up a keyboard handler (if you don't have one already) and add these two lines (assuming the variable it's checking is called k - if not change the code appropriately).
if (k == "s") saveGame ("saved.gam"); if (k == "l") loadGame ("saved.gam");
Easy! Of course, you might want to do more than just call the saveGame and loadGame functions. You may want to let people pick a slot to save into, for example. Feel free to use and build on this...
objectType saveSlot1 ("") {} objectType saveSlot1 ("") {} objectType saveCancel ("") {} sub myGameStuff (clickFunc) { freeze (); pasteString ("SLOT 1", 25, 65); addScreenRegion (saveSlot1, 20, 20, 100, 100, 0, 0, -1); pasteString ("SLOT 2", 125, 65); addScreenRegion (saveSlot2, 120, 20, 200, 100, 0, 0, -1); pasteString ("CANCEL", 125, 65); addScreenRegion (saveCancel, 120, 20, 200, 100, 0, 0, -1); onLeftMouse (clickFunc); } sub saveGameClick () { var clickedWhat = getMouseOverObject (); if (clickedWhat) unfreeze (); if (clickedWhat == saveSlot1) saveGame ("saved1.gam"); if (clickedWhat == saveSlot2) saveGame ("saved2.gam"); } sub loadGameClick () { var clickedWhat = getMouseOverObject (); if (clickedWhat) unfreeze (); if (clickedWhat == saveSlot1) loadGame ("saved1.gam"); if (clickedWhat == saveSlot2) loadGame ("saved2.gam"); }
And in your keyboard handler...
if (k == "s") myGameStuff (saveGameClick); if (k == "l") myGameStuff (loadGameClick);
There are much more advanced load and save examples on the SLUDGE website - and here's how to get there if you'd rather dive in at the deep end and swim from there.
SLUDGE and this SLUDGE documentation are copyright Hungry Software and contributors 2000-2012
loadGame (filenameString);
Loads a saved game. When you use this function, all of the current data - which functions are running, what each of the variables contains, the size and contents of the background image, the camera position, the floor and so on - will be forgotten and reset to the state stored in the file with the name filenameString.
Therefore, if the call is successful, your program will not continue from the command following the call to loadGame - instead it will continue after the appropriate saveGame call used to create the file. The only situation in which your program will continue from the line following the call to loadGame is if the file given by filenameString doesn't exist.
This function supports filename bodging - for details see the bodgeFilenames command.
No return value.
The World's Easiest Load/Save Mechanism
loadCustomData and saveCustomData
SLUDGE and this SLUDGE documentation are copyright Hungry Software and contributors 2000-2012
setScale (horizon, divide);
Changes the scaling for characters. The horizon value represents the level (y co-ordinate) of the horizon on the screen. The divide parameter is how quickly characters grow and shrink as they move towards or away from the horizon. The scale at which a character is drawn is calculated using the algorithm scale = (y position - horizon) / divide.
If the divide value is 0, no scaling will be applied to characters when they move; each character will continue to be drawn at the size in which it was previously drawn. In this situation, new characters added using addCharacter will be created with a scale value of 1.
Changing the scale does not affect characters which aren't currently moving. Adding a character and then changing the scale will not resize the character, until the character is told to move.
No return value.
SLUDGE and this SLUDGE documentation are copyright Hungry Software and contributors 2000-2012
newStack ([firstElement [, secondElement...]]);
Creates a new stack with zero or more elements. Internally, the elements are added to the stack in such a way that a call to popFromStack will return (and remove) the firstElement in the stack. The elements can be of any variable type, including other stacks.
The function returns the stack which has been created.
The Multi-Purpose Stack / Array / Queue Type
SLUDGE and this SLUDGE documentation are copyright Hungry Software and contributors 2000-2012
showThumbnail (filename, x, y);
Retrieves the thumbnail image from a saved game file (filename) and displays the image on the screen at the co-ordinates x, y (top left corner).
If filename is a valid saved game which contains no thumbnail image, the code has no effect. If the file does not exist your game will exit with the appropriate fatal error - therefore it's a good idea to check whether the fileExists first.
This function supports filename bodging - for details see the bodgeFilenames command.
No return value.
SLUDGE and this SLUDGE documentation are copyright Hungry Software and contributors 2000-2012
isScreenRegion (thisObject);
Tests whether thisObject is currently represented on-screen as a screen region (added using the addScreenRegion function).
If thisObject is currently represented as a screen region, the return value is TRUE. Otherwise, the return value is FALSE.
Object Types as Screen Regions
SLUDGE and this SLUDGE documentation are copyright Hungry Software and contributors 2000-2012
You can treat all variables as boolean values... that is, you can say:
if (myVariable)
...no matter what data type is actually in the variable. Here's how they're all treated.
Undefined:
Always equates to FALSE..
Numbers:
Equates to FALSE if it contains the value 0; TRUE for everything else.
Strings:
Always equates to TRUE.
File handles:
Always equates to TRUE.
Object types:
Always equates to TRUE.
Stacks:
Equates to FALSE if the stack is empty; TRUE for everything else.
Function handles:
Always equates to TRUE.
Animations:
Always equates to TRUE.
Costumes:
Always equates to TRUE.
SLUDGE and this SLUDGE documentation are copyright Hungry Software and contributors 2000-2012
lightStatus (whichBar);
Forces one of the status bars (created using the addStatus command) to be drawn in a different colour to the others. The status bar specified by the parameter whichBar (which should be a number) will, until the next call to lightStatus, be drawn in the colour specified by the setLitStatusColour function rather than the setStatusColour function.
If you do not want any of the status bars to be lit, call lightStatus with the value of the whichBar parameter being any number less than 0.
No return value.
SLUDGE and this SLUDGE documentation are copyright Hungry Software and contributors 2000-2012
setCharacterAngleOffset (thisCharacter, value);
Adds an offset to the angle of thisCharacter. The value is used in the calculations deciding which direction (see costume) a character should face. An offset of 0 (the default) means that the base direction of a character is facing the player.
No return value.
SLUDGE and this SLUDGE documentation are copyright Hungry Software and contributors 2000-2012
addOverlay (thisFile, atX, atY);
Loads an image from the file handle thisFile and overlays it onto the screen. Bright magenta (255, 0, 255 or #FF00FF) is used as the transparency colour (except for 32-bit images, where the alpha channel is used!), making it possible to add irregular shapes.
The values atX and atY define the top left corner of the area into which the image will be added. If the value of atX is CENTRE (or CENTER) the image will be added halfway across the window. If the value of atY is CENTRE (or CENTER) the image will be added halfway down the window.
No return value.
sub init () { addOverlay ('someImage.tga', CENTER, CENTER); }
SLUDGE and this SLUDGE documentation are copyright Hungry Software and contributors 2000-2012
hardScroll (numberOfRows);
Scrolls the background image up and down.
If numberOfRows is positive, the background image scrolls up: the top numberOfRows lines of the image are lost, and numberOfRows blank lines are added to the bottom. If numberOfRows is negative, the background image scrolls down. If numberOfRows is 0 the function has no effect.
Should the value of numberOfRows be greater than the height of the background image (or less than 0 minus the height of the background image) the background image will be blanked completely, as if blankScreen had been called.
This function is very useful for scrolling credits, but probably very little else - unless, that is, someone proves me wrong. The function is not for scrolling around scenes which are larger than the screen or window - try setSceneDimensions and aimCamera instead.
No return value.
setBlankColour (setBlankColor)
SLUDGE and this SLUDGE documentation are copyright Hungry Software and contributors 2000-2012
getMouseX ();
getMouseY ();
Get the current x or y co-ordinate of the mouse in relation to the scene; that is, how far across or down the background image the mouse cursor is currently positioned.
The functions each returns a number between 0 and the width or height of the background image minus 1 (inclusive). 0 represents the very left (in the case of getMouseX) or top (in the case of getMouseY) of the background.
getMouseScreenX and getMouseScreenY
SLUDGE and this SLUDGE documentation are copyright Hungry Software and contributors 2000-2012
removeCharacter (thisCharacter);
Removes the character thisCharacter from the scene.
Note that if the character is talking or thinking, the speech will be removed from the screen and the function from which one of the say and think commands was called will continue. However, if the character is moving (because of a call to either the moveCharacter or forceCharacter command) execution of the function which called the movement command will not continue.
No return value.
SLUDGE and this SLUDGE documentation are copyright Hungry Software and contributors 2000-2012
isCharacter (thisObject);
Tests whether thisObject has been added as a character (added using the addCharacter function).
If thisObject is represented as a character, the return value is TRUE. Otherwise, the return value is FALSE.
SLUDGE and this SLUDGE documentation are copyright Hungry Software and contributors 2000-2012
setSceneDimensions (newWidth, newHeight);
Changes the width and height of the background image used for the current scene to newWidth and newHeight. Setting a newWidth larger than the screen or window width, or a newHeight larger than the screen or window height, will enable scrolling around the scene using the aimCamera function. Setting the dimensions to an area either less wide or less tall than the window or screen will stop the program with a fatal error.
This function also clears the background image.
No return value.
SLUDGE and this SLUDGE documentation are copyright Hungry Software and contributors 2000-2012
stopCharacter (thisCharacter);
Stops thisCharacter from moving. The command does not stop any animation if the character isn't currently moving.
TRUE if thisCharacter is an object type which is currently represented on the screen as a character and was previously moving, otherwise FALSE (i.e. TRUE if the call to the function was a success).
SLUDGE and this SLUDGE documentation are copyright Hungry Software and contributors 2000-2012
freeze ();
Freezes execution of the current scene so that tasks (such as loading, saving, inventories or messages) can be performed in the foreground. A new background image is created which is identical to the original background image, but with characters pasted onto it. Characters, screen regions and floors are remembered but not added to the new background image. Any functions (other than the function which ran the freeze command) are paused - unless they have been declared unfreezable.
No return value.
sub init () { onLeftMouse (pauseSub); loop { # Assuming a window size of 640 by 480, and a # 'splat.tga' image no bigger than 40 by 40 addOverlay ('splat.tga', random (600), random (440)); pause (5); } } sub pauseSub () { freeze (); darkBackground (); pasteString (CENTRE, 240, "Paused!"); onLeftMouse (resumeSub); } sub resumeSub () { unfreeze (); onLeftMouse (pauseSub); }
SLUDGE and this SLUDGE documentation are copyright Hungry Software and contributors 2000-2012
onMoveMouse (handlerFunction);
onMoveMouse ();
Tells the computer which function to call whenever the mouse is moved. The value of handlerFunction must be a pointer to a function which takes no parameters. The function will be called every time the user moves the mouse until another call to onMoveMouse.
If no parameter is given, the program stops calling the current mouse movement handler function. No function will be called when the user moves the mouse until another call to onMoveMouse tells it otherwise.
Note that only one handler for mouse movement can be used at any one time. A subsequent call to onMoveMouse will replace the current handler function.
No return value.
Passing Functions as Variables
SLUDGE and this SLUDGE documentation are copyright Hungry Software and contributors 2000-2012
setDefaultMusicVolume (volume);
Changes the volume at which music will be played by subsequent calls to the startMusic function. Any music currently playing is not affected - the volume for music which has already been started can be controlled using the setMusicVolume function.
No return value.
setDefaultMusicVolume (200); startMusic ('mytune.xm', 0); # Starts music playing on channel 0 at volume 200 pause (100); setMusicVolume (50, 0); # Music on channel 0 is now playing at volume 50
SLUDGE and this SLUDGE documentation are copyright Hungry Software and contributors 2000-2012
stringWidth (thisString);
Returns the width, in pixels, of the string thisString using the current font.
The function returns the total number of pixels for each of the characters contained in the string.
SLUDGE and this SLUDGE documentation are copyright Hungry Software and contributors 2000-2012
pasteImage (thisAnimation, x, y);
Pastes the first frame of the animation thisAnimation onto the screen. The parameter thisAnimation must be the result of a call to the anim function. The parameters x and y define the point at which the image's hotspot will appear on the background image.
No return value.
SLUDGE and this SLUDGE documentation are copyright Hungry Software and contributors 2000-2012
pasteString (x, y, thisString);
burnString (x, y, thisString);
Adds text to the background image. The parameter thisString is added to the screen at the position (x, y).
If the value of x is CENTRE (or CENTER) the text is added halfway across the screen. Otherwise, the x value is used as the horizontal position of the hotspot of the first character of thisString. The y parameter is always used as the vertical position of the hotspot of every character of thisString - the enumeration CENTRE (or CENTER) shouldn't be used as the y parameter. If it is, the text will not appear on the screen.
Both pasteString and burnString use the font most recently loaded by the setFont command. pasteString uses the colour specified by the setPasteColour (or setPasteColor) command. burnString adds text in the colour specified by setBurnColour (or setBurnColor), using the differing brightness levels of the font to achieve an anti-aliasing effect.
No return value.
SLUDGE and this SLUDGE documentation are copyright Hungry Software and contributors 2000-2012
onLeftMouseUp (handlerFunction);
onLeftMouseUp ();
Tells the computer which function to call when the left mouse button is released. The value of handlerFunction must be a pointer to a function which takes no parameters. The function will be called every time the user releases the left mouse button until another call to onLeftMouseUp.
If no parameter is given, the program stops calling the current left mouse button release handler function. No function will be called when the user releases the left mouse button until another call to onLeftMouseUp tells it otherwise.
Note that only one handler for releasing the left mouse button can be used at any one time. A subsequent call to onLeftMouseUp will replace the current handler function.
No return value.
Passing Functions as Variables
SLUDGE and this SLUDGE documentation are copyright Hungry Software and contributors 2000-2012