Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
rf`

Scripted crappage

Recommended Posts

int mapvar0;

script 8 (void)
{
	mapvar0++;
}

script 9 OPEN
{
	hudmessage(s:"score: ", i:"mapvar0", s:" points"; HUDMSG_PLAIN, 0, CR_UNTRANSLATED, 1.0, 0.0, 0);
}
For some reason mapvar0 in script 9 is completely unaffected by script 8. I'm trying to set up a simple score system.

Share this post


Link to post

You have to write i:mapvar0 instead of i:"mapvar0".
In this case "mapvar0" is just a normal string which in ACS gets converted into an index in the string table (let's say index 1). So your code says

hudmessage(..., i:1, ...);
and will happily print out the 1 (or whatever index it gets assigned to.)

Share this post


Link to post

That's correct, as the hudmessage won't change until you tell it to. Try this:

script 9 OPEN
{
hudmessage(s:"score: ", i:"mapvar0", s:" points"; HUDMSG_PLAIN, 0, CR_UNTRANSLATED, 1.0, 0.0, 0);
delay(1);
Restart;
}

Share this post


Link to post
The Ultimate DooMer said:

That's correct, as the hudmessage won't change until you tell it to. Try this:

script 9 OPEN
{
hudmessage(s:"score: ", i:"mapvar0", s:" points"; HUDMSG_PLAIN, 0, CR_UNTRANSLATED, 1.0, 0.0, 0);
delay(1);
Restart;
}


Better try:

script 9 OPEN
{
hudmessage(s:"score: ", i:mapvar0, s:" points"; HUDMSG_PLAIN, 0, CR_UNTRANSLATED, 1.0, 0.0, 0);
delay(1);
Restart;
}
unless you want the index of the string "mapvar0" to be printed.

Share this post


Link to post

I tried putting it into a loop yesterday, and it still does nothing.

Share this post


Link to post

Ok, try this instead:

script 9 OPEN
{
hudmessage(s:"score: ", d:mapvar0, s:" points"; HUDMSG_PLAIN, 0, CR_UNTRANSLATED, 1.0, 0.0, 0);
delay(1);
Restart;
}
That's what I use in my scoring system, so it should work.

Share this post


Link to post

Arrgh. Now I see that it is an OPEN script. OPEN scripts don't belong to any actor in the game and thus the message isn't printed. Either use hudmessagebold to display your message or use an ENTER script.

Share this post


Link to post

int mapvar0;

script 8 (void)
{
	mapvar0++;
}

script 9 ENTER
{
	hudmessagebold(s:"score: ", i:mapvar0, s:" points"; HUDMSG_PLAIN, 0, CR_UNTRANSLATED, 1.0, 0.0, 0);
	delay(1);
	restart;
}
It's still not working.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
×