Q: Can I create an entity, assign it an action and when my player touches it the engine will play an avi file with sound?
A: Sure. Use the code below:

action avi_trigger
{
my.passable = on;
while (player == null) {wait (1);}
while (vec_dist(my.x, player.x) > 100) {wait (1);}
media_play("test.avi", null, 100);
}

Q: I use your dart game from Aum23. How can I prevent multiple darts from being fired when the player clicks the mouse quickly several times?
A: Take this line from function stop_dart():

number_of_darts += 1; // another dart was fired

and move it inside function main:

function main()
{
camera.arc = 60; // normal field of view (fov)
fps_max = 30; // no need to have over 30 fps
level_load (board_wmb);
wait (2);
mouse_map = mouse_pcx; // it's a 2d dart picture
mouse_mode = 2; // the mouse can move freely
mouse_pos.x = 372; // center of the screen
mouse_pos.y = 272; // we substract 28 pixels = mouse pointer / 2
while (1)
{
if (key_t == 1) // press and hold "T" to get rid of the random dart movement, just for calibration
{
mouse_pos.x = pointer.x; // "normal" mouse movement
mouse_pos.y = pointer.y;
}
else
{
counter += 1;
if (counter == 1) // set a random target then wait until it was reached
{
random_x = 20 - int(random(40)); // generate random numbers only once
random_y = 20 - int(random(40)); // generate integer random numbers
}
if (mouse_pos.x < pointer.x + random_x) {mouse_pos.x += 1;} // move the mouse in the direction
if (mouse_pos.x > pointer.x + random_x) {mouse_pos.x -= 1;} // of the random target
if (mouse_pos.y < pointer.y + random_y) {mouse_pos.y += 1;} // on x and y
if (mouse_pos.y > pointer.y + random_y) {mouse_pos.y -= 1;}
if ((mouse_pos.x == pointer.x + random_x) && (mouse_pos.y == pointer.y + random_y)) // if the random target was reached
{
counter = 0; // generate a new pair of random numbers
}
}
if (mouse_left == 1 && number_of_darts < 5) // if we fire a new dart and we haven't fired all the darts yet
{
while (mouse_left == 1) {wait (1);} // wait until we release the left mouse button - disable autofire
number_of_darts += 1; // another dart was fired
dart_coords.x = mouse_pos.x + 28; // 28 = mouse pointer bitmap / 2
dart_coords.y = mouse_pos.y + 28;
dart_coords.z = 100; // 100 quants in front of the screen
vec_for_screen(dart_coords, camera); // change 2d coords to 3d coords
ent_create(dart_mdl, dart_coords, move_dart); // create the dart
}
wait (1);
}
}

Q: How can you display a bar in the top left corner which shows how much armor you have left (like a health bar)?
A: Use the code example below:

bmap armor_pcx = <armor.pcx>;

panel armor_pan
{
pos_x = 0;
pos_y = 0;
layer = 10;
hbar = 5, 20, 100, armor_pcx, 1, player._armor;
flags = overlay, refresh, visible;
}

Q: How can I keep only the 1st person view and not change views when the player presses F7?
A: Place this line of code inside your main function:

on_f7 = null;

Q: How can I place a panel on the screen which changes its bmp automatically for the three main resolutions (640, 800, and 1024 pixels)?
A: Use this piece of code:

bmap p640_pcx = <p640.pcx>;
bmap p800_pcx = <p800.pcx>;
bmap p1024_pcx = <p1024.pcx>;

panel auto_pan
{
bmap = p640_pcx;
pos_x = 0;
pos_y = 0;
layer = 10;
flags = overlay, refresh, visible;
}

starter change_pans()
{
while (1)
{
if (video_mode == 6) // 640 x 480 pixels
{
auto_pan.bmap = p640_pcx;
}
if (video_mode == 7) // 800 x 600 pixels
{
auto_pan.bmap = p800_pcx;
}
if (video_mode == 8) // 1024 x 768 pixels
{
auto_pan.bmap = p1024_pcx;
}
wait (1);
}
}

Q: I would like to be able to reload my weapons when I press the "R" key. How can I do that?
A: Use the code below:

function reload_weapons()
{
while (key_r == 1) {wait (1);}
ammo1 = 100; // give 100 bullets for the weapon that uses ammo1
ammo2 = 50; // give 50 bullets for the weapon that uses ammo2
......... // and so on
}

on_r reload_weapons;

Q: I am making a game that needs to play a sound when the player collides with one of the level blocks, but the sound keeps playing while you are colliding with the block. How would you change it so that the sound only plays once when you hit the wall?
A: Use the code below:

sound crash_wav = <crash.wav>;

function crash_event;

action players_car
{
my.enable_block = on;
my.event = crash_event;
.................................
}

function crash_event()
{
if (event_type == event_block)
{
snd_play (crash_wav, 50, 0);
my.event = null; // stop the event triggering
sleep (5); // for 5 seconds;
my.event = crash_event; // enable the event again
}
if (event_type == .........)
{
.............................
}
}
Q: I have no idea how to do this thing about defining the width and height of my font. Can anybody help?
A: If a character in your font has (just an example) 19 x 22 pixels, the bitmap for your font should have 19 * 32 x 22 * 4 pixels = 608 x 88 pixels. The font must have 32 columns and 4 or 8 rows.

font my_font = <mybitmap.pcx>, 19, 22;

Q: I am working with a lot of panels on the screen, and I need to be able to move them around the screen. Is there a way that i can find out which panel was clicked? Kinda get the panels name...
A: The next engine update (A6.1) will include the panel pointer. Read more about it and see a code sample in "Hot features".