Portal-Zone Gothic-Zone Gothic II-Zone Gothic 3-Zone Gothic 4-Zone Modifikationen-Zone Download-Zone Foren-Zone RPG-Zone Almanach-Zone Spirit of Gothic

 

Seite 3 von 31 « Erste 12345671014 ... Letzte »
Ergebnis 41 bis 60 von 606
  1. Beiträge anzeigen #41 Zitieren
    Dea
    Registriert seit
    Jul 2007
    Beiträge
    10.446
     
    Lehona ist offline
    Mein Codebeispiel war minimal, es ist also nicht unbedingt deine Schuld, dass du es falsch verwendet hast

    Code:
    var string s; s = "A";
    var int ptr; ptr = _@s(s);
    var string s2; s2 = MEM_ReadString(ptr);
    Print(s2);
    Dieses Beispiel sollte "A" ausgeben.

  2. Beiträge anzeigen #42 Zitieren
    General Avatar von Rantragon
    Registriert seit
    May 2008
    Beiträge
    3.903
     
    Rantragon ist offline
    Ich meine einen Fehler in den String-Funktionen entdeckt zu haben. Folgende Situation:

    Ich möchte prüfen, ob ein String in einem anderen enthalten ist. STR_IndexOf(string, string) bietet sich an. Da mir die Groß- und Kleinschreibung egal ist wende ich auf jeden Parameter STR_Upper an.

    Code:
    var int k;
    k = STR_IndexOf(STR_Upper("wog"), STR_Upper("o"));
    Der erwartete Rückgabewert: 1
    Der erfolgte Rückgabewert: 0

    Es wird immer 0 zurückgegeben, auch, wenn man "g" statt "o" nimmt.

    Folgendes jedoch funktioniert:

    Code:
    var string s; s = "wog";
    s = STR_Upper(s);
    var int k; k = STR_IndexOf(s, STR_Upper("o"));
    Es scheint also etwas mit dem unmittelbarem, zweimaligem Aufruf von STR_Upper etwas zu tun zu haben.

    Ist nicht weiter schlimm, dass das passiert, man kann es ja bequem anders machen, ist mir halt nur aufgestoßen und ich dachte es interessiert vielleicht jemanden

  3. Beiträge anzeigen #43 Zitieren
    Dea
    Registriert seit
    Jul 2007
    Beiträge
    10.446
     
    Lehona ist offline
    Das ist ein bekanntes Problem, das nicht von Ikarus sondern von Gothic selber stammt. Als Rückgabewerte werden nur Referenzen (Adressen) gepusht, keine konkreten Werte. Diese Referenzen werden dann beim zweiten Aufruf überschrieben. Einfaches Beispiel

    Code:
    Print(ConcatStrings(IntToString(1), IntToString(2)));
    gibt "22" aus und nicht, wie zu erwarten wäre, "12".

    Bei Integern hast du eigentlich das selbe Problem:

    Code:
    func int foo(var int x) { 
        return x;
    };
    
    ...
    
    Print(IntToString(foo(1)+foo(15))); // Ausgabe: "30" und nicht "16
    Allerdings kann das verhindert werden, in dem man die Rückgabewerte noch in der Funktion dereferenziert:

    Code:
    func int foo(var int x) {
        return +x;
    };
    Mit dieser Definition hätte man das Problem nicht.
    Leider kann man Strings nicht so einfach dereferenzieren, deswegen zeigen String-Funktionen dieses Verhalten meistens (Ein Workaround ist denkbar, aber ist in Ikarus nur in einigen Funktionen zu finden (MEM_PushString() glaube ich).

  4. Beiträge anzeigen #44 Zitieren
    General Avatar von Rantragon
    Registriert seit
    May 2008
    Beiträge
    3.903
     
    Rantragon ist offline
    Okay, wieder was gelernt.

    Danke!

  5. Beiträge anzeigen #45 Zitieren
    Local Hero
    Registriert seit
    Feb 2013
    Beiträge
    236
     
    pawbuj ist offline

    focus color for the mobs beling locked

    hi, I hava review all posts regarding ikarus forsearching answer how to change focus color of chests being locked and I could not find solution. As it see I tried a few combinations.

    here is script for Gothic !, but it seems to not working properly.
    Code:
    func void FocusColor() { 
    
        var oCNpc her; 
          her = Hlp_GetNpc (hero);       
        //var oCMobLockable Zamek; 
        //Zamek = MEM_PtrToInst (her.focus_vob);  
        var int col; 
        const int zCView_SetFontColor_offset = 7339392;    //6FFD80 thiscall(zCColor) 
     
    if (Hlp_Is_oCNpc(her.focus_vob)){ //jeśli patrzysz na skrzynię
        //var oCMobContainer Chest;
        var oCMobLockable Chest; 
        Chest = MEM_PtrToInst(her.focus_vob);
        if (Chest.bitfield & oCMobLockable_bitfield_locked)  
        //(Chest._oCMobLockable_bitfield == true) //if chest is locked
        {
            col = RGBAToZColor(0,0,255,255);  // blue color will appear
            }
            else
            {
            col = RGBAToZColor(255,255,255,255);//neutral if this is no chest 
             };  
        var int ptr;ptr = MEM_Alloc(4); 
        MEM_WriteInt(ptr, col); 
        CALL_IntParam(ptr); 
        CALL__thiscall(MEM_ReadInt(screen_offset), zCView_SetFontColor_offset); 
        MEM_Free(ptr); 
     };
     };

  6. Beiträge anzeigen #46 Zitieren
    Held Avatar von mainclain
    Registriert seit
    Sep 2005
    Beiträge
    5.426
     
    mainclain ist offline
    Ich hab bisher immer VirtualKeys und die dazugehörigen WinAPI funktion genutzt für die Tastenabfrage und würde das gerne auf die Gothic Funktion umstellen.

    Bietet Gothic eine Funktion an, um die DIK_Keys in den dazugehörigen char, bzw string umzuwandeln?

  7. Beiträge anzeigen #47 Zitieren
    Local Hero
    Registriert seit
    Feb 2013
    Beiträge
    236
     
    pawbuj ist offline

    chest or door being locked or no

    Hi, again me. I review your example (beispiel) skript for gothic1 and I still do not work on my ikarius.

    It seems the print the same text "Folgendes Vob geöffnet: " on each kind of mob (bed, chest, cl;audron. etc.) what is wrong?
    HTML-Code:
    func void OpenFocussedChestOrDoor() { var oCNpc her;
    her = Hlp_GetNpc (hero);
    
    //Gar kein Fokusvob?
    if (!her.focus_vob) {
    Print ("Kein Fokus!");
    return;
    };
    
    //Fokusvob kein verschließbares Vob?
    if (!Hlp_Is_oCMobLockable(her.focus_vob)) {
    Print ("Keine Truhe oder Tür im Fokus!");
    return;
    };
    
    var oCMobLockable Lockable;
    Lockable = MEM_PtrToInst (her.focus_vob);
    
    if (Lockable.bitfield & oCMobLockable_bitfield_locked)
    {
    Lockable.bitfield = Lockable.bitfield & ~
    oCMobLockable_bitfield_locked;
    
    Print (ConcatStrings (
    "Folgendes Vob geöffnet: ",
    Lockable._zCObject_objectName));
    } else {
    Print (ConcatStrings (
    Lockable._zCObject_objectName,
    " war gar nicht abgeschlossen!"));
    };
    };

  8. Beiträge anzeigen #48 Zitieren
    General Avatar von Rantragon
    Registriert seit
    May 2008
    Beiträge
    3.903
     
    Rantragon ist offline
    Zitat Zitat von mainclain Beitrag anzeigen
    Ich hab bisher immer VirtualKeys und die dazugehörigen WinAPI funktion genutzt für die Tastenabfrage und würde das gerne auf die Gothic Funktion umstellen.

    Bietet Gothic eine Funktion an, um die DIK_Keys in den dazugehörigen char, bzw string umzuwandeln?
    Soweit ich weiß, nicht. Ich habe das mal gelöst, indem ich die einzelnen Keys abgefragt habe (frisst bei mehr als 50 Buchstaben ENORM Perfomance), was natürlich nicht besonders elegant ist

  9. Beiträge anzeigen #49 Zitieren
    Dea
    Registriert seit
    Jul 2007
    Beiträge
    10.446
     
    Lehona ist offline
    Zitat Zitat von mainclain Beitrag anzeigen
    Ich hab bisher immer VirtualKeys und die dazugehörigen WinAPI funktion genutzt für die Tastenabfrage und würde das gerne auf die Gothic Funktion umstellen.

    Bietet Gothic eine Funktion an, um die DIK_Keys in den dazugehörigen char, bzw string umzuwandeln?
    Mir ist keine bekannt.

    Willst du auf Tastaturlayouts Rücksicht nehmen? Wenn nicht, sollte man sich das doch fix selber basteln können.

  10. Beiträge anzeigen #50 Zitieren
    Held Avatar von mainclain
    Registriert seit
    Sep 2005
    Beiträge
    5.426
     
    mainclain ist offline
    Zitat Zitat von Lehona Beitrag anzeigen
    Mir ist keine bekannt.

    Willst du auf Tastaturlayouts Rücksicht nehmen? Wenn nicht, sollte man sich das doch fix selber basteln können.
    Genau das wollte ich^^


    Zitat Zitat von Rantragon Beitrag anzeigen
    Soweit ich weiß, nicht. Ich habe das mal gelöst, indem ich die einzelnen Keys abgefragt habe (frisst bei mehr als 50 Buchstaben ENORM Perfomance), was natürlich nicht besonders elegant ist [Bild: fressehalten.gif]
    Das war nicht das Problem, das Problem war, aus den key den jeweiligen String zu generieren (z.b. aus DIK_SEMIKOLON ein ö oder welcher umlaut das darstellt usw.) und das ganze natürlich noch im Bezug auf das in Windows definierte Tastaturlayout.

  11. Beiträge anzeigen #51 Zitieren
    Dea
    Registriert seit
    Jul 2007
    Beiträge
    10.446
     
    Lehona ist offline
    Es gibt
    Code:
    .text:004D2130                             unsigned char __cdecl GetCharFromDIK(int, int, int)
    Wobei der erste Parameter der DIK-Code ist und du die letzten beiden einfach bei 0 lassen kannst, glaube ich (wird zumindest bei den meisten Calls, die ich mir angesehen habe, gemacht - keine Ahnung, welche Auswirkungen die genau haben).

  12. Beiträge anzeigen #52 Zitieren
    Held Avatar von mainclain
    Registriert seit
    Sep 2005
    Beiträge
    5.426
     
    mainclain ist offline
    hm vll noch shift und altgr oder sowas.
    Ich teste es bei zeiten mal aus.

  13. Beiträge anzeigen #53 Zitieren
    Local Hero
    Registriert seit
    Feb 2013
    Beiträge
    236
     
    pawbuj ist offline

    ikarus on Gothic 1

    again me,

    if anyone of advandced modders is willing to help our polish community with autopen chest/door please join to discussion. We can not sorted this matter till today.

    http://themodders.org/index.php?topi...39013#lastPost

  14. Beiträge anzeigen #54 Zitieren
    Warrior Avatar von Thanduriel
    Registriert seit
    Sep 2009
    Ort
    Magdeburg
    Beiträge
    438
     
    Thanduriel ist offline
    Zitat Zitat von pawbuj Beitrag anzeigen
    again me,

    if anyone of advandced modders is willing to help our polish community with autopen chest/door please join to discussion. We can not sorted this matter till today.

    http://themodders.org/index.php?topi...39013#lastPost
    Could you further explain the problem, the most modders here dont speak(myself included) polish and just guessing the problem from the code given is difficult.
    These days, most of my projects can be found on github.

  15. Beiträge anzeigen #55 Zitieren
    Abenteurer Avatar von hatrez123
    Registriert seit
    Feb 2014
    Beiträge
    50
     
    hatrez123 ist offline
    Zitat Zitat von Pawbuj
    hi, I hava review all posts regarding ikarus forsearching answer how to change focus color of chests being locked and I could not find solution.
    Take that.
    func void ChestColorChanger()
    {
    var oCNpc her;
    var int ptr;
    var oCMobContainer chest;
    var int col;

    chest = MEM_PtrToInst (her.focus_vob);
    her = Hlp_GetNpc (hero);

    const int zCView__SetFontColor = 8034576; // Address in g1: 7339392 and in g2: 8034576

    if !Hlp_Is_oCMobContainer(her.focus_vob)
    {
    col = RGBA(255,255,255,255); //White
    return;
    }
    else
    {
    if (chest._oCMobLockable_bitfield & oCMobLockable_bitfield_locked)
    {
    col = RGBA(197,10,10,255); //Red
    }
    else
    {
    col = RGBA(255,255,255,255); //White
    };
    };
    ptr = MEM_Alloc(4);
    MEM_WriteInt(ptr, col);
    CALL_IntParam(ptr);
    CALL__thiscall(MEM_ReadInt(screen_offset), zCView__SetFontColor);
    MEM_Free(ptr);
    };
    Similarly with doors.
    Geändert von hatrez123 (17.05.2014 um 19:39 Uhr)

  16. Beiträge anzeigen #56 Zitieren
    Local Hero
    Registriert seit
    Feb 2013
    Beiträge
    236
     
    pawbuj ist offline

    hook engine on g1

    hi, anyone knows how to use hookengine on gothic 1?

    anyone tested?

  17. Beiträge anzeigen #57 Zitieren
    Dea
    Registriert seit
    Jul 2007
    Beiträge
    10.446
     
    Lehona ist offline
    Zitat Zitat von pawbuj Beitrag anzeigen
    hi, anyone knows how to use hookengine on gothic 1?

    anyone tested?
    There's a version for Gothic 1 floating around (on TheModders.org even), but I think it was modified and certainly isn't completely up to date.
    LeGo will most likely never support Gothic 1 (unless someone is willing port it), so I won't bother porting it. If you feel like doing it yourself, you're most welcome.

  18. Beiträge anzeigen #58 Zitieren
    Local Hero
    Registriert seit
    Feb 2013
    Beiträge
    236
     
    pawbuj ist offline
    I have this version of Hook Engine, but there is no much document with guide how to use it.

    another isssue:

    is possiible (of course with Ikarus paket, not a standard scripts) to control other NPC's body (like by using spell "control" ) by their ID?

  19. Beiträge anzeigen #59 Zitieren
    Dea
    Registriert seit
    Jul 2007
    Beiträge
    10.446
     
    Lehona ist offline
    Do you know that you can control other NPCs in Marvin-Mode if you focus them and press "o"? It's very easy to achieve the same with scripts. However, I'm sure you can easily introduce bugs if you aren't careful, so it really depends on what exactly you want to do.


    You don't really need much documentation to use HookEngine. The address is an address within the code-segment of the Gothic.exe, the oldInstr parameter is the smallest length of instructions bigger than 4 (so 5 at least) at the given address and func is the function you want to have called when said address is executed. Most (if not all) available register (EAX, EDX, ...) will be applied if you change them within your called function.
    It's really more about the general concepts that you have to understand than about this one script. If you don't know how to find the address you want and have nobody do it for you, no amount of documentation will help you.

  20. Beiträge anzeigen #60 Zitieren
    Abenteurer Avatar von hatrez123
    Registriert seit
    Feb 2014
    Beiträge
    50
     
    hatrez123 ist offline
    The best way is change the visual of main hero. I can suppose, that hero instance(mean PC_Hero) is hardcoding in engine and changing npc to control him by scripts (like press 'o') will cause of bugs.
    I've one problem:
    func void init_global()
    {
    Game_InitGerman();
    Lego_Init(Lego_HookEngine);
    var string GothicRestarted;
    if (!Hlp_StrCmp(GothicRestarted, "YES"))
    {
    HookEngine(oCGame__UpdateStatus, 5, "ChestColorChanger");
    HookEngine(oCGame__UpdateStatus, 5, "DoorColorChanger");
    GothicRestarted = "YES";
    };
    };
    I'm hooking two funcs but it's cause of game crash at the start(without any errors).
    But with hooked one func works great.
    func void init_global()
    {
    Game_InitGerman();
    Lego_Init(Lego_HookEngine);
    var string GothicRestarted;
    if (!Hlp_StrCmp(GothicRestarted, "YES"))
    {
    HookEngine(oCGame__UpdateStatus, 8, "ChestColorChanger");
    //HookEngine(oCGame__UpdateStatus, 5, "DoorColorChanger");
    GothicRestarted = "YES";
    };
    };
    These funcs are changing color of focused chest(when is locked/unlocked/empty) and focused doors(when are locked/unlocked). I don't know oldInstr value. If oldInstr value is lower than 8 it's cause of game crash.
    Geändert von hatrez123 (24.05.2014 um 11:55 Uhr)

Seite 3 von 31 « Erste 12345671014 ... Letzte »

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
Impressum | Link Us | intern
World of Gothic © by World of Gothic Team
Gothic, Gothic 2 & Gothic 3 are © by Piranha Bytes & Egmont Interactive & JoWooD Productions AG, all rights reserved worldwide