Game stürzt ab wegen Script

  • GM 8
  • Game stürzt ab wegen Script

    Hallo

    Ich habe da mal selber ein Script ins Programm "gehustet" und nun stürzt es dauern an der Stelle ab, wo das Script laufen müsste.

    GML-Quellcode

    1. // ARGUMENTS
    2. // argument0 = FILENAME (MIT PFAD)
    3. var error,file,inhalt;
    4. error = false;
    5. file = file_text_open_read(argument0);
    6. while (!file_text_eof(file))
    7. {
    8. inhalt = file_text_read_string(file);
    9. if (string_char_at(inhalt,0) == "s" and string_char_at(inhalt,3) == "_" and string_char_at(inhalt,7) == "(")
    10. {
    11. file_text_readln(file);
    12. }
    13. else
    14. {
    15. error = true;
    16. break;
    17. }
    18. }
    19. if (error == false)
    20. {
    21. execute_file(argument0);
    22. }
    23. else
    24. {
    25. wd_message_set_text("Error while check");
    26. wd_message_show(wd_mk_error,wd_mb_none,wd_mb_ok,wd_mb_none);
    27. game_end();
    28. }
    Alles anzeigen


    Das Skript soll eine Datei prüfen, und falls Sie stimmt, ausführen.
    In der Datei steht zum Beispiel;

    Datei schrieb:

    set_lan("settings",0,"Aktuell Online:");
    set_lan("settings",1,"EIGENER NAME:");


    Deshalb gibt es auch noch das Skript "set_lan()";

    GML-Quellcode

    1. // ARGUMENTS
    2. // argument0 = ARRAY-NAME
    3. // argument1 = KEY-NUMMER
    4. // argument2 = TEXT/VALUE
    5. var name,key,value;
    6. name = argument0;
    7. key = argument1;
    8. value = argument2;
    9. variable_global_array_set(name,key,value);
    Alles anzeigen


    Wenn ich den Teil auskommentiere, in dem das erste Skript aufgreufen wird, funktioniert alles bestens. Es könnte aber natürlich auch an set_lang() liegen, da dieses ohne das erste Skript gar nicht ausgeführt wird. Wobei ich das nicht denke... :whistling:


    Danke für eure Hilfe!

    Mfg
    jlsnews
    :thumbsup:

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von jlsnews ()

  • Okay, ich habe die Skripte nun etwas geändert, bzw. das Skript. Es gibt jetzt nur noch das erste;

    GML-Quellcode

    1. // ARGUMENTS
    2. // argument0 = FILENAME (MIT PFAD)
    3. var error,file,inhalt,str;
    4. error = false;
    5. file = file_text_open_read(argument0);
    6. while (!file_text_eof(file))
    7. {
    8. inhalt = file_text_read_string(file);
    9. if (string_char_at(inhalt,0) == "s" and string_char_at(inhalt,3) == "_" and string_char_at(inhalt,7) == "(")
    10. {
    11. str = string_replace_all(inhalt,"set_lan","variable_global_array_set");
    12. execute_string(str);
    13. file_text_readln(file);
    14. }
    15. else
    16. {
    17. error = true;
    18. break;
    19. }
    20. }
    21. if (error == true)
    22. {
    23. wd_message_set_text("Error while check");
    24. wd_message_show(wd_mk_error,wd_mb_none,wd_mb_ok,wd_mb_none);
    25. game_end();
    26. }
    Alles anzeigen


    Allerdings kommt immer "Error while check" und danach ein Fehler der Systray DLL "SST".

    Fehler von SST:
    Spoiler anzeigen

    ___________________________________________
    ERROR in
    action number 1
    of Other Event: Room Start
    for object setup:

    In script SST_SetHandles:
    Error in code at line 18:
    /*Shaltif's System Tray--Your solution to Game Maker system tray support--Brandon Rohrer © 2005-2006=================================================argument0 = REAL - The local window handle===return = REAL - The parent window handle===//Com: This should be used after creating the SST. Many of the functions require the local and parent window handles. All you need to pass is the current local handle (use window_handle()). The parent is automatically pulled from this and returned. You can use the parent handle in functions like SST_ShowWindow().*/return external_call(sst.SetHandles,argument0);
    ^
    at position 26: Unknown variable SetHandles

    Spoiler anzeigen

    ___________________________________________
    ERROR in
    action number 1
    of Other Event: Room Start
    for object setup:

    In script SST_SetHandles:
    Error in code at line 18:
    /*Shaltif's System Tray--Your solution to Game Maker system tray support--Brandon Rohrer © 2005-2006=================================================argument0 = REAL - The local window handle===return = REAL - The parent window handle===//Com: This should be used after creating the SST. Many of the functions require the local and parent window handles. All you need to pass is the current local handle (use window_handle()). The parent is automatically pulled from this and returned. You can use the parent handle in functions like SST_ShowWindow().*/return external_call(sst.SetHandles,argument0);
    ^
    at position 26: Unknown variable SetHandles

    ___________________________________________
    ERROR in
    action number 1
    of Destroy Event
    for object sst:

    In script SST_Internal:
    Error in code at line 96:
    /*Shaltif's System Tray--Your solution to Game Maker system tray support--Brandon Rohrer © 2005-2006=================================================//Com: This should NOT be called by the user. This is for internal use only.*/switch (argument0) { case 0: dll = argument1; //SST_Notify() NIM_ADD = 0; NIM_MODIFY = 1; NIM_DELETE = 2; //SST_GetInput() WM_MOUSEMOVE = 512; /*Mouse over*/ WM_LBUTTONDOWN = 513; WM_LBUTTONUP = 514; WM_LBUTTONDBLCLK = 515; WM_RBUTTONDOWN = 516; WM_RBUTTONUP = 517; WM_RBUTTONDBLCLK = 518; WM_MBUTTONDOWN = 519; WM_MBUTTONUP = 520; WM_MBUTTONDBLCLK = 521; //SST_ShowWindow() SW_HIDE = 0; SW_SHOWNORMAL = 1; SW_SHOWMINIMIZED = 2; SW_SHOWMAXIMIZED = 3; SW_SHOWNOACTIVE = 4; SW_SHOW = 5; SW_MINIMIZE = 6; SW_SHOWMINNOACTIVE = 7; SW_SHOWNA = 8; SW_RESTORE = 9; SW_SHOWDEFAULT = 10; SW_FORCEMINIMIZE = 11; //SST_SetWindowPos() HWND_TOPMOST = -3; HWND_NOTTOPMOST = -2; HWND_TOP = 0; HWND_BOTTOM = 1; SWP_NOSIZE = 1; SWP_NOMOVE = 2; SWP_NOZORDER = 4; SWP_NOREDRAW = 8; SWP_NOACTIVATE = 16; /*SWP_DRAWFRAME = 32;*/ SWP_SHOWWINDOW = 64; SWP_HIDEWINDOW = 128; /*SWP_NOCOPYBITS = 256;*/ SWP_NOREPOSITION = 512; //SST_MessageBox() MB_OK = 0; MB_OKCANCEL = 1; MB_ABORTRETRYIGNORE = 2; MB_YESNOCANCEL = 3; MB_YESNO = 4; MB_RETRYCANCEL = 5; MB_ICONERROR = 16; MB_ICONQUESTION = 32; MB_ICONEXCLAMATION = 48; MB_ICONINFORMATION = 64; IDOK = 1; IDCANCEL = 2; IDABORT = 3; IDRETRY = 4; IDIGNORE = 5; IDYES = 6; IDNO = 7; SetHandles = external_define(dll,"SST_SetHandles",dll_cdecl,ty_real,1,ty_real); LoadIcon = external_define(dll,"SST_LoadIcon",dll_cdecl,ty_real,1,ty_string); SetToolTip = external_define(dll,"SST_SetToolTip",dll_cdecl,ty_real,1,ty_string); Notify = external_define(dll,"SST_Notify",dll_cdecl,ty_real,1,ty_real); GetInput = external_define(dll,"SST_GetInput",dll_cdecl,ty_real,0); IsIconic = external_define(dll,"SST_IsIconic",dll_cdecl,ty_real,0); SetForegroundWindow = external_define(dll,"SST_SetForegroundWindow",dll_cdecl,ty_real,1,ty_real); ShowWindow = external_define(dll,"SST_ShowWindow",dll_cdecl,ty_real,2,ty_real,ty_real); SetWindowPos = external_define(dll,"SST_SetWindowPos",dll_cdecl,ty_real,7,ty_real,ty_real,ty_real,ty_real,ty_real,ty_real,ty_real); SetWindowText = external_define(dll,"SST_SetWindowText",dll_cdecl,ty_real,2,ty_real,ty_string); MessageBox = external_define(dll,"SST_MessageBox",dll_cdecl,ty_real,3,ty_string,ty_string,ty_real); WindowProcedure = external_define(dll,"SST_WindowProcedure",dll_cdecl,ty_real,1,ty_real); GetTrayStatus = external_define(dll,"SST_GetTrayStatus",dll_cdecl,ty_real,0); break; case 1: if (external_call(GetTrayStatus)) { external_call(Notify,NIM_DELETE); }; external_call(WindowProcedure,0); external_free(dll); break;};
    ^
    at position 31: Unknown variable GetTrayStatus
    :thumbsup:
  • gib mal den string aus. vllt. Liest file_text_read_string nur bis zur (.
    Bin gerade mobil online also hab ich mir den script nicht ganz angeguckt.. Ich guck ihn mir dann an.

    mfG Rodrog
    Je mehr Käse, desto mehr Löcher.
    Je mehr Löcher, desto weniger Käse.
    Ergo: Je mehr Käse, desto weniger Käse.
  • Mal etwas was nicht in der Hilfe steht xD

    Bin mobil, versuche es später...


    EDIT:

    Der String wird richtig gelesen, es lag daran, dass der String bei 1 und nicht bei 0 beginnt.

    Danke @all!
    :thumbsup:

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von jlsnews ()