[ACS] P-CODE error after compiled acs

Old stuff gets archived here.
Locked
User avatar
doomjoshuaboy
SNS Team
Posts: 273
Joined: Thu Aug 02, 2012 5:36 am
Location: NSW, Australia
Contact:

[ACS] P-CODE error after compiled acs

#1

Post by doomjoshuaboy » Wed Aug 02, 2017 9:58 pm

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

User avatar
Fused
Contributor
Posts: 623
Joined: Sat Nov 09, 2013 9:47 am
Location: Netherlands
Clan: TK
Contact:

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

#2

Post by Fused » Wed Aug 02, 2017 10:11 pm

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);

User avatar
doomjoshuaboy
SNS Team
Posts: 273
Joined: Thu Aug 02, 2012 5:36 am
Location: NSW, Australia
Contact:

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

#3

Post by doomjoshuaboy » Wed Aug 02, 2017 10:25 pm

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?

User avatar
Fused
Contributor
Posts: 623
Joined: Sat Nov 09, 2013 9:47 am
Location: Netherlands
Clan: TK
Contact:

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

#4

Post by Fused » Wed Aug 02, 2017 10:28 pm

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.

User avatar
ZZYZX
Posts a lot
Posts: 742
Joined: Thu Jun 07, 2012 5:56 pm
Location: Ukraine
Clan: A3
Clan Tag: [A3]

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

#5

Post by ZZYZX » Thu Aug 03, 2017 12:33 am

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.

User avatar
Empyre
Zandrone
Posts: 1268
Joined: Sun Jul 08, 2012 6:41 am
Location: Garland, TX, USA

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

#6

Post by Empyre » Thu Aug 03, 2017 12:55 am

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.
"For the world is hollow, and I have touched the sky."

User avatar
Fused
Contributor
Posts: 623
Joined: Sat Nov 09, 2013 9:47 am
Location: Netherlands
Clan: TK
Contact:

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

#7

Post by Fused » Tue Aug 29, 2017 8:04 am

For the record, my solution fixed this btw.

Locked