ec2-3-14-246-254.us-east-2.compute.amazonaws.com | ToothyWiki | ChrisHowlett | RecentChanges | Login | Webcomic
All was not well in Yendor. The dungeon was unfinished, and the player didn't have a weapon to take on the goblin. On top of all that, the player didn't even know when to die!
[Play]
[Recompile]
[View compiler errors]
logic
{
int NO { 0 }
int YES { 1 }
int FLOOR { 0 }
int PLAYER { 1 }
int WALL_HORIZ { 2 }
int WALL_VERT { 3 }
int ROCK { 4 }
int GOBLIN { 5 }
array map { 2,2,2,2,2,2,2,2,2,2,2,2,
3,0,0,0,0,0,0,0,0,0,0,3,
3,0,0,0,0,0,0,0,0,0,0,3,
3,0,0,0,0,0,0,0,0,0,0,3,
3,0,0,0,0,0,0,0,0,2,2,3,
3,0,0,0,0,0,0,0,0,5,0,3,
3,0,0,0,0,0,0,0,0,2,2,3,
3,0,0,1,0,0,0,0,0,0,0,3,
3,0,0,0,0,0,0,0,0,0,0,3,
2,2,2,2,2,2,2,2,2,2,2,2, }
int mapheight { 10 }
int mapwidth { 12 }
int player_x { 3 }
int player_y { 7 }
int hp { 4 }
int lose { 0 }
array msg_info { 0 }
array msg_combat { 0,0,0,0,0,0,0,0 }
int comb_parts { 8 }
array msg_surr { 0 }
when
{
(lose == NO) and
(map[(player_y - 1)*mapwidth + (player_x - 1)] == FLOOR)
}
allow
{
map[(player_y)*mapwidth + player_x] = FLOOR;
player_x--;
player_y--;
map[(player_y)*mapwidth + player_x] = PLAYER;
for ii ( 0 .. comb_parts - 1)
{
msg_combat[ii] = 0;
}
}
label { "Move NW" }
when
{
(lose == NO) and
(map[(player_y - 1)*mapwidth + player_x] == FLOOR)
}
allow
{
map[(player_y)*mapwidth + player_x] = FLOOR;
player_y--;
map[(player_y)*mapwidth + player_x] = PLAYER;
for ii ( 0 .. comb_parts - 1)
{
msg_combat[ii] = 0;
}
}
label { "Move N" }
when
{
(lose == NO) and
(map[(player_y - 1)*mapwidth + (player_x + 1)] == FLOOR)
}
allow
{
map[(player_y)*mapwidth + player_x] = FLOOR;
player_x++;
player_y--;
map[(player_y)*mapwidth + player_x] = PLAYER;
for ii ( 0 .. comb_parts - 1)
{
msg_combat[ii] = 0;
}
}
label { "Move NE" }
when
{
(lose == NO) and
(map[(player_y)*mapwidth + (player_x - 1)] == FLOOR)
}
allow
{
map[(player_y)*mapwidth + player_x] = FLOOR;
player_x--;
map[(player_y)*mapwidth + player_x] = PLAYER;
for ii ( 0 .. comb_parts - 1)
{
msg_combat[ii] = 0;
}
}
label { "Move W" }
when
{
lose == NO
}
allow
{
FLOOR = FLOOR;
for ii ( 0 .. comb_parts - 1)
{
msg_combat[ii] = 0;
}
}
label { "Stay still" }
when
{
(lose == NO) and
(map[(player_y)*mapwidth + (player_x + 1)] == FLOOR)
}
allow
{
map[(player_y)*mapwidth + player_x] = FLOOR;
player_x++;
map[(player_y)*mapwidth + player_x] = PLAYER;
for ii ( 0 .. comb_parts - 1)
{
msg_combat[ii] = 0;
}
}
label { "Move E" }
when
{
(lose == NO) and
(map[(player_y + 1)*mapwidth + (player_x - 1)] == FLOOR)
}
allow
{
map[(player_y)*mapwidth + player_x] = FLOOR;
player_x--;
player_y++;
map[(player_y)*mapwidth + player_x] = PLAYER;
for ii ( 0 .. comb_parts - 1)
{
msg_combat[ii] = 0;
}
}
label { "Move SW" }
when
{
(lose == NO) and
(map[(player_y + 1)*mapwidth + player_x] == FLOOR)
}
allow
{
map[(player_y)*mapwidth + player_x] = FLOOR;
player_y++;
map[(player_y)*mapwidth + player_x] = PLAYER;
for ii ( 0 .. comb_parts - 1)
{
msg_combat[ii] = 0;
}
}
label { "Move S" }
when
{
(lose == NO) and
(map[(player_y + 1)*mapwidth + (player_x + 1)] == FLOOR)
}
allow
{
map[(player_y)*mapwidth + player_x] = FLOOR;
player_x++;
player_y++;
map[(player_y)*mapwidth + player_x] = PLAYER;
for ii ( 0 .. comb_parts - 1)
{
msg_combat[ii] = 0;
}
}
label { "Move SE" }
when
{
(lose == NO) and
(map[(player_y - 1)*mapwidth + (player_x - 1)] == GOBLIN)
}
allow
{
hp--;
msg_combat[0] = 2;
msg_combat[1] = 7;
msg_combat[2] = 4;
msg_combat[3] = 7;
msg_combat[4] = 1;
msg_combat[5] = 8;
if (hp == 0)
{
lose = YES;
msg_info[0] = 1;
}
}
label { "Attack from NW" }
when
{
(lose == NO) and
(map[(player_y - 1)*mapwidth + (player_x)] == GOBLIN)
}
allow
{
hp--;
msg_combat[0] = 2;
msg_combat[1] = 7;
msg_combat[2] = 4;
msg_combat[3] = 7;
msg_combat[4] = 1;
msg_combat[5] = 8;
if (hp == 0)
{
lose = YES;
msg_info[0] = 1;
}
}
label { "Attack from N" }
when
{
(lose == NO) and
(map[(player_y - 1)*mapwidth + (player_x + 1)] == GOBLIN)
}
allow
{
hp--;
msg_combat[0] = 2;
msg_combat[1] = 7;
msg_combat[2] = 4;
msg_combat[3] = 7;
msg_combat[4] = 1;
msg_combat[5] = 8;
if (hp == 0)
{
lose = YES;
msg_info[0] = 1;
}
}
label { "Attack from NE" }
when
{
(lose == NO) and
(map[(player_y)*mapwidth + (player_x - 1)] == GOBLIN)
}
allow
{
hp--;
msg_combat[0] = 2;
msg_combat[1] = 7;
msg_combat[2] = 4;
msg_combat[3] = 7;
msg_combat[4] = 1;
msg_combat[5] = 8;
if (hp == 0)
{
lose = YES;
msg_info[0] = 1;
}
}
label { "Attack from W" }
when
{
(lose == NO) and
(map[(player_y)*mapwidth + (player_x + 1)] == GOBLIN)
}
allow
{
hp--;
msg_combat[0] = 2;
msg_combat[1] = 7;
msg_combat[2] = 4;
msg_combat[3] = 7;
msg_combat[4] = 1;
msg_combat[5] = 8;
if (hp == 0)
{
lose = YES;
msg_info[0] = 1;
}
}
label { "Attack from E" }
when
{
(lose == NO) and
(map[(player_y + 1)*mapwidth + (player_x - 1)] == GOBLIN)
}
allow
{
hp--;
msg_combat[0] = 2;
msg_combat[1] = 7;
msg_combat[2] = 4;
msg_combat[3] = 7;
msg_combat[4] = 1;
msg_combat[5] = 8;
if (hp == 0)
{
lose = YES;
msg_info[0] = 1;
}
}
label { "Attack from SW" }
when
{
(lose == NO) and
(map[(player_y + 1)*mapwidth + (player_x)] == GOBLIN)
}
allow
{
hp--;
msg_combat[0] = 2;
msg_combat[1] = 7;
msg_combat[2] = 4;
msg_combat[3] = 7;
msg_combat[4] = 1;
msg_combat[5] = 8;
if (hp == 0)
{
lose = YES;
msg_info[0] = 1;
}
}
label { "Attack from S" }
when
{
(lose == NO) and
(map[(player_y + 1)*mapwidth + (player_x + 1)] == GOBLIN)
}
allow
{
hp--;
msg_combat[0] = 2;
msg_combat[1] = 7;
msg_combat[2] = 4;
msg_combat[3] = 7;
msg_combat[4] = 1;
msg_combat[5] = 8;
if (hp == 0)
{
lose = YES;
msg_info[0] = 1;
}
}
label { "Attack from SE" }
}
display
{
stringtable glyphs {".", "@", "—", "|", "#", "g"}
stringtable info { "Welcome. Your dungeon is being prepared. Mind the Goblin, he's cranky.", "You die" }
stringtable combat { " ", "you", "the goblin", "hit", "hits", "miss", "misses", " ", "." }
box {content {"Rogue-Hack"}}
newline
// Draw the grid
for y ( 0 .. (mapheight-1) )
{
for x ( 0 .. (mapwidth-1) )
{
box
{
width { 1em }
height { 1em }
content { glyphs[ map[(y*mapwidth)+x] ] }
}
}
newline
}
newline
// Information
box
{
width { 3em }
height { 1em }
content { "HP: " hp }
}
newline
// Controls
box
{
width { 2em }
height { 2em }
border { 1px solid black }
content { "↖" }
bind_action { "Move NW" }
bind_action { "Attack from N" }
bind_action { "Attack from W" }
bind_action { "Attack from NW" }
}
box
{
width { 2em }
height { 2em }
border { 1px solid black }
content { "↑" }
bind_action { "Move N" }
bind_action { "Attack from NW" }
bind_action { "Attack from N" }
bind_action { "Attack from NE" }
bind_action { "Attack from W" }
bind_action { "Attack from E" }
}
box
{
width { 2em }
height { 2em }
border { 1px solid black }
content { "↗" }
bind_action { "Move NE" }
bind_action { "Attack from N" }
bind_action { "Attack from E" }
bind_action { "Attack from NE" }
}
newline
box
{
width { 2em }
height { 2em }
border { 1px solid black }
content { "←" }
bind_action { "Move W" }
bind_action { "Attack from NW" }
bind_action { "Attack from N" }
bind_action { "Attack from W" }
bind_action { "Attack from SW" }
bind_action { "Attack from S" }
}
box
{
width { 2em }
height { 2em }
border { 1px solid black }
content { "X" }
bind_action { "Stay still" }
bind_action { "Attack from NW" }
bind_action { "Attack from N" }
bind_action { "Attack from NE" }
bind_action { "Attack from W" }
bind_action { "Attack from E" }
bind_action { "Attack from SW" }
bind_action { "Attack from S" }
bind_action { "Attack from SE" }
}
box
{
width { 2em }
height { 2em }
border { 1px solid black }
content { "→" }
bind_action { "Move E" }
bind_action { "Attack from NE" }
bind_action { "Attack from N" }
bind_action { "Attack from E" }
bind_action { "Attack from SE" }
bind_action { "Attack from S" }
}
newline
box
{
width { 2em }
height { 2em }
border { 1px solid black }
content { "↙" }
bind_action { "Move SW" }
bind_action { "Attack from S" }
bind_action { "Attack from W" }
bind_action { "Attack from SW" }
}
box
{
width { 2em }
height { 2em }
border { 1px solid black }
content { "↓" }
bind_action { "Move S" }
bind_action { "Attack from SW" }
bind_action { "Attack from S" }
bind_action { "Attack from SE" }
bind_action { "Attack from W" }
bind_action { "Attack from E" }
}
box
{
width { 2em }
height { 2em }
border { 1px solid black }
content { "↘" }
bind_action { "Move SE" }
bind_action { "Attack from S" }
bind_action { "Attack from E" }
bind_action { "Attack from SE" }
}
newline
box
{
content{ info[msg_info[0]] }
}
newline
box
{
content{ combat[msg_combat[0]] combat[msg_combat[1]] combat[msg_combat[2]] combat[msg_combat[3]] combat[msg_combat[4]] combat[msg_combat[5]] combat[msg_combat[6]] combat[msg_combat[7]] }
}
}