Ok here is an example of the top of my head...
1) Create a variable to act as counter.
2) Create a TEXT object with the string set as the longest gun name.
3) Create a function for the Q and E keys, which inside increments the counter.
4) Check the counter number against gun number or something
5) Finally change the TEXT object's string by using str_cpy( my_text.string[0], "Gun name here!!!" );
Here is an example to clear things up. Just copy all of this into a blank WDL file and then run it. Press Q & E and the weapon names will switch.
var gun_number=1;
TEXT gun_label
{
pos_x=0;
pos_y=0;
string="Rocket Launcher";
flags=VISIBLE;
}
function check_weapon()
{
if(gun_number==1){str_cpy(gun_label.string[0], "Machine Gun");}
if(gun_number==2){str_cpy(gun_label.string[0], "Shotgun");}
if(gun_number==3){str_cpy(gun_label.string[0], "Rocket Launcher");}
if(gun_number==4){str_cpy(gun_label.string[0], "Shock Rifle");}
if(gun_number==5){str_cpy(gun_label.string[0], "Railgun");}
}
function prev_weapon()
{
if (gun_number==5){gun_number=1;}else{gun_number+=1;}
check_weapon();
}
function next_weapon()
{
if (gun_number==1){gun_number=5;}else{gun_number-=1;}
check_weapon();
}
function main()
{
vec_set(screen_color,vector(255,0,0)); // set background to prevent blur rendering
check_weapon();
on_q=prev_weapon;
on_e=next_weapon;
}
I've built this example with 5 weapons although it is easy to add more.
Just make sure that the TEXT object's string is set to the longest name of a weapon.