1. SPS Accounts:
    Do you find yourself coming back time after time? Do you appreciate the ongoing hard work to keep this community focused and successful in its mission? Please consider supporting us by upgrading to an SPS Account. Besides the warm and fuzzy feeling that comes from supporting a good cause, you'll also get a significant number of ever-expanding perks and benefits on the site and the forums. Click here to find out more.
    Dismiss Notice
Dismiss Notice
You are currently viewing Boards o' Magick as a guest, but you can register an account here. Registration is fast, easy and free. Once registered you will have access to search the forums, create and respond to threads, PM other members, upload screenshots and access many other features unavailable to guests.

BoM cultivates a friendly and welcoming atmosphere. We have been aiming for quality over quantity with our forums from their inception, and believe that this distinction is truly tangible and valued by our members. We'd love to have you join us today!

(If you have any problems with the registration process or your account login, please contact us. If you've forgotten your username or password, click here.)

Making Custom Scripts

Discussion in 'BG2: Shadows of Amn (Classic)' started by bp, Mar 12, 2002.

  1. bp Gems: 3/31
    Latest gem: Lynx Eye


    Joined:
    Dec 14, 2001
    Messages:
    63
    Likes Received:
    0
    Anybody making custom scripts? How hard is it? Can you post some examples?
     
  2. Extremist Gems: 31/31
    Latest gem: Rogue Stone


    Joined:
    Apr 3, 2001
    Messages:
    4,366
    Likes Received:
    0
  3. bp Gems: 3/31
    Latest gem: Lynx Eye


    Joined:
    Dec 14, 2001
    Messages:
    63
    Likes Received:
    0
    Thanks, prob'ly shoulda done a search first.

    I'm a programmer, so I'm not afraid :)
    Maybe I'll post some of the stuff I come up with.
     
  4. Extremist Gems: 31/31
    Latest gem: Rogue Stone


    Joined:
    Apr 3, 2001
    Messages:
    4,366
    Likes Received:
    0
    [​IMG] Really?

    I'd need a hand in updating SPfix for SoA, can I "recruit" you somehow?

    I mean, I managed to find a person on BIS boards who will try to make a ToB fixes based on my SoA ones and send those to Tal.
    You may check it here: http://feedback.blackisle.com/forums/showthread.php?s=&threadid=29364

    But why can't I find someone to give me a hand with it here? :wail::flaming:

    So, what do you say?
     
  5. bp Gems: 3/31
    Latest gem: Lynx Eye


    Joined:
    Dec 14, 2001
    Messages:
    63
    Likes Received:
    0
    Sure send me an email. I've been programming in C since 1976. I don't have a lot of free time, but I'll be glad to help where I can.
     
  6. Extremist Gems: 31/31
    Latest gem: Rogue Stone


    Joined:
    Apr 3, 2001
    Messages:
    4,366
    Likes Received:
    0
    Uh, oh, scripting language is more like Basic, not C...

    Plus, you'll need to perform some pretty hard hex editing stuff (means: exploration and trial/error)...

    Are you sure you could manage it? I don't know the meaning of each byte, each variable, etc in the files. You would be left on yourself to find it out. With experimenting, of course. Or by any other means.
    And what things to fix? I can't possibly know it all. Because of that, I started with visiting all fans' BG2 boards (except GMBNSH, they can rot!) and collected late reported bugs. The only two left are Boots of Speed vs Ring of Free Action and Jaheira romance which I'll leave for myself. After that I'll start digging for some more bugs. This is also included into your own research.

    I won't contact you by mail because I want everyone to see what is actually required here if anyone gets interested.

    Finally, there is no payment, we do this as fans for fans. Also, there is no reason to make fuss about it. Because of things like that, I don't and won't use any TeamBG util. This doesn't mean you shouldn't use those by yourself.

    Are you really sure you wanna do this? I mean, you will be totally on your own, but each bug you solve will be one bug less for me or anyone else who would join.
     
  7. Mathetais Gems: 28/31
    Latest gem: Star Sapphire


    Joined:
    Apr 5, 2001
    Messages:
    2,767
    Likes Received:
    0
    hmmmm.....

    I ask Extremist how to make scripts, and he says, "Sorry, no time to help."

    BP asks for help, and Extremist says, "Welcome fellow programmer, can I recuit you into the elite team of BG fixers that I lead."

    Extremist ... do you just like horses or hate clerics? Just because I don't know a java script from a mocha latte, it doesn't mean I can't write code. (I can't, but you don't know that) Just because I can't design a custom entrance script for the chat room doesn't mean I can't design a wonderful custom script for thieves (again, I can't but that's my little secret)

    ;) just teasing you buddy ... stay Extreme!

    As I always say, "Extremist" strong enough for a man, but made for a woman. ;) :lol: :grin:
     
  8. Extremist Gems: 31/31
    Latest gem: Rogue Stone


    Joined:
    Apr 3, 2001
    Messages:
    4,366
    Likes Received:
    0
    Mat, no offence taken.

    But the answer is the same to him and to you. You missed to spot this:
    I can't get time for explaining anything, that's the problem. If there was a time, I would write all things I know down. But...
     
  9. bp Gems: 3/31
    Latest gem: Lynx Eye


    Joined:
    Dec 14, 2001
    Messages:
    63
    Likes Received:
    0
    I can handle it. I've written in assembly, Fortran, C, Lisp, Java, Perl, blah blah blah.
    I've done lots of hex editing (don't like octal). The problem is, I don't have a lot of time. So the best thing, is to give me a specific problem, and let me work on it.

    On top of that, I design microprocessors; worked on the 68,000 , 29,000, and the Athlon.

    I also was the first TCP/IP Unix networking guy in Texas (ARPANET in 1977). Worked on the Unix kernel, device drivers, etc.

    -soapbox off-
     
  10. Extremist Gems: 31/31
    Latest gem: Rogue Stone


    Joined:
    Apr 3, 2001
    Messages:
    4,366
    Likes Received:
    0
    [​IMG] Well, let's start with something then. The question was posted by Tenebrous at BIS boards and it is about BG2 timers, how they work and why they mustn't be messed.

    References to bug with it is a glitch in Jaheira Romance fix from Baldurdash.
    Be aware that I'm posting this as a speculation - I don't have Infinity Engine itself nor I can know where exactly the game keeps some values.

    Ok, let's start.

    There are two clocks in BG2.
    1. Real clock that tracks real time player spent with game running (I'll call it CREAL).
    2. Ingame clock that tracks ingame time - it's displayed in lower left corner of the game screen (I'll call it CINGAME).

    When the game starts, both clocks start from 0.

    Now imagine that you press rest button. With that you are instantly moving CINGAME for eight hours (or less, or more, depends on your game setting). This puts CINGAME at higher value than CREAL.
    CREAL you can't move forward like this. And do remember that, it's the most important part here.

    Ok, now another part: Timers.
    You may give a command to set real or ingame timer at some point.
    For example:
    SetGlobalTimer("TINGAME","GLOBAL",3600) - TINGAME will expire after half a day of ingame time
    RealSetGlobalTimer("TREAL","GLOBAL",3600) - TREAL will expire after 3600 seconds of real time

    But what happens inside the game here?
    Game gets values from both clocks, adds the number we set above to the clock values and stores it in the global variables TINGAME and TREAL.

    Let's say CINGAME was 7,195,874 and CREAL was 2,395,858.
    TINGAME will now have the value 7,195,874+3,600=7,199,474
    TREAL will have the value 2,399,458

    This was an example, of course. What I need you to notice is that TINGAME is higher number than TREAL.

    Now we have two commands to check if timer expired. For timers we have we'll use within the scripts:
    GlobalTimerExpired("TINGAME","GLOBAL")
    RealGlobalTimerExpired("TREAL","GLOBAL")

    Now the game subtracts the value from clocks from timers to see if timers expired. If the result is negative that means timer expired! I won't give you an examples - but you know now why setting the timer to 1 will instantly mean that timer expired, no matter if it's real or ingame one. ;)

    And what happens with messing the nature of the timers?
    Let's say we placed this check in the script:
    GlobalTimerExpired("TREAL","GLOBAL")

    The game gets 2,399,458 (value of TREAL), subtracts from it value from the CINGAME which is 7,195,874 and gets:
    negative number!!!

    And what happens? The game thinks timer expired!

    This is why Jaheira instantly appears after the rest in Manveru's Jaheira fix for SoA. And that's why that fix should be updated.

    Ok, that's about it, if you have any additional questions, please do post.
    On a side note, I've posted this on BIS boards too with hope I'll get some real feedback on the matter from BIS employees themselves. ;) :evil:

    [This message has been edited by Extremist (edited March 19, 2002).]

    [This message has been edited by Extremist (edited March 19, 2002).]
     
Sorcerer's Place is a project run entirely by fans and for fans. Maintaining Sorcerer's Place and a stable environment for all our hosted sites requires a substantial amount of our time and funds on a regular basis, so please consider supporting us to keep the site up & running smoothly. Thank you!

Sorcerers.net is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to products on amazon.com, amazon.ca and amazon.co.uk. Amazon and the Amazon logo are trademarks of Amazon.com, Inc. or its affiliates.