Page 1 of 1

[ACS] P-CODE error after compiled acs

Posted: Wed Aug 02, 2017 9:58 pm
by doomjoshuaboy
hi guys
For some reason, I tried to add a script that was improved a lot:

Code: Select all

Script "RandomWeaponGenerator" ENTER
{
    str Weapons[3] = {"railgun", "minigun", "plasmarifle"};

    while (true)
    {
        int Rand = random(0, 2);

        GiveInventory(Weapons[Rand], 1); //Gives a random weapon from the weapons array. Indexing starts from 0 to ArrayElements - 1.
        Print(s:"The gods have gifted you with ", s:Weapons[Rand], s:".");

        Delay(35problem *10); //10 seconds.
    }
}

Script "ChangeGrav" (void)
{
    if (GetActorProperty(0, APROP_Gravity) == 0.5)
        SetActorProperty(0, APROP_Gravity, 1.0);
    else
        SetActorProperty(0, APROP_Gravity, 0.5);
}
but gives me script errors

and when I tried toggle change it to low gravity as I jumped, didn't work, the script name works but the gravity didn't change.

Image


DoomJoshuaBoy

[ACS] Re: P-CODE error after compiled acs

Posted: Wed Aug 02, 2017 10:11 pm
by Fused
Try adding static before your array

Code: Select all

static str Weapons[3] = {"railgun", "minigun", "plasmarifle"};
if that doesn't help, put your array outside the script.

also, what the hell is Delay(35problem *10);

[ACS] Re: P-CODE error after compiled acs

Posted: Wed Aug 02, 2017 10:25 pm
by doomjoshuaboy
Fused wrote:Try adding static before your array

Code: Select all

static str Weapons[3] = {"railgun", "minigun", "plasmarifle"};
also, what the hell is Delay(35problem *10);

ill give that a go

also, i think the delay for 10 seconds or so I think?

[ACS] Re: P-CODE error after compiled acs

Posted: Wed Aug 02, 2017 10:28 pm
by Fused
doomjoshuaboy wrote:
Fused wrote:Try adding static before your array

Code: Select all

static str Weapons[3] = {"railgun", "minigun", "plasmarifle"};
also, what the hell is Delay(35problem *10);

ill give that a go

also, i think the delay for 10 seconds or so I think?
but why does it randomly say problem? A typo I assume? Anyway, see if it fixes it.

[ACS] Re: P-CODE error after compiled acs

Posted: Thu Aug 03, 2017 12:33 am
by ZZYZX
Unknown pcode error is always a sign of STOP USING ZDOOM ACS COMPILER GOD. Use the Zandronum one. The one that does not allow things that don't work anyway.

[ACS] Re: P-CODE error after compiled acs

Posted: Thu Aug 03, 2017 12:55 am
by Empyre
Back in the mid-80s, I remember using UCSD Pascal in college, and it compiled into p-code, which was then run by an interpreter. That was supposed to make it more portable. You would just need an interpreter for each type of computer you wanted to run the code on.
https://en.wikipedia.org/wiki/P-code_machine

I am sure that this pcode is something completely different, but seeing the word pcode brought me back.

[ACS] Re: P-CODE error after compiled acs

Posted: Tue Aug 29, 2017 8:04 am
by Fused
For the record, my solution fixed this btw.