Jump to content

Photo

Faster Conveyor Belts


  • Please log in to reply
26 replies to this topic

#1 Sparkster

Sparkster

    The Sparking Spark of ZC

  • Members

Posted 26 October 2016 - 05:59 AM

Hey guys.

 

Sry to force you again for scripting at my request but I have seen some quest using faster Conveyor Belt FFCs and something that pushes Link away faster. Do you know what I mean?

 

I can't see a script in the database so that's why I request this.

 

Is this only doable with a script or can it be done without?



#2 Anthus

Anthus

    Lord of Liquids

  • Members
  • Location:Ohio

Posted 26 October 2016 - 11:17 AM

I asked about something similar a while ago, and yeah, it requires a script. Iirc, it had to be a global script and it was more complex than it seems. I tried layering conveyors on top of each other but it didn't work. I ended up scrapping the idea though.

#3 Sparkster

Sparkster

    The Sparking Spark of ZC

  • Members

Posted 26 October 2016 - 01:00 PM

I asked about something similar a while ago, and yeah, it requires a script. Iirc, it had to be a global script and it was more complex than it seems. I tried layering conveyors on top of each other but it didn't work. I ended up scrapping the idea though.

 

How about a Slow Walk combo and one layer above a conveyor combo?



#4 Anthus

Anthus

    Lord of Liquids

  • Members
  • Location:Ohio

Posted 26 October 2016 - 03:26 PM

It can't work either. Besides damage combos, combos must be on layer 0 to work. :/

#5 Sparkster

Sparkster

    The Sparking Spark of ZC

  • Members

Posted 27 October 2016 - 09:16 AM

So...

 

It can't work either. Besides damage combos, combos must be on layer 0 to work. :/

Is someone able to script this?



#6 Sparkster

Sparkster

    The Sparking Spark of ZC

  • Members

Posted 07 November 2016 - 04:59 AM

Well? Nobody asked my question? Well it seems harder than it is, although I've seen it in some quests.



#7 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 12 November 2016 - 04:30 AM

Here is an unfinished header that I started making, to move objects on conveyors that normally do not move: http://pastebin.com/DaW7HgyE

 

You are essentially moving Link. I have some functions for that, as does Lejes, who was working on a header specifically for handling Link's speed.

 

You can try this, if you wish:

ffc script FasterConveyors{
    void run(int speed, int step){
        int timer = speed;
        while(true){
            if ( ComboT[ ComboAt(Link->X, Link->Y) ] == CT_CVLEFT ) {
                if ( !timer ) timer = speed;
                if ( timer > 1 ) timer--;
                if ( timer == 1 && CanWalk(Link->X, Link->Y, DIR_LEFT, step, false) ) {
                    Link->X--;
                    timer = speed;
                }
            }
            else if ( ComboT[ ComboAt(Link->X, Link->Y) ] == CT_CVRIGHT ) {
                if ( !timer ) timer = speed;
                if ( timer > 1 ) timer--;
                if ( timer == 1 && CanWalk(Link->X, Link->Y, DIR_RIGHT, step, false) ) {
                    Link->X++;
                    timer = speed;
                }
            }
            else if ( ComboT[ ComboAt(Link->X, Link->Y) ] == CT_CVUP ) {
                if ( !timer ) timer = speed;
                if ( timer > 1 ) timer--;
                if ( timer == 1 && CanWalk(Link->X, Link->Y, DIR_UP, step, false)  ) {
                    Link->Y--;
                    timer = speed;
                }
            }
            else if ( ComboT[ ComboAt(Link->X, Link->Y) ] == CT_CVDOWN ) {
                if ( !timer ) timer = speed;
                if ( timer > 1 ) timer--;
                if ( timer == 1 && CanWalk(Link->X, Link->Y, DIR_DOWN, step, false) ) {
                    Link->Y++;
                    timer = speed;
                }
            }
            else timer = speed;
            Waitframe();
        }
    }
}

This is a very simple way to do it, but it could produce some bugs with solid tiles at the end of conveyors depending on the value you give to D1 (step). The higher you set D0, the less the extra acceleration will be. I suggest a value around 15 to 40, to start out.


Edited by ZoriaRPG, 12 November 2016 - 04:31 AM.


#8 Sparkster

Sparkster

    The Sparking Spark of ZC

  • Members

Posted 12 November 2016 - 07:11 AM

I almost scrapped the idea until you came and gave me a FFC script and an unfinished header about conveyors. Thank you Zoria.

 

But... I think I did something really wrong...

Pass 1: Parsing
Pass 2: Preprocessing
Pass 3: Building symbol tables
Conveyor.zh, line 16: Error S09: Variable ComboT is undeclared.
Conveyor.zh, line 16: Error S09: Variable ComboT is undeclared.
Conveyor.zh, line 16: Error S09: Variable ComboT is undeclared.
Conveyor.zh, line 16: Error S09: Variable ComboT is undeclared.
Conveyor.zh, line 29: Error S09: Variable ComboT is undeclared.
Conveyor.zh, line 30: Error S09: Variable ComboT is undeclared.
Conveyor.zh, line 31: Error S09: Variable ComboT is undeclared.
Conveyor.zh, line 32: Error S09: Variable ComboT is undeclared.
Conveyor.zh, line 44: Error S09: Variable ComboT is undeclared.
Conveyor.zh, line 45: Error S09: Variable ComboT is undeclared.
Conveyor.zh, line 46: Error S09: Variable ComboT is undeclared.
Conveyor.zh, line 47: Error S09: Variable ComboT is undeclared.
Conveyor.zh, line 58: Error S09: Variable ComboT is undeclared.
Conveyor.zh, line 59: Error S09: Variable ComboT is undeclared.
Conveyor.zh, line 60: Error S09: Variable ComboT is undeclared.
Conveyor.zh, line 61: Error S09: Variable ComboT is undeclared.
Conveyor.zh, line 72: Error S09: Variable ComboT is undeclared.
Conveyor.zh, line 73: Error S09: Variable ComboT is undeclared.
Conveyor.zh, line 74: Error S09: Variable ComboT is undeclared.
Conveyor.zh, line 75: Error S09: Variable ComboT is undeclared.
Conveyor.zh, line 85: Error S09: Variable ComboT is undeclared.
Conveyor.zh, line 86: Error S09: Variable ComboT is undeclared.
Conveyor.zh, line 87: Error S09: Variable ComboT is undeclared.
Conveyor.zh, line 88: Error S09: Variable ComboT is undeclared.
Conveyor.zh, line 97: Error S09: Variable ComboT is undeclared.
Conveyor.zh, line 98: Error S09: Variable ComboT is undeclared.
Conveyor.zh, line 99: Error S09: Variable ComboT is undeclared.
Conveyor.zh, line 100: Error S09: Variable ComboT is undeclared.
Conveyor.zh, line 109: Error S09: Variable ComboT is undeclared.
Conveyor.zh, line 110: Error S09: Variable ComboT is undeclared.
Conveyor.zh, line 111: Error S09: Variable ComboT is undeclared.
Conveyor.zh, line 112: Error S09: Variable ComboT is undeclared.
Conveyor.zh, line 121: Error S09: Variable ComboT is undeclared.
Conveyor.zh, line 122: Error S09: Variable ComboT is undeclared.
Conveyor.zh, line 123: Error S09: Variable ComboT is undeclared.
Conveyor.zh, line 124: Error S09: Variable ComboT is undeclared.
Conveyor.zh, line 133: Error S09: Variable ComboT is undeclared.
Conveyor.zh, line 134: Error S09: Variable ComboT is undeclared.
Conveyor.zh, line 135: Error S09: Variable ComboT is undeclared.
Conveyor.zh, line 136: Error S09: Variable ComboT is undeclared.


#9 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 12 November 2016 - 07:32 AM

I almost scrapped the idea until you came and gave me a FFC script and an unfinished header about conveyors. Thank you Zoria.
 
But... I think I did something really wrong...

 
No, I did something wrongly...Writing this on the go, and all, I slipped.
ffc script FasterConveyors{
    void run(int speed, int step){
        int timer = speed;
        while(true){
            if ( Screen->ComboT[ ComboAt(Link->X, Link->Y) ] == CT_CVLEFT ) {
                if ( !timer ) timer = speed;
                if ( timer > 1 ) timer--;
                if ( timer == 1 && CanWalk(Link->X, Link->Y, DIR_LEFT, step, false) ) {
                    Link->X--;
                    timer = speed;
                }
            }
            else if ( Screen->ComboT[ ComboAt(Link->X, Link->Y) ] == CT_CVRIGHT ) {
                if ( !timer ) timer = speed;
                if ( timer > 1 ) timer--;
                if ( timer == 1 && CanWalk(Link->X, Link->Y, DIR_RIGHT, step, false) ) {
                    Link->X++;
                    timer = speed;
                }
            }
            else if ( Screen->ComboT[ ComboAt(Link->X, Link->Y) ] == CT_CVUP ) {
                if ( !timer ) timer = speed;
                if ( timer > 1 ) timer--;
                if ( timer == 1 && CanWalk(Link->X, Link->Y, DIR_UP, step, false)  ) {
                    Link->Y--;
                    timer = speed;
                }
            }
            else if ( Screen->ComboT[ ComboAt(Link->X, Link->Y) ] == CT_CVDOWN ) {
                if ( !timer ) timer = speed;
                if ( timer > 1 ) timer--;
                if ( timer == 1 && CanWalk(Link->X, Link->Y, DIR_DOWN, step, false) ) {
                    Link->Y++;
                    timer = speed;
                }
            }
            else timer = speed;
            Waitframe();
        }
    }
}
Try that.

Edited by ZoriaRPG, 12 November 2016 - 08:07 AM.


#10 Sparkster

Sparkster

    The Sparking Spark of ZC

  • Members

Posted 12 November 2016 - 07:57 AM

Pass 1: Parsing
Pass 2: Preprocessing
line 1: syntax error, unexpected LPAREN, expecting LBRACE, on token (
tmp, line 36: Error P01 : Failure to parse imported file FasterConveyors.z.

This happens



#11 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 12 November 2016 - 08:19 AM

Pass 1: Parsing
Pass 2: Preprocessing
line 1: syntax error, unexpected LPAREN, expecting LBRACE, on token (
tmp, line 36: Error P01 : Failure to parse imported file FasterConveyors.z.
This happens


I forgot to delete those parens in my local file; eh? I thought I had, but I must have only done it on the forum. They are a holdover from designing this as a global fubction.

Fixed above.

Here is that global version, as a patience bonus:



I figured that it would be easier for you to try it as an ffc, but global version is the way to go, if you like the way it works; if it works properly, at least.


P.S. Here is the entire mini-header for faster conveyors, as one file.

All I do ask, is that if it does work, you do the following:

Report to me what values you used for speed, and step.
Send a demo quest to me, so that I can submit it to the database without spending more time than I have---which sadly, if truly 'none', but I try to carve out some for script requests---in punching out a demo for it.

Edited by ZoriaRPG, 12 November 2016 - 08:30 AM.


#12 Sparkster

Sparkster

    The Sparking Spark of ZC

  • Members

Posted 12 November 2016 - 09:41 AM

Global Scripts are not good for me. I mean, I'm unable to combine global scripts even I've readen the tutorial about it many times. It just confuses me more and more. But the compiling was sucessful with some minor errors.

Pass 1: Parsing
Pass 2: Preprocessing
conveyor.zh, line 21: lexical error ''.

conveyor.zh, line 29: lexical error ''.

conveyor.zh, line 37: lexical error ''.

conveyor.zh, line 45: lexical error ''.

conveyor.zh, line 73: lexical error ''.

conveyor.zh, line 89: lexical error ''.

conveyor.zh, line 97: lexical error ''.

Pass 3: Building symbol tables
Pass 4: Type-checking/Completing function symbol tables/Constant folding
Pass 5: Generating object code
Pass 6: Assembling
Success!


#13 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 12 November 2016 - 10:01 AM

 

Global Scripts are not good for me. I mean, I'm unable to combine global scripts even I've readen the tutorial about it many times. It just confuses me more and more. But the compiling was sucessful with some minor errors.

Pass 1: Parsing
Pass 2: Preprocessing
conveyor.zh, line 21: lexical error ''.

conveyor.zh, line 29: lexical error ''.

conveyor.zh, line 37: lexical error ''.

conveyor.zh, line 45: lexical error ''.

conveyor.zh, line 73: lexical error ''.

conveyor.zh, line 89: lexical error ''.

conveyor.zh, line 97: lexical error ''.

Pass 3: Building symbol tables
Pass 4: Type-checking/Completing function symbol tables/Constant folding
Pass 5: Generating object code
Pass 6: Assembling
Success!

 

Please let me know if this still has the lexical errors. Whatever they are, they are invisible.

/////////////////////////////
/// Faster Conveyor Belts ///
/// v0.1                  ///
/// 12-Nov-2016           ///
/// By: ZoriaRPG          ///
/////////////////////////////////////////////////////////////////////////////////
/// Purpose: This allows creating conveyor belts that move *Link* faster than ///
/// the stock ZC conveyors.                                                   ///
///                                                                           ///
/// Future versions may support bombs, items, somaria blocks, and npcs.       ///
/// I have *no plans* to add, or support creating *slower* conveyors with     ///
/// this header.                                                              ///
/////////////////////////////////////////////////////////////////////////////////

//FFC Version

ffc script FasterConveyors{
    void run(int speed, int step){
        int timer = speed;
        while(true){
            if ( Screen->ComboT[ ComboAt(Link->X, Link->Y) ] == CT_CVLEFT ) {
                if ( !timer ) timer = speed;
                if ( timer > 1 ) timer--;
                if ( timer == 1 && CanWalk(Link->X, Link->Y, DIR_LEFT, step, false) ) {
                    Link->X--;
                    timer = speed;
                }
            }
            else if ( Screen->ComboT[ ComboAt(Link->X, Link->Y) ] == CT_CVRIGHT ) {
                if ( !timer ) timer = speed;
                if ( timer > 1 ) timer--;
                if ( timer == 1 && CanWalk(Link->X, Link->Y, DIR_RIGHT, step, false) ) {
                    Link->X++;
                    timer = speed;
                }
            }
            else if ( Screen->ComboT[ ComboAt(Link->X, Link->Y) ] == CT_CVUP ) {
                if ( !timer ) timer = speed;
                if ( timer > 1 ) timer--;
                if ( timer == 1 && CanWalk(Link->X, Link->Y, DIR_UP, step, false)  ) {
                    Link->Y--;
                    timer = speed;
                }
            }
            else if ( Screen->ComboT[ ComboAt(Link->X, Link->Y) ] == CT_CVDOWN ) {
                if ( !timer ) timer = speed;
                if ( timer > 1 ) timer--;
                if ( timer == 1 && CanWalk(Link->X, Link->Y, DIR_DOWN, step, false) ) {
                    Link->Y++;
                    timer = speed;
                }
            }
            else timer = speed;
            Waitframe();
        }
    }
}

//Global Version

int ____GRAM[214747];

const int CONVEYOR_TIMER = 10020; //Index of ____GRAM.
const int FAST_CONVEY_SPEED = 30;
const int FAST_CONVEY_STEP = 1;
const int CMB_FAST_CONVEY_RT = 1000; //Set to combo ID of Fast Conveyor (Right)
const int CMB_FAST_CONVEY_LF = 1000; //Set to combo ID of Fast Conveyor (Left)
const int CMB_FAST_CONVEY_UP = 1000; //Set to combo ID of Fast Conveyor (Up)
const int CMB_FAST_CONVEY_DN = 1000; //Set to combo ID of Fast Conveyor (Down)

//Call as FasterConveyors(FAST_CONVEY_SPEED, FAST_CONVEY_STEP, ____GRAM, CONVEYOR_TIMER);
void FasterConveyors(int speed, int step, int arr, int index){
    if ( Screen->ComboD[ ComboAt(Link->X, Link->Y) ] == CMB_FAST_CONVEY_LF ) {
        if ( !arr[index] ) arr[index] = speed;
        if ( arr[index] > 1 ) arr[index]--;
        if ( arr[index] == 1 && CanWalk(Link->X, Link->Y, DIR_LEFT, step, false) ) {
            Link->X--;
            arr[index] = speed;
        }
    }
    else if ( Screen->ComboD[ ComboAt(Link->X, Link->Y) ] == CMB_FAST_CONVEY_RT ) {
        if ( !arr[index] ) arr[index] = speed;
        if ( arr[index] > 1 ) arr[index]--;
        if ( arr[index] == 1 && CanWalk(Link->X, Link->Y, DIR_RIGHT, step, false) ) {
            Link->X++;
            arr[index] = speed;
        }
    }
    else if ( Screen->ComboD[ ComboAt(Link->X, Link->Y) ] == CMB_FAST_CONVEY_UP ) {
        if ( !arr[index] ) arr[index] = speed;
        if ( arr[index] > 1 ) arr[index]--;
        if ( arr[index] == 1 && CanWalk(Link->X, Link->Y, DIR_UP, step, false)  ) {
            Link->Y--;
            arr[index] = speed;
        }
    }
    else if ( Screen->ComboD[ ComboAt(Link->X, Link->Y) ] == CMB_FAST_CONVEY_DN ) {
        if ( !arr[index] ) arr[index] = speed;
        if ( arr[index] > 1 ) arr[index]--;
        if ( arr[index] == 1 && CanWalk(Link->X, Link->Y, DIR_DOWN, step, false) ) {
            Link->Y++;
            arr[index] = speed;
        }
    }
    else arr[index] = speed;
}

global script convey{
    void run(){
        while(true){
            FasterConveyors(FAST_CONVEY_SPEED, FAST_CONVEY_STEP, ____GRAM, CONVEYOR_TIMER);
            Waitdraw();
            Waitframe();
        }
    }
}

Other than those, does it work?

 

Implementing it as a global script means that once you assign the four combos that it uses, all you need ever do to add fast conveyors to a screen, is place the combos, rather than adding the ffc to every screen with them.


Edited by ZoriaRPG, 12 November 2016 - 10:10 AM.


#14 Sparkster

Sparkster

    The Sparking Spark of ZC

  • Members

Posted 12 November 2016 - 10:06 AM

Without the conveyor header and with the FFC version (Really don't want to destroy my global active script when combining very wrong) it successfully compiled. Let's make a demo quest with it.



#15 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 12 November 2016 - 10:27 AM

I found the invisible characters. Here's the cleaned output:

/////////////////////////////
/// Faster Conveyor Belts ///
/// v0.1.1                ///
/// 12-Nov-2016           ///
/// By: ZoriaRPG          ///
/////////////////////////////////////////////////////////////////////////////////
/// Purpose: This allows creating conveyor belts that move *Link* faster than ///
/// the stock ZC conveyors.                                                   ///
///                                                                           ///
/// Future versions may support bombs, items, somaria blocks, and npcs.       ///
/// I have *no plans* to add, or support creating *slower* conveyors with     ///
/// this header.                                                              ///
/////////////////////////////////////////////////////////////////////////////////

//FFC Version

ffc script FasterConveyors{
    void run(int speed, int step){
        int timer = speed;
        while(true){
            if ( Screen->ComboT[ ComboAt(Link->X, Link->Y) ] == CT_CVLEFT ) {
                if ( !timer ) timer = speed;
                if ( timer > 1 ) timer--;
                if ( timer == 1 && CanWalk(Link->X, Link->Y, DIR_LEFT, step, false) ) {
                    Link->X--;
                    timer = speed;
                }
            }
            else if ( Screen->ComboT[ ComboAt(Link->X, Link->Y) ] == CT_CVRIGHT ) {
                if ( !timer ) timer = speed;
                if ( timer > 1 ) timer--;
                if ( timer == 1 && CanWalk(Link->X, Link->Y, DIR_RIGHT, step, false) ) {
                    Link->X++;
                    timer = speed;
                }
            }
            else if ( Screen->ComboT[ ComboAt(Link->X, Link->Y) ] == CT_CVUP ) {
                if ( !timer ) timer = speed;
                if ( timer > 1 ) timer--;
                if ( timer == 1 && CanWalk(Link->X, Link->Y, DIR_UP, step, false)  ) {
                    Link->Y--;
                    timer = speed;
                }
            }
            else if ( Screen->ComboT[ ComboAt(Link->X, Link->Y) ] == CT_CVDOWN ) {
                if ( !timer ) timer = speed;
                if ( timer > 1 ) timer--;
                if ( timer == 1 && CanWalk(Link->X, Link->Y, DIR_DOWN, step, false) ) {
                    Link->Y++;
                    timer = speed;
                }
            }
            else timer = speed;
            Waitframe();
        }
    }
}

//Global Version

int ____GRAM[214747];

const int CONVEYOR_TIMER = 10020; //Index of ____GRAM.
const int FAST_CONVEY_SPEED = 30;
const int FAST_CONVEY_STEP = 1;
const int CMB_FAST_CONVEY_RT = 1000; //Set to combo ID of Fast Conveyor (Right)
const int CMB_FAST_CONVEY_LF = 1000; //Set to combo ID of Fast Conveyor (Left)
const int CMB_FAST_CONVEY_UP = 1000; //Set to combo ID of Fast Conveyor (Up)
const int CMB_FAST_CONVEY_DN = 1000; //Set to combo ID of Fast Conveyor (Down)

//Call as FasterConveyors(FAST_CONVEY_SPEED, FAST_CONVEY_STEP, ____GRAM, CONVEYOR_TIMER);
void FasterConveyors(int speed, int step, int arr, int index){
    if ( Screen->ComboD[ ComboAt(Link->X, Link->Y) ] == CMB_FAST_CONVEY_LF ) {
        if ( !arr[index] ) arr[index] = speed;
        if ( arr[index] > 1 ) arr[index]--;
        if ( arr[index] == 1 && CanWalk(Link->X, Link->Y, DIR_LEFT, step, false) ) {
            Link->X--;
            arr[index] = speed;
        }
    }
    else if ( Screen->ComboD[ ComboAt(Link->X, Link->Y) ] == CMB_FAST_CONVEY_RT ) {
        if ( !arr[index] ) arr[index] = speed;
        if ( arr[index] > 1 ) arr[index]--;
        if ( arr[index] == 1 && CanWalk(Link->X, Link->Y, DIR_RIGHT, step, false) ) {
            Link->X++;
            arr[index] = speed;
        }
    }
    else if ( Screen->ComboD[ ComboAt(Link->X, Link->Y) ] == CMB_FAST_CONVEY_UP ) {
        if ( !arr[index] ) arr[index] = speed;
        if ( arr[index] > 1 ) arr[index]--;
        if ( arr[index] == 1 && CanWalk(Link->X, Link->Y, DIR_UP, step, false)  ) {
            Link->Y--;
            arr[index] = speed;
        }
    }
    else if ( Screen->ComboD[ ComboAt(Link->X, Link->Y) ] == CMB_FAST_CONVEY_DN ) {
        if ( !arr[index] ) arr[index] = speed;
        if ( arr[index] > 1 ) arr[index]--;
        if ( arr[index] == 1 && CanWalk(Link->X, Link->Y, DIR_DOWN, step, false) ) {
            Link->Y++;
            arr[index] = speed;
        }
    }
    else arr[index] = speed;
}

global script convey{
    void run(){
        while(true){
            FasterConveyors(FAST_CONVEY_SPEED, FAST_CONVEY_STEP, ____GRAM, CONVEYOR_TIMER);
            Waitdraw();
            Waitframe();
        }
    }
}

Please inform me when you make a demo quest for this, or if you have any questions. On the topic of helping you integrate it globally: Sure, I'd do that for you. (It'd take me about 30 seconds.)

 

The global script set-up examples aren't always so great, as they aren't as plain and straightforward as they could be.


Edited by ZoriaRPG, 12 November 2016 - 12:48 PM.



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users