Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • 0
Grey_Wolf

Script syntax error

Question

HI folks, I'm trying to get a bleeding  script to work. I want the player to slowly lose health (1 point every 10 seconds) after if he gets to 25 health, and make the bleeding stop if he gain enough health to go above 25 again.

Spoiler

script "BLEEDOUT" ENTER
{
    while(CheckActorProperty(0, APROP_HEALTH,< 25))
    {
        SetFont("bleedicon");
        SetHudSize(640, 480, true);
        HudMessage(s:"a"; HUDMSG_FADEOUT, 200, CR_UNTRANSLATED, 320.0, 240.0,10);
        Thing_Damage(0,1);
        delay(35*10);
    }
}

Am I in the right direction?

Apparently there's a syntax error that prevents me from compiling it, but I'm still too inexperienced to spot the error... sigh

 

Line 6 in file "C:/#GAMES/DOOM/Editor/Modding/Temp\BLEEDINGACS.acs" ...
C:/#GAMES/DOOM/Editor/Modding/Temp\BLEEDINGACS.acs:6: Syntax error in expression.
>  while(CheckActorProperty(0, APROP_HEALTH,<
>                                           ^
C:/#GAMES/DOOM/Editor/Modding/Temp\BLEEDINGACS.acs:6: Missing ')'.
>  while(CheckActorProperty(0, APROP_HEALTH,< 25)
>                                              ^

Share this post


Link to post

11 answers to this question

Recommended Posts

  • 1
34 minutes ago, Grey_Wolf said:

And still, absolutely NOTHING happens with health below 25... FML

 

Take your original code you had:

script "BLEEDOUT" ENTER
{
    while(CheckActorProperty(0, APROP_HEALTH,< 25)) //this needs to be different
    {
        SetFont("bleedicon");
        SetHudSize(640, 480, true);
        HudMessage(s:"a"; HUDMSG_FADEOUT, 200, CR_UNTRANSLATED, 320.0, 240.0,10);
        Thing_Damage(0,1);
        delay(35*10);
    }
}

And change your while statement:

script "BLEEDOUT" ENTER
{
    while(GetActorProperty(0, APROP_HEALTH) < 25)
    {
        SetFont("bleedicon");
        SetHudSize(640, 480, true);
        HudMessage(s:"a"; HUDMSG_FADEOUT, 200, CR_UNTRANSLATED, 320.0, 240.0,10);
        Thing_Damage(0,1);
        delay(35*10);
    }
}

You cannot use comparative operators like < inside statements as arguments like you were doing.

 

Sorry for the confusion. My brain isn't working very good today apparently. :P

 

Share this post


Link to post
  • 1
29 minutes ago, Grey_Wolf said:

ISSUE 1: the "setfont" command doesn't work. I've put my "bleedicon" both in GRAPHICS and SPRITES, but nothing seems to change

ISSUE 2: The "A" letter appear for less than a second, even if I set a hold time of 5 seconds and a delay to let it stay in place that long

 

SetFont only works with fonts that you've defined in FONTDEFS: https://zdoom.org/wiki/SetFont

If it's an image, it has to be named 8 characters or less.

Share this post


Link to post
  • 1
2 minutes ago, Grey_Wolf said:

Oh i didn't know about the characters limit. That's why it worked with another picture i used in another script. Thank you again! 

 

Of course!

 

Also, the wiki is your friend: https://zdoom.org/wiki/Main_Page

Share this post


Link to post
  • 0

It looks like you're missing a closing brace:

 

while(CheckActorProperty(0, APROP_HEALTH,< 25))

 

Edited by R4L

Share this post


Link to post
  • 0

I adapted it like this, but not a single command is being carried out after health drops below 25:

 

Spoiler

#library "BLEEDINGACS"
#include "zcommon.acs"

Script "BLEEDOUT" Enter
{
  While(TRUE)
  {
    int health = GetActorProperty(0, APROP_Health);

    If(health <= 25)
    {
        SetFont("bleedicon");
        SetHudSize(640, 480, true);
        HudMessage(s:"a"; HUDMSG_FADEOUT, 200, CR_UNTRANSLATED, 320.0, 240.0,10);
        Damagething(1);
        delay(35*10);
    }

    Delay(1);
  }
}

 

Share this post


Link to post
  • 0
31 minutes ago, R4L said:

It looks like you're missing a closing brace:

 


while(CheckActorProperty(0, APROP_HEALTH,< 25))

 

But it's already there in the code I posted earlier(in spoilers), lol. I'm so confused

Share this post


Link to post
  • 0

Omg I am so stupid. Your while statement should look like this:

while(GetActorProperty(0, APROP_HEALTH) < 25)
{

 

Share this post


Link to post
  • 0

I tried like this:

Spoiler

#library "BLEEDINGACS"
#include "zcommon.acs"

Script "BLEEDOUT" ENTER
{
    while(GetActorProperty(0, APROP_HEALTH) < 25)
    {
        SetFont("bleedicon");
        SetHudSize(640, 480, true);
        HudMessage(s:"a"; HUDMSG_FADEOUT, 200, CR_UNTRANSLATED, 320.0, 240.0,10);
        Damagething(1);
        delay(35*10);
    }

    Delay(1);
    HudMessage(s:"";HUDMSG_FADEOUT, 200, CR_UNTRANSLATED, 320.0, 240.0,10);
}

 

and also like this:
 

Spoiler

Script "BLEEDOUT" Enter
{
  While(TRUE)
  {
    int health = GetActorProperty(0, APROP_Health);

    If(health <= 25)
    {
        SetFont("bleedicon");
        SetHudSize(640, 480, true);
        HudMessage(s:"a"; HUDMSG_FADEOUT, 200, CR_UNTRANSLATED, 320.0, 240.0,10);
        Damagething(1);
        delay(35*10);
    }

    Delay(1);
  }
}

 

And still, absolutely NOTHING happens with health below 25... FML

 

 

 

10479740_453259424816195_5639172230281567637_n.jpg

Share this post


Link to post
  • 0

Omg I'm finally taking some steps forward, thank you for your assistance...

Even though something's still off:

Spoiler

#library "BLEEDINGACS"
#include "zcommon.acs"

 Script "BLEEDOUT" Enter
{
  While(TRUE)
  {
    int health = GetActorProperty(0, APROP_Health);

    If(health <= 25)
    {
        setfont("bleedicon");
        SetHudSize(640, 480, true);
        HudMessage(s:"A"; HUDMSG_FADEINOUT, 200, CR_UNTRANSLATED, 320.0, 240.0,35*5);
        setactorproperty(0,APROP_Speed,0.3);
        delay(35*5);
        Damagething(1);
        spawn("BloodDriping",0,0,10,0);
        delay(35*5);
    }

    Delay(1);

 

ISSUE 1: the "setfont" command doesn't work. I've put my "bleedicon" both in GRAPHICS and SPRITES, but nothing seems to change

ISSUE 2: The "A" letter appear for less than a second, even if I set a hold time of 5 seconds and a delay to let it stay in place that long

Share this post


Link to post
  • 0

Oh i didn't know about the characters limit. That's why it worked with another picture i used in another script. Thank you again! 

Share this post


Link to post
  • 0

Sorry to bother you again, but I've almost got eveything to work except for one small thing... probably something silly.

 

Spoiler

Script "BLEEDOUT" Enter
{
  While(TRUE)
  {
    int health = GetActorProperty(0, APROP_Health);

    If(health <= 25)
    {
        setfont("bleeding");
        SetHudSize(640, 480, true);
        HudMessage(s:"A"; HUDMSG_FADEINOUT, 200, CR_UNTRANSLATED, 0.0, 50.0,10.0);
        setactorproperty(0,APROP_Speed,0.3);
        delay(35*5);
        setfont("BLEED3");
        HudMessage(s:"A"; HUDMSG_FADEINOUT, 201, CR_UNTRANSLATED, 320.0, 240.0,9.0);
        Damagething(1);
        int x = GetActorX(0);
        int y = GetActorY(0);
        int z = GetActorZ(0);
        Spawnforced("DrippingBlood",x,y,z,0,0);
        delay(35*5);
    }

    Delay(1);
  }
}

This is my code right now. For some unknown reasons, the "dripping blood" freezes mid-air right after spawning. If i use the console "summon" command to spawn the actor, the blood falls to the ground normally. Solving this last tiny issue would finally let me take a rest from this "bleeding nightmare" for a while, so any help would be very appreciated.

 

EDIT: SOLVED

 

Quote

Also, the wiki is your friend: https://zdoom.org/wiki/Main_Page

 Yeah well, I actually look at it all the time, but there some things I simply cannot find there or in older threads from this or other forums. Trust me, I try very hard to not make too many topics because I hate being a nuisance to others, but the truth is that I still can't do very much on my own, plain and simple.
I'd love to learn more though, and this is just what I'm trying to do.

Edited by Grey_Wolf

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
×