Guilded Youth — 2 of 6

Jim Munroe

Release 1

Section 1 (Variables)

Every turn:

repeat with follower running through people:

if follower is joined:

if follower is not occupied:

move follower to the location of the player;

refresh avatar illustrations.

When play begins (this is the setup inventory illustrations rule):

eval "$('<div></div>').attr('id','inventory').appendTo('body')".

When play begins (this is the setup avatar illustrations rule):

eval "$('<div></div>').attr('id','avatar').appendTo('body')".

When play begins (this is the setup header image rule):

eval "$('<div></div>').attr('id','header_image').appendTo('body')".

When play begins:

go retro;

clear inventory illustrations;

clear avatar illustrations;

refresh avatar illustrations;

set the header image to "topbar_ascii.gif";

play mp3 sound file "modem.mp3";

now Maximus the cleric is in the Adventurers' Lounge;

now chris is worried;

now maximus is worried.

To set the header image to (file name - text):

eval "$('#header_image').html(vorple.media.image('[file name]'))".

The current domain is text that varies. The current domain is "ascii".

A thing has some text called illustration.

A person has some text called illustration.

A thing can be ascii or real. The player is ascii.

A thing has a number called id.

The current inventory illustrations is a list of things that varies.

The current avatar illustrations is a list of things that varies.

When play begins (this is the give things unique ids rule):

let counter be 0;

repeat with item running through things:

now the id of item is counter;

increase counter by 1.

[The idea here is that items in the list are stored in "current inventory illustrations" list,

and the code updates only those pictures that are added or removed from the list.]

To refresh inventory illustrations:

let new illustrations be a list of things;

repeat with item running through things carried by the player:

if the illustration of item is not "" and the item is not listed in the current inventory illustrations:

let filename be indexed text;

let filename be "[illustration of item]_[current domain].gif";

display image filename in element "item[id of the item]";

eval "$('.item[id of the item]').appendTo('#inventory')";

add item to the new illustrations;

if the item is listed in the current inventory illustrations:

remove item from the current inventory illustrations;

repeat with removable running through the current inventory illustrations:

eval "$('.item[id of removable]').remove()";

now the current inventory illustrations is the new illustrations;

After taking or dropping:

refresh inventory illustrations;

continue the action.

To refresh avatar illustrations:

let new illustrations be a list of things;

repeat with character running through people in the location of the player:

if the illustration of character is not "" and the character is not listed in the current avatar illustrations:

let filename be indexed text;

let filename be "[illustration of character]_[current domain].gif";

display image filename in element "avatar[id of the character]";

eval "$('.avatar[id of the character]').appendTo('#avatar')";

add character to the new illustrations;

if the character is listed in the current avatar illustrations:

remove character from the current avatar illustrations;

repeat with removable running through the current avatar illustrations:

eval "$('.avatar[id of removable]').remove()";

now the current avatar illustrations is the new illustrations;

[this will empty the list of illustrations so that any changes to the graphics will take place.]

To clear inventory illustrations:

truncate the current inventory illustrations to 0 entries;

eval "$( '#inventory' ).empty()".

To clear avatar illustrations:

truncate the current avatar illustrations to 0 entries;

eval "$( '#avatar' ).empty()".

To go retro:

now player is ascii;

now the current domain is "ascii";

eval "$('#vorpleContainer').removeClass('normal')";

eval "$('#vorpleContainer').addClass('retro')";

eval "$('Body').removeClass('normal')";

eval "$('Body').addClass('retro')";

refresh avatar illustrations;

clear inventory illustrations;

refresh inventory illustrations;

set the header image to "topbar_ascii.gif".

To go normal:

play mp3 sound file "switch.mp3";

now the current domain is "real";

eval "$('#vorpleContainer').removeClass('retro')";

eval "$('#vorpleContainer').addClass('normal')";

eval "$('Body').removeClass('retro')";

eval "$('Body').addClass('normal')";

clear avatar illustrations;

refresh avatar illustrations;

clear inventory illustrations;

refresh inventory illustrations;

set the header image to "topbar_real.gif".

Every turn:

refresh inventory illustrations;

refresh avatar illustrations.

Rule for printing the banner text: say "***You have connected to THE GUILD BBS*** " instead.

After printing the banner text: say "(Guilded Youth v1.1 for the IFComp 2012. HELP and CREDITS are available. Sound enabled on Chrome.)"