How to execute this script on a properly way?

Discuss all aspects related to modding Zandronum here.
Post Reply
User avatar
ibm5155
Addicted to Zandronum
Posts: 1641
Joined: Tue Jun 05, 2012 9:32 pm
Location: Somewhere, over the rainbow

How to execute this script on a properly way?

#1

Post by ibm5155 » Fri May 31, 2013 5:24 pm

Hi again :razz: so, I have a working script but the way it works is weird D:

Ok here´s the script

Code: Select all

int mcdonald=0;
script 29 (void)
{//Nedm Script Switch counter to allow nedm
    mcdonald++;
    if(mcdonald==5)
    {
        ceiling_raisebyvalue(91,1,8);
        printbold(n:0, s:" found the latest secret switch!!!");
    }
    else if(mcdonald==55)
    {
        ceiling_lowerbyvalue(91,100,8);
        ceiling_raisebyvalue(92,1,8);
    }
    else if(mcdonald==105)
    {
        HudMessagebold(s:"WARNING, NEDM ACTIVED, IF YOU DONT WANT A CAT AND LOGO SPAM DO THIS:JUMP+CROUCH+FIRE AT THE SAME TIME,\n DO THE SAME DO ACTIVE IT AGAIN"; HUDMSG_FADEINOUT, 0, CR_UNTRANSLATED, 0.5, 0.5,15.1,0, 0.3);
        acs_execute(30,0,0,0,0);
        ceiling_lowerbyvalue(92,100,8);
        delay(353);
        floor_lowerbyvalue(89,200,200);
        floor_lowerbyvalue(90,200,200);
        tagwait(90);
        Floor_Waggle(89, 2000, 100, 0, 0);
        delay(100);
        Floor_Waggle(90, 2000, 100, 0, 0);
    }
}

        
int nedm_desactive=false;

script 30 (void) clientside
{
    int counter=0;
    int posy=-3.0;
    while(posy<=0.05)
    {
        SetFont("NEDML");
        HudMessagebold(s:"A"; HUDMSG_FADEINOUT, 0, CR_UNTRANSLATED, 0.5, posy,0.1,0, 0.3);
        posy+=0.01;
        delay(1);
    }
    SetFont("NEDML");
    HudMessagebold(s:"A"; HUDMSG_PLAIN , 800, counter, 0.5, posy,0,0, 0);
    Music_Played=3;
    setmusic("NEDM",0,0);
    delay(35);
    spawnspot("FlareDisco",87,132,0);
    ACS_Suspend(34,0);
    acs_execute(31,0);
    acs_Execute(32,0);
    acs_execute(33,0);
    while(true)
    {
        if(GetPlayerInput(ConsolePlayerNumber(),INPUT_BUTTONS)==13)
        {
            if(nedm_desactive==true)
            {
                setfont("smallfont");
                printbold(s:"nedm actived");
                nedm_desactive=false;
                SetFont("NEDML");
                HudMessagebold(s:"A"; HUDMSG_PLAIN , 800, counter, 0.5, posy,0,0, 0);
                delay(50);
            }
            else
            {
                setfont("smallfont");
                print(s:"nedm desactived");
                nedm_desactive=true;
                HudMessagebold(s:""; HUDMSG_PLAIN , 800, counter, 0.5, posy,1,1, 1);
                delay(50);
            }
        }
        delay(1);
    
    }
}
For some reason the comand " if(GetPlayerInput(ConsolePlayerNumber(),INPUT_BUTTONS)==13)" is geting the server input O_o and it should get the player input (since it´ll affect only the player who don´t want it)

So how did I fix it? simple

Code: Select all

int mcdonald=0;
script 29 (void)
{//Nedm Script Switch counter to allow nedm
    mcdonald++;
    if(mcdonald==5)
    {
        ceiling_raisebyvalue(91,1,8);
        printbold(n:0, s:" found the latest secret switch!!!");
    }
    else if(mcdonald==55)
    {
        ceiling_lowerbyvalue(91,100,8);
        ceiling_raisebyvalue(92,1,8);
    }
    else if(mcdonald==105)
    {
        HudMessagebold(s:"WARNING, NEDM ACTIVED, IF YOU DONT WANT A CAT AND LOGO SPAM DO THIS:JUMP+CROUCH+FIRE AT THE SAME TIME,\n DO THE SAME DO ACTIVE IT AGAIN"; HUDMSG_FADEINOUT, 0, CR_UNTRANSLATED, 0.5, 0.5,15.1,0, 0.3);
        acs_execute(66,0,0,0,0);
        ceiling_lowerbyvalue(92,100,8);
        delay(353);
        floor_lowerbyvalue(89,200,200);
        floor_lowerbyvalue(90,200,200);
        tagwait(90);
        Floor_Waggle(89, 2000, 100, 0, 0);
        delay(100);
        Floor_Waggle(90, 2000, 100, 0, 0);
    }
}

        
int nedm_desactive=false;

script 66 (void) clientside
{
 acs_execute(30,0,0,0,0);
}

script 30 (void) clientside
{
    int counter=0;
    int posy=-3.0;
    while(posy<=0.05)
    {
        SetFont("NEDML");
        HudMessagebold(s:"A"; HUDMSG_FADEINOUT, 0, CR_UNTRANSLATED, 0.5, posy,0.1,0, 0.3);
        posy+=0.01;
        delay(1);
    }
    SetFont("NEDML");
    HudMessagebold(s:"A"; HUDMSG_PLAIN , 800, counter, 0.5, posy,0,0, 0);
    Music_Played=3;
    setmusic("NEDM",0,0);
    delay(35);
    spawnspot("FlareDisco",87,132,0);
    ACS_Suspend(34,0);
    acs_execute(31,0);
    acs_Execute(32,0);
    acs_execute(33,0);
    while(true)
    {
        if(GetPlayerInput(ConsolePlayerNumber(),INPUT_BUTTONS)==13)
        {
            if(nedm_desactive==true)
            {
                setfont("smallfont");
                printbold(s:"nedm actived");
                nedm_desactive=false;
                SetFont("NEDML");
                HudMessagebold(s:"A"; HUDMSG_PLAIN , 800, counter, 0.5, posy,0,0, 0);
                delay(50);
            }
            else
            {
                setfont("smallfont");
                print(s:"nedm desactived");
                nedm_desactive=true;
                HudMessagebold(s:""; HUDMSG_PLAIN , 800, counter, 0.5, posy,1,1, 1);
                delay(50);
            }
        }
        delay(1);
    
    }
}
I call a clientside script who calls another clientside script, the good part is it works :D, but I lost one script number and I really doesn´t like that solution '-'.
So, There´s another way that I could do the same thing without stoling a script to call another script?
Projects
Cursed Maze: DONE, V2.0
Zombie Horde - ZM09 map update: [3/15/13]
Need help with English? Then you've come to the right place!

<this post is proof of "Decline">

Ijon Tichy
Frequent Poster Miles card holder
Posts: 901
Joined: Mon Jun 04, 2012 5:07 am

RE: How to execute this script on a properly way?

#2

Post by Ijon Tichy » Fri May 31, 2013 7:08 pm

Uh
just use -1 as the player number for GetPlayerNumber
and turn compat_clientssendfullbuttoninfo on

edit: also why in hell would you want a script that in turn only executes another script
why are you using ACS_Execute and not ACS_ExecuteAlways
Last edited by Ijon Tichy on Fri May 31, 2013 7:09 pm, edited 1 time in total.

User avatar
ibm5155
Addicted to Zandronum
Posts: 1641
Joined: Tue Jun 05, 2012 9:32 pm
Location: Somewhere, over the rainbow

RE: How to execute this script on a properly way?

#3

Post by ibm5155 » Fri May 31, 2013 7:23 pm

the non clientside move shake the buildings (thing that a clientside script are not allowed to do) and the script 66, I don´t know, It fixed the problem that I have for some reason, before it was getting the server controls, and using the 66 script, it was getting each player controls :D

And I never used ACS_ExecuteAlways, does it do something that ACS_Execute doesn´t do? :s
Last edited by ibm5155 on Fri May 31, 2013 7:25 pm, edited 1 time in total.
Projects
Cursed Maze: DONE, V2.0
Zombie Horde - ZM09 map update: [3/15/13]
Need help with English? Then you've come to the right place!

<this post is proof of "Decline">

Ijon Tichy
Frequent Poster Miles card holder
Posts: 901
Joined: Mon Jun 04, 2012 5:07 am

RE: How to execute this script on a properly way?

#4

Post by Ijon Tichy » Fri May 31, 2013 7:32 pm

yeah, it allows multiple instances of the script to run

Post Reply