Post Pacific

Post Pacific (https://postpacific.loc-online.com/index.php)
-   Темы без сохранившегося раздела (https://postpacific.loc-online.com/forumdisplay.php?f=10001)
-   -   [Help request] [AI] Beverages Seller (https://postpacific.loc-online.com/showthread.php?t=6437)

m4rk 16.12.2006 18:18

[Help request] [AI] Beverages Seller
 
Well I'm currently designing a seller that drops items into the ground. Anyway the problem is this AI doesn't seem to be valid. L2NPC reports ' failed to load AI. Reset AI [line: the line class 1 tabernero : citizen]

EDIT: just notice the first { doesn't close.

EDIT: I just messed up... Correcting, then I'll share.

m4rk 16.12.2006 20:29

Ok Just verified my code and i don't find the error/s But L2NPC is not willing to take this AI.

Code:

class 1 tabernero : citizen
parameter_define_begin
        string fnHi "tabernero.htm"
        String fnNotEnoughAdena "tabernero2.htm"
        string fnYouAreChaotic "tabernero3.htm"
        int itempago 57
        int Cantidad 1000
parameter_define_end

handler 13 25        //  CREATED
        variable_begin
                "myself"
                "_choiceN"
                "_code"
                "_from_choice"
        variable_end

        shift_sp -1
        push_event        //  myself
        push_const 704
        add
        fetch_i
        push_event        //  myself
        push_const 704
        add
        fetch_i
        push_const 61653
S3273.        ""
        push_string S3273
S3274.        ""
        push_string S3274
S3275.        ""
        push_string S3275
S3276.        ""
        push_string S3276
S3277.        ""
        push_string S3277
        func_call 184942731        //  func[MakeFString]
        shift_sp -6
        func_call 184614978        //  func[Shout]
        shift_sp -1
        shift_sp -1
handler_end

handler 3 38        //  TALKED
        variable_begin
                "talker"
                "myself"
                "_choiceN"
                "_code"
                "_from_choice"
        variable_end

        push_event        //  talker
        push_const 40
        add
        fetch_i        //  karma
        push_const 468
        add
        fetch_i4
        push_const 0
        greater
        branch_false L2
L1
        push_event        //  myself
        push_const 704
        add
        fetch_i
        push_event        //  talker
        push_const 40
        add
        fetch_i
        push_parameter fnYouAreChaotic
        func_call 184680516        //  func[ShowPage]
        shift_sp -2
        shift_sp -1
        jump L3
L2
        push_event        //  myself
        push_const 704
        add
        fetch_i
        push_event        //  talker
        push_const 40
        add
        fetch_i
        push_parameter fnHi
        func_call 184680516        //  func[ShowPage]
        shift_sp -2
        shift_sp -1
L3
handler_end


handler 32 298        //  MENU_SELECTED
        variable_begin
                "talker"
                "ask"
                "reply"
                "fhtml0"
                "myself"
                "_choiceN"
                "_code"
                "_from_choice"
        variable_end
       
        push_event        //  ask
        push_const 160
        add
        fetch_i4
        push_const 201
        negate
        equal
        push_event        //  myself
        push_const 704
        add
        fetch_i
        push_event        //  talker
        push_const 40
        add
        fetch_i
        push_parameter itempago
        func_call 184680579        //  func[OwnItemCount]
        shift_sp -2
        push_parameter Cantidad
        greater_equal
        add
L4
        branch_false L5
L6       
        push_event        //  reply
        push_const 164
        add
        fetch_i4
        push_reg_sp
        fetch_i
        push_const 1
        equal
        branch_false L8
L7
        push_event        //  myself
        push_const 704
        add
        fetch_i
        push_event        //  talker
        push_const 40
        add
        fetch_i
        push_parameter itempago
        push_parameter Cantidad
        func_call 184746114        //  func[DeleteItem1]
        shift_sp -3
        shift_sp -1
        push_event        //  myself
        push_const 704
        add
        fetch_i
        push_event        //  myself
        push_const 704
        add
        fetch_i        //  sm
        push_const 544
        add
        fetch_i
        push_const 9018
        push_const 1
        push_event        //  myself
        push_const 704
        add
        fetch_i        //  sm
        push_const 544
        add
        fetch_i        //  summoner_id
        push_const 1920
        add
        fetch_i4
        func_call 184811649        //  func[DropItem2]
        shift_sp -4
        shift_sp -1
        shift_sp -1
        push_event        //  myself
        push_const 704
        add
        fetch_i
        push_event        //  myself
        push_const 704
        add
        fetch_i
        push_const 61654
S3273.        ""
        push_string S3273
S3274.        ""
        push_string S3274
S3275.        ""
        push_string S3275
S3276.        ""
        push_string S3276
S3277.        ""
        push_string S3277
        func_call 184942731        //  func[MakeFString]
        shift_sp -6
        func_call 184614973        //  func[Say]
        shift_sp -1
        shift_sp -1
        and
        jump L12
L8
        push_event        //  reply
        push_const 164
        add
        fetch_i4
        push_reg_sp
        fetch_i
        push_const 2
        equal
        branch_false L10
L9
        push_event        //  myself
        push_const 704
        add
        fetch_i/  talker
        push_const 40
        add
        fetch_i
        push_parameter itempago
        push_parameter Cantidad
        func_call 184746114        //  func[DeleteItem1]
        shift_sp -3
        shift_sp -1
        push_event        //  myself
        push_const 704
        add
        fetch_i
        push_event        //  myself
        push_const 704
        add
        fetch_i        //  sm
        push_const 544
        add
        fetch_i
        push_const 9019
        push_const 1
        push_event        //  myself
        push_const 704
        add
        fetch_i        //  sm
        push_const 544
        add
        fetch_i        //  summoner_id
        push_const 1920
        add
        fetch_i4
        func_call 184811649        //  func[DropItem2]
        shift_sp -4
        shift_sp -1
        shift_sp -1
        push_event        //  myself
        push_const 704
        add
        fetch_i
        push_event        //  myself
        push_const 704
        add
        fetch_i
        push_const 61655
S3273.        ""
        push_string S3273
S3274.        ""
        push_string S3274
S3275.        ""
        push_string S3275
S3276.        ""
        push_string S3276
S3277.        ""
        push_string S3277
        func_call 184942731        //  func[MakeFString]
        shift_sp -6
func_call 184614973        //  func[Say]
        shift_sp -1
        shift_sp -1
        and
        jump L12
L10
        push_event        //  reply
        push_const 164
        add
        fetch_i4
        push_reg_sp
        fetch_i
        push_const 3
        equal
        branch_false L13
L11
        push_event        //  myself
        push_const 704
        add
        fetch_i
        push_event        //  talker
        push_const 40
        add
        fetch_i
        push_parameter itempago
        push_parameter Cantidad
        func_call 184746114        //  func[DeleteItem1]
        shift_sp -3
        shift_sp -1
        push_event        //  myself
        push_const 704
        add
        fetch_i
        push_event        //  myself
        push_const 704
        add
        fetch_i        //  sm
        push_const 544
        add
        fetch_i
        push_const 9020
        push_const 1
        push_event        //  myself
        push_const 704
        add
        fetch_i        //  sm
        push_const 544
        add
        fetch_i        //  summoner_id
        push_const 1920
        add
        fetch_i4
        func_call 184811649        //  func[DropItem2]
        shift_sp -4
        shift_sp -1
        shift_sp -1
        push_event        //  myself
        push_const 704
        add
        fetch_i
        push_event        //  myself
        push_const 704
        add
        fetch_i
        push_const 61656
S3273.        ""
        push_string S3273
S3274.        ""
        push_string S3274
S3275.        ""
        push_string S3275
S3276.        ""
        push_string S3276
S3277.        ""
        push_string S3277
        func_call 184942731        //  func[MakeFString]
        shift_sp -6
        func_call 184614973        //  func[Say]
        shift_sp -1
        shift_sp -1
        and
        jump L13
L5
        shift_sp 1
        push_event        //  myself
        push_const 704
        add
        fetch_i
        push_event        //  talker
        push_const 40
        add
        fetch_i
        push_parameter fnNotEnoughAdena
        func_call 184680516        //  func[ShowPage]
        shift_sp -2
        shift_sp -1
        shift_sp -1
        push_event        //  myself
        push_const 704
        add
        fetch_i
        push_event        //  myself
        push_const 704
        add
        fetch_i
        push_const 61657
S3273.        ""
        push_string S3273
S3274.        ""
        push_string S3274
S3275.        ""
        push_string S3275
S3276.        ""
        push_string S3276
S3277.        ""
        push_string S3277
        func_call 184942731        //  func[MakeFString]
        shift_sp -6
        func_call 184614973        //  func[Say]
        shift_sp -1
        shift_sp -1
        and
        jump L14
L12
L13
L14
handler_end

class_end

Thanks to sauron for his great decompiler:
Code:

/***************************************************************************
*                                Change Log
*                            ------------------
*  xx.xx.2006
*  Script Decompiled by SauDecompiler build 102306.2
*
***************************************************************************/

class tabernero : citizen
{
parameter:
        string        fnHi = "tabernero.htm";
        string        fnYouAreChaotic = "tabernero3.htm";
        int        itempago = 57;
        int        Cantidad = 1000;

handler:
        EventHandler CREATED()
        {
                myself->Shout(myself->MakeFString(61653,"","","","",""));
        }

        EventHandler TALKED(talker)
        {
                if( talker.karma > 0 )
                {
                        myself->ShowPage(talker,fnYouAreChaotic);
                }
                else
                {
                        myself->ShowPage(talker,fnHi);
                }
        }

        EventHandler MENU_SELECTED(talker,ask,reply,fhtml0)
        {
                if( ( ask == -201 + myself->OwnItemCount(talker,itempago) >= Cantidad ) )
                {
                        if( reply == 1 )
                        {
                                myself->DeleteItem1(talker,itempago,Cantidad);
                                myself->DropItem2(myself.sm,9018,1,myself.sm.);
                                myself->Say(myself->MakeFString(61654,"","","","",""));
                        }
                        else if( reply == 2 )
                        {
                                ->DeleteItem1(myself + 40,itempago,Cantidad);
                                myself->DropItem2(myself.sm,9019,1,myself.sm.);
                                myself->Say(myself->MakeFString(61655,"","","","",""));
                        }
                        else if( reply == 3 )
                        {
                                myself->DeleteItem1(talker,itempago,Cantidad);
                                myself->DropItem2(myself.sm,9020,1,myself.sm.);
                                myself->Say(myself->MakeFString(61656,"","","","",""));
                        }
                        else
                        {
                                myself->ShowPage(talker,fnNotEnoughAdena);
                                myself->Say(myself->MakeFString(61657,"","","","",""));
                        }
                }

}

As you see in the 'nasc' code the first { is not closed in the end...


All times are GMT. The time now is 15:26.