Post Pacific

Post Pacific (https://postpacific.loc-online.com/index.php)
-   Темы без сохранившегося раздела (https://postpacific.loc-online.com/forumdisplay.php?f=10001)
-   -   [HELP PLOX] Compiling error (https://postpacific.loc-online.com/showthread.php?t=4052)

m4rk 15.04.2006 23:11

[HELP PLOX] Compiling error
 
I'm trying to do a teleporter that in exchange of an item gives you something back (it's mainly to make easier giving prices in events...)
However it gives me an error and just wont compile correctly

the nasc code:
Code:

class event_teleporter2 : teleporter
        {               
property:               
        TelPosList Position = {{1010006;15671;142994;-2704;8100}       
                ;{1010013;83011;53207;-1470;11000}
                ;{1010020;117088;76931;-2670;9400}};
       
        handler:
        EventHandler MENU_SELECTED(ask, reply, talker)
{
if(ask == 501 && reply == 501)
        {
        if(IsInCategory(@fighter_group, talker.occupation) && OwnItemCount(talker, @lottery_ticket) == 1)
                {
        if(talker.level < 20)
                                {
                                  DeleteItem1(talker, @lottery_ticket, 1);
                                        IncrementParam(talker, @PARAM_EXP, 55000);
                                        GiveItem1(talker, @adena, 80000);
                                        GiveItem1(talker, @soulshot_none, 400);
                                        GiveItem1(talker, @scroll_of_escape, 5);
                                        SoundEffect(talker, "ItemSound.quest_itemget");
                                }
else if(talker.level >=20 && talker.level < 30)
        {
                                        DeleteItem1(talker, @lottery_ticket, 1));
                                        IncrementParam(talker, @PARAM_EXP, 200000);
                                        GiveItem1(talker, @adena, 120000);
                                        GiveItem1(talker, @soulshot_d, 600);
                                        GiveItem1(talker, @scroll_of_escape, 5);
                                        SoundEffect(talker, "ItemSound.quest_itemget");
        }
        }
        }
super;
}

the compiled ai (cutted because of wrong syntax)
"ERROR(120425) : syntax error"
line 120425 = else if(talker.level >=20 && talker.level < 30)
Code:

class event_teleporter2 : teleporter
property_define_begin
        telposlist_begin Position
                {"The Town of Dion"; 15671; 142994; -2704; 8100 }
                {"Oren Castle Town"; 83011; 53207; -1470; 11000 }
                {"Hunter Village"; 117088; 76931; -2670; 9400 }
        telposlist_end
property_define_end
handler 30        //  MENU_SELECTED
        variable_begin
                "ask"
                "reply"
                "talker"
                "myself"
                "_choiceN"
                "_code"
                "_from_choice"
        variable_end

        push_event        //  ask
        push_const 96
        add
        fetch_i
        push_const 501
        equal
        push_reg_sp
        fetch_i
        branch_false L26609
        push_event        //  reply
        push_const 100
        add
        fetch_i
        push_const 501
        equal
        and
L26609
        branch_false L26611
L26610
        shift_sp 1
        push_const 0
        push_event        //  talker
        push_const 32
        add
        fetch_i        //  occupation
        push_const 160
        add
        fetch_i
        func_call 112        //  func[IsInCategory]
        shift_sp -2
        push_reg_sp
        fetch_i
        branch_false L26612
        shift_sp 1
        push_event        //  talker
        push_const 32
        add
        fetch_i
        push_const 4442
        func_call 59        //  func[OwnItemCount]
        shift_sp -2
        push_const 1
        equal
        and
L26612
        branch_false L26614
L26613
        push_event        //  talker
        push_const 32
        add
        fetch_i        //  level
        push_const 776
        add
        fetch_i
        push_const 20
        less
        branch_false L26616
L26615
        shift_sp 1
        push_event        //  talker
        push_const 32
        add
        fetch_i
        push_const 4442
        push_const 1
        func_call 58        //  func[DeleteItem1]
        shift_sp -3
        shift_sp -1
        shift_sp 1
        push_event        //  talker
        push_const 32
        add
        fetch_i
        push_const 0
        push_const 55000
        func_call 137        //  func[IncrementParam]
        shift_sp -3
        shift_sp -1
        shift_sp 1
        push_event        //  talker
        push_const 32
        add
        fetch_i
        push_const 57
        push_const 80000
        func_call 55        //  func[GiveItem1]
        shift_sp -3
        shift_sp -1
        shift_sp 1
        push_event        //  talker
        push_const 32
        add
        fetch_i
        push_const 1835
        push_const 400
        func_call 55        //  func[GiveItem1]
        shift_sp -3
        shift_sp -1
        shift_sp 1
        push_event        //  talker
        push_const 32
        add
        fetch_i
        push_const 736
        push_const 5
        func_call 55        //  func[GiveItem1]
        shift_sp -3
        shift_sp -1
        shift_sp 1
        push_event        //  talker
        push_const 32
        add
        fetch_i
S6995.        "ItemSound.quest_itemget"
        push_string S6995
        func_call 139        //  func[SoundEffect]
        shift_sp -2
        shift_sp -1
        jump L26617
L26616
        push_event        //  talker
        push_const 32
        add
        fetch_i        //  level
        push_const 776
        add
        fetch_i
        push_const 20
        greater_equal
        push_reg_sp
        fetch_i
        branch_false L26618
        push_event        //  talker
        push_const 32
        add
        fetch_i        //  level
        push_const 776
        add
        fetch_i
        push_const 30
        less
        and
L26618
        branch_false L26620
L26619
        shift_sp 1
        push_event        //  talker
        push_const 32
        add
        fetch_i
        push_const 4442
        push_const 1
        func_call 58        //  func[DeleteItem1]
        shift_sp -3


kvoxi 16.04.2006 02:41

try this syntax
if (expr) {...}
else {...}

Megatronpt 16.04.2006 02:47

Kvoxi, I'm trying to help him in finding the bug... and now I get this error, using your compiler

Code:

ERROR(2) : undefined super class[teleporter] at class [event_teleporter2] definition
Fail to compile, total error count = 1

Any ideas?

This is my first time experimenting NASC.

Eanae 16.04.2006 03:20

Quote:

Originally Posted by Megatronpt
Kvoxi, I'm trying to help him in finding the bug... and now I get this error, using your compiler

Code:

ERROR(2) : undefined super class[teleporter] at class [event_teleporter2] definition
Fail to compile, total error count = 1

Any ideas?

This is my first time experimenting NASC.

that error is fine as long as event_teleporter2 will be in your compiled AI.

edit:

Code:

else if(talker.level) >=20 && (talker.level) < 30
Isn't that how it should go?

Megatronpt 16.04.2006 03:22

Thx Eanae,

Got it compiled!

Now.. I have to speak with m4rk! ;)

hr 16.04.2006 07:32

Quote:

DeleteItem1(talker, @lottery_ticket, 1));
-AND-

Quote:

super;
}
} //closing bracket for class
open your eyes

Megatronpt 16.04.2006 11:16

2 late hr, but thanks.

I got it corrected, last night.


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