Surely there is a shorter way of doing this dam dialog... 172,380 Lines...
#1

Hey Fellow scripters :P
I ahh... am having troubles with a VERY large script that i think can and should be compressed or re-written in another way because this is bullsh*t...

Okay, in this list there is nearly every vehicle(Other than trains and what ever else isn't really RP to be driving around a city.) So... by a rough guess almost 80-90 Vehicles.

Case 100: (4 Lines a vehicle )
pawn Код:
case 100:
        {
            if(!response)
            {
                return 1;
            }
           
            switch(listitem)
            {
                case 0://Stretch
                {
                    ShowPlayerDialog(playerid, 101, DIALOG_STYLE_MSGBOX, "Vehicle Information", "Price:\n \n\nDescription:\n ","Continue","Back");
                }
                case 1://Cheetah
                {
                    ShowPlayerDialog(playerid, 102, DIALOG_STYLE_MSGBOX, "Vehicle Information", "Price:\n \n\nDescription:\n ","Continue","Back");
                }
                case 2://Admiral
                {
                    ShowPlayerDialog(playerid, 103, DIALOG_STYLE_MSGBOX, "Vehicle Information", "Price:\n $\n\nDescription:","Continue","Back");
                }
                case 3://Feltzer
                {
                    ShowPlayerDialog(playerid, 104, DIALOG_STYLE_MSGBOX, "Vehicle Information", "Price:\n $\n\nDescription:","Continue","Back");
                }
                case 4://Huntley
                {
                    ShowPlayerDialog(playerid, 105, DIALOG_STYLE_MSGBOX, "Vehicle Information", "Price:\n $\n\nDescription:","Continue","Back");
                }

Then each vehicle is separated into it's own 'case'
Case 101: (8 lines a vehicle)
pawn Код:
case 101://Stretch
        {
            if(!response)
            {
                ShowPlayerDialog(playerid, 100, DIALOG_STYLE_LIST, "Vehicle Catalogue", "Stretch\r\nCheetah\r\nAdmiral\r\nFeltzer\r\nHuntley\r\nBanshee\r\n...","Continue","Cancel");
            }
            if(response)
            {
                   new dialog[370];
                   strcat(dialog,"{000000}BLACK\r\n{FFFFFF}WHITE
                ShowPlayerDialog(playerid, 102, DIALOG_STYLE_LIST, "
Select a Primary vehicle colour", dialog, "Continue","Back");
            }
        }
Then we have the next case...
Okay there are 126 colours, well... that we are going to use...

Secondary Colour Selection....
Case 102: (126 Colours x 8 Lines = 1008)
pawn Код:
case 102://Stretch Secondary Colour Table
        {
            if(!response)
            {
                ShowPlayerDialog(playerid, 100, DIALOG_STYLE_LIST, "Vehicle Catalogue", "Stretch\r\nCheetah\r\nAdmiral\r\nFeltzer\r\nHuntley\r\nBanshee\r\n...,"Continue","Cancel");
            }
            switch(listitem)
            {
                case 0://BLACK
                {
                    new dialog[370];
                    strcat(dialog,"
{000000}BLACK\r\n{FFFFFF}WHITE");
                    ShowPlayerDialog(playerid, 103, DIALOG_STYLE_LIST, "
Select a Secondary Colour", dialog,"Continue","Back");
                }
                case 1://WHITE
                {
                    new dialog[370]
                    strcat(dialog,"
{000000}BLACK\r\n{FFFFFF}WHITE");
                    ShowPlayerDialog(playerid, 104, DIALOG_STYLE_LIST, "
Select a Secondary Colour", dialog, "Continue", "Back");
                }
Then we have our final case


Purchase Confirmation
Case 103:(8 lines each Colour, 126 colours, 8x126=1008)
pawn Код:
case 103://Vehicle Confirmation.
        {
            if(!response)
            {
                ShowPlayerDialog(playerid, 100, DIALOG_STYLE_LIST, "Vehicle Catalogue", "Stretch\r\nCheetah\r\nAdmiral\r\nFeltzer\r\nHuntley\r\nBanshee\r\n...","Continue","Cancel");
            }
            switch(listitem)
            {
                case 0://BLACK
                {
                    new dialog[370];
                    strcat(dialog,"rar rar rar \n");
                    ShowPlayerDialog(playerid,152,DIALOG_STYLE_MSGBOX,"Purchase Confirmation",dialog,"Sign", "Decline");
                }
                case 1://WHITE
                {
                    new dialog[370];
                    strcat(dialog,"Rar rar rar \n");
                    ShowPlayerDialog(playerid,153,DIALOG_STYLE_MSGBOX,"Purchase Confirmation",dialog,"Sign", "Decline");
                }
            }

So, to sum it all up...
4 Lines a Vehicle
8 Lines a Vehicle
8 Lines a Colour x 126 Colours = 1008
8 Lines a Colour x 126 Colours = 1008

4 + 8 + 1008 + 1008 = 2028 Lines
2028 Lines x 85 Vehicles = 172,380 Lines?
Daphuk?
Surely i calculated something wrong...
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)