User Tag List

Results 1 to 6 of 6

Thread: Started Writing New Script Types

  1. #1
    The Timelord
    QDB Manager
    ZC Developer

    Join Date
    Oct 2006
    Location
    Prydon Academy
    Posts
    1,396
    Mentioned
    112 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    4,781
    Level
    21
    vBActivity - Bars
    Lv. Percent
    73.04%

    Started Writing New Script Types

    @Gleeok @Grayswandir @venrob

    I started to code in the following script types:

    npc script
    lweapon script
    eweapon script
    screen script
    link script --why didn't I do this as PLAYER script?!
    dmap script

    Of these, npc, lweapon, eweapon, and dmap all have a 'this'.

    I also added a QR to permit item scripts to run for more than one frame. This is now working, as of 2.55 Alpha 2.

    If the QR is enabled, then item scripts run until they run out of scope. You can find it under Quest->Rules->Scripts

    In the process of retooling this stuff, I expanded script registers from 256, to 1024. I might at some point see if I can make global--and only global--vars go higher. I don't want to try converting stacks from fixed-sized arrays, to vectors, because that'll be a nightmare with script-changes mid-stream.

    Sprites now have stacks, and for similar reasons, I don't want to delete them when they aren't in use, because if the user assigns a script externally, that'll break.

    (I do need to delete script stacks from particles, and engine phantom weapons.)

    This is the current WIP repo.

    The working/tested bits are in brancg 2.55.

  2. #2
    Here lies mero. Died by his own dumbassitude.
    Join Date
    May 2011
    Posts
    929
    Mentioned
    102 Post(s)
    Tagged
    2 Thread(s)
    vBActivity - Stats
    Points
    5,527
    Level
    23
    vBActivity - Bars
    Lv. Percent
    13.96%
    Dude lweapon and eweapons are the same damn thing, only difference is what vector they are stored in. They only require one script. Not two.

  3. #3
    The Timelord
    QDB Manager
    ZC Developer

    Join Date
    Oct 2006
    Location
    Prydon Academy
    Posts
    1,396
    Mentioned
    112 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    4,781
    Level
    21
    vBActivity - Bars
    Lv. Percent
    73.04%
    Quote Originally Posted by Tamamo View Post
    Dude lweapon and eweapons are the same damn thing, only difference is what vector they are stored in. They only require one script. Not two.
    We had this conversation on Discord. I want them separate for my own purposes, not limited to keeping their refInfo segregated, and to ensure that there are an equal number of slots for creating enemy and player weapon scripts.

    NPC scripts are hovering near 90%.

    Alpha 3





    Script

    Code:
    npc script N
    {
    	void run(){TraceToBase(64,10,2); this->X = 16;}
    	
    }

    Assembly

    Code:
    N
     SETV d2,0
     SETR d3,REFNPC
     PUSHR d3
     SETR d4,SP
     PUSHR d4
     SETV d2,0.0015
     PUSHR d2
     SETV d2,64
     PUSHR d2
     SETV d2,10
     PUSHR d2
     SETV d2,2
     PUSHR d2
     GOTO 32
     POP d4
     SETV d2,16
     PUSHR d4
     SETV d3,0.0028
     PUSHR d3
     PUSHR d2
     SETR d6,d4
     ADDV d6,0
     LOADI d2,d6
     POP d3
     PUSHR d2
     PUSHR d3
     GOTO 37
     POP d4
     SETV d3,0
     POP d3
     QUIT
     TRACE5
     POP d3
     POP d3
     POP d3
     RETURN
     POP d2
     POP d3
     SETR REFNPC,d3
     SETR NPCX,d2
     RETURN

    Remains to Do


    Save the slot code int he quest file.
    Allow npcs to access it and set the script slot (Enemy Editor)
    Call the script in the ZC game loop.
    Hope that it works.

  4. #4
    Here lies mero. Died by his own dumbassitude.
    Join Date
    May 2011
    Posts
    929
    Mentioned
    102 Post(s)
    Tagged
    2 Thread(s)
    vBActivity - Stats
    Points
    5,527
    Level
    23
    vBActivity - Bars
    Lv. Percent
    13.96%
    their can be separate slots thats not the issue i have, the issue i have is that your taking a entity which is the same for both vectors and defining two script definitions. you dont do that. it's bad design.

    And why are you posting this when we discussed this on discord already? hahaha, god i love you man.

  5. #5
    The Timelord
    QDB Manager
    ZC Developer

    Join Date
    Oct 2006
    Location
    Prydon Academy
    Posts
    1,396
    Mentioned
    112 Post(s)
    Tagged
    1 Thread(s)
    vBActivity - Stats
    Points
    4,781
    Level
    21
    vBActivity - Bars
    Lv. Percent
    73.04%
    Quote Originally Posted by Tamamo View Post
    Dude lweapon and eweapons are the same damn thing, only difference is what vector they are stored in. They only require one script. Not two.


    Some Clarification on Why They Are Separate
    Amongst other reasons for which lweapon script, and eweapon script are separated, here are some others that, because of how ZASM and ZScript work internally, effectively mandate segregation:

    1. The tables lweapon and eweapon have some different variables/functions. If there was only one weapon script type, then this->function() or this->var or this->arr[] might cause bugs, crashes, or so forth because there would be no ZASM to run them if assigned to a different type

    2. Beyond that, this-> stuff is determined by script type during compilation The parser would have no clue what ZASM instructions to use without segregating the script types so that it pulls functions using the correct refvar IDs. Coimbining them would preclude using the this-> pointer, which would be awful.

    Basically, the script type tells the parser what tables to use to match strings in a script to ZASM instructions, or to Opcode constructors. If there was only one weapon script type, we'd need to incent a wholly new parser just to make it work! That's pretty far from 'simplification'.

    3. Last, because lweapon and eweapon are segregated internally, calling RunScript(SCRIPT_TYPE, ID, CONST) would present some technical issues if we don't know if the script is functioning for an lweapon, or an eweapon. Segregation eases this, and makes integration into the extant editors simpler.. This notwithstanding, is the most trivial of the reasons that they need to be exclusively typed.


  6. #6
    Here lies mero. Died by his own dumbassitude.
    Join Date
    May 2011
    Posts
    929
    Mentioned
    102 Post(s)
    Tagged
    2 Thread(s)
    vBActivity - Stats
    Points
    5,527
    Level
    23
    vBActivity - Bars
    Lv. Percent
    13.96%
    1) no they dont

    2) you shouldn't segregrate script type period. its terrible design

    3) yep... but dummyweapons are the freaks that swing bothways.

    you can have two different slots. but the script definitions for both need to be the same yo.

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
  •  
About us
Armageddon Games is a game development group founded in 1997. We are extremely passionate about our work and our inspirations are mostly drawn from games of the 8-bit and 16-bit era.
Social