User Tag List

Results 1 to 4 of 4
  1. #1
    Octorok

    Join Date
    Jan 2007
    Age
    27
    Posts
    142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Proper Use Of SetScreenState For Nearby Rooms

    Back in build 1076, I used the following in a custom door script to change the screen state of nearby rooms to simulate the normal NES door mechanics.

    Code:
    Game->SetScreenState(Game->GetCurMap() + 1, Game->GetCurScreen() + 16 - (8 * Game->GetCurMap()), ST_DOORDOWN, true);
    Although it looks complex, this code worked perfectly, which meant a few bugs were worked around (as the GetCurMap() + 1 and the 8 screen offset per map show). Since that build, changes were made to the functions that completely broke the script.

    What I want to know is, what would be an updated version of the code above that works (it changes the state of the screen directly below the current one to mark the top door opened). Or has a bug been introduced that needs to be fixed/worked around?
    Programmings my game because I program games.
    "Wait. You lost me at the part about the 'almost certain death'." - A quote I would love to make in an MMORPG.
    Disclaimer: Din's Fire does not make the user immune to the effects of lava. Do not use Din's Fire in mid-jump over a pool of lava. Death and severe burns will follow.

    ZCG Current Version:
    Version 0.05
    For Mac Build 1076 Windows Build 1082

  2. #2
    Keese

    Join Date
    Feb 2006
    Location
    North Carolina
    Age
    28
    Posts
    91
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I gave it a shot myself, but I don't think I did it right either. My unencrypted test quest is here: use 1286. It's possible I set up the door or FFC wrong, but I need someone else to verify.

  3. #3
    Developer ZC Developer
    Gleeok's Avatar
    Ms Pacman Champion! Tetris Champion!

    Join Date
    Apr 2007
    Posts
    3,591
    Mentioned
    18 Post(s)
    Tagged
    2 Thread(s)
    Yes, there was a bug in Game->GetCurMap() returning the wrong map / crashing. _L_ I believe fixed this around 11**. Remove the "+ 1" and I think it should work.

    [edit] Nope I was wrong:
    ZScript: now, Game->GetScreenState() and Game->SetScreenState() now correctly count maps from 1 upward (as indicated in zscript.txt) rather than 0 upward.
    Same fix though.
    This post contains the official Gleeok™ seal of approval. Look for these and other posts in an area near you.

  4. #4
    Octorok

    Join Date
    Jan 2007
    Age
    27
    Posts
    142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Now I think there is a bug with SetScreenState. The following works in Mac Build 1304.

    Code:
    Game->SetScreenState(Game->GetCurMap(), Game->GetCurScreen() + 16, ST_DOORDOWN, true);
    Game->SetScreenState(Game->GetCurMap(), Game->GetCurScreen() - 16, ST_DOORUP, true);
    Game->SetScreenState(Game->GetCurMap(), Game->GetCurScreen() + 1, ST_DOORRIGHT, true);
    Game->SetScreenState(Game->GetCurMap(), Game->GetCurScreen() - 1, ST_DOORLEFT, true);
    ...at least for a while. At some point, these statements no longer function correctly. Experiementing a little, I noticed that this would work when the normal statements did not.

    Code:
    Game->SetScreenState(Game->GetCurMap(), Game->GetCurScreen(), ST_DOORUP, true);
    The bug occurs with screens on higher Map Numbers, or possibly higher DMap Numbers (one or the other). The bug looks like SetScreenState gets offset by 16 at some point. Is this supposed to happen?
    Programmings my game because I program games.
    "Wait. You lost me at the part about the 'almost certain death'." - A quote I would love to make in an MMORPG.
    Disclaimer: Din's Fire does not make the user immune to the effects of lava. Do not use Din's Fire in mid-jump over a pool of lava. Death and severe burns will follow.

    ZCG Current Version:
    Version 0.05
    For Mac Build 1076 Windows Build 1082

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •