Jacob Posted June 6, 2016 I'm writing a kill count overlay for a 100% kills-required multiplayer server. I'm terrible with program flow and I'm having trouble finding an effective way to design the loop. The script always either stops due to an infinite loop ("runaway script", as ZDoom calls it) or it fails to update. This script should run throughout each level, for each player, and it should update for each new level. It should hopefully not break if a player dies, either. It should be really simple but I'm flustered and I can't seem to get it right. If someone could lend me a hand I would really appreciate it. The basics of what I want to do is just this bit of code: int mtotal = GetLevelInfo (LEVELINFO_TOTAL_MONSTERS); int mkilled = GetLevelInfo (LEVELINFO_KILLED_MONSTERS); PrintBold (d:mkilled, s:" out of ", d:mtotal-mkilled, s:" monsters killed."); delay(15); That's the main meat of the script. But, like I said, I can't seem to get it to stay up-to-date unless I write an infinite loop and the game won't let that run for long. Thanks 0 Quote Share this post Link to post
scifista42 Posted June 6, 2016 An infinite loop that contains delay should run OK for as long as you want. EDIT: Apparently, there is a limit after all - max 500000 actions in one script. Maybe you would be able to get around it by making the script call itself again after some number of iterations. EDIT2: Now I'm confused if this limit applies only to scripts without delay or also to scripts with delay. 0 Quote Share this post Link to post
Graf Zahl Posted June 6, 2016 scifista42 said:An infinite loop that contains delay should run OK for as long as you want. EDIT: Apparently, there is a limit after all - max 500000 actions in one script. No, it's 500000 instructions between delays. Regarding the original question, yes, this requires a looping script with a delay. Which is a perfectly fine construct. 0 Quote Share this post Link to post
scifista42 Posted June 6, 2016 Graf Zahl said:No, it's 500000 instructions between delays. Then the wiki ought to have said "counting the amount of actions called by the script between delays" instead of just "counting the amount of actions called by the script". The latter implies (at least to me) that it means total amount of actions called by the script since its launch. 0 Quote Share this post Link to post
Graf Zahl Posted June 6, 2016 I think the paragraph is sufficiently clear - provided you read it in its entirety. 0 Quote Share this post Link to post
Jacob Posted June 7, 2016 Huh? Uh yeah... well... in lieu of all of that... I got the script working. I'll chock it up to mental fatigue. Now, I'm trying to create a PK3 file for the add-on script in SLADE... but my script doesn't seem to work. I'm accustomed to doing all of my ACS work in Doom Builder 2, wherein I can create a map, add ACS, compile the script and save the map as a .WAD file, for almost effortless results. The problem is that I have to have a separate file for my ACS script since the only .WAD file on my Zandronum server is the vanilla Doom2.WAD iWad file. Regardless of whether you're doing it in SLADE or in some other utility, I need help finding an effective way to implement my ACS file into my Zandronum server. It's basically the only missing piece of the puzzle in an awesome new thing I've been working on. Thanks. 0 Quote Share this post Link to post
scifista42 Posted June 7, 2016 Instead of reincluding the script into every map and then reincluding the maps themselves too, make a custom library and use LOADACS to load it for every map. @Graf Zahl: No it's not clear. 0 Quote Share this post Link to post
Jacob Posted June 8, 2016 OMFG I felt like such a retard, inundated with all this new, almost esoteric technical jargon, until I found this: http://realm667.com/index.php/en/component/content/article?id=1341:medium-alternate-firereloadzoomwhatever-states-on-weapons-59207368 It's a really great how-to for adding an ACS to a WAD or PK lump. If anyone has any trouble with this, just check the link, and that should straighten things out for you. As a time saver for anyone else who's new to this process, here's a run-down of the process, just for clarification: The LOADACS file is just a plain-text file you create with the name of the ACS file(s) you want to auto-load. You MUST include a LOADACS file in your lump if you want the ACS script to be loaded. So in any plain-text editor, create the LOADACS file and type in the name of the ACS file(s) you want to load in your lump. DO NOT TYPE THE EXTENSION IN THE LOADACS FILE... just the first part of the file! I did this the first time I tried it... even though I'd read in the directions not to do it... I still, for some reason, did it anyway. I'm terrible at the physical side of following directions sometimes. Anyway, my ACS script file was called 'killratio.acs' so I just put "killratio" into my LOADACS file and saved it woth the file name LOADACS. No extension. So I'd written and tested my ACS file in Doom Builder, and it worked like gravy. I created my archive in SLADE, and in this archive, I created a directory called 'source'. Then I imported (archive -> import files... on the menu) killratio.acs into that directoy. I right clicked the ACS file and did 'compile'. It created another directory in my PK3 archive called 'acs', which contains the killratio.o (binary compilation output file). Then, in the main (top) directory of my archive, I imported the LOADACS file and saved the archive. I ran ZDoom with the .PK3 file and it worked without issue. This should (hopefully) help someone, somewhere down the line, if they find themselves as confused as I was. Note (if you're using SLADE): I did not use the Hexen compilation... but in my case, it worked. I guess that's for more levels more specific to Hexen/UDMF format. So if you're doing a Doom mod, you can just use the regular compilation option. Thanks for the help! 0 Quote Share this post Link to post
Graf Zahl Posted June 8, 2016 scifista42 said:@Graf Zahl: No it's not clear. Please note that looping a script without a delay will cause ZDoom to automatically terminate the script, because it would not give anything else in the map a chance to run. This is determined by counting the amount of actions called by the script and terminating if the amount reaches 500,000. Seems pretty unambiguous to me. 0 Quote Share this post Link to post
scifista42 Posted June 8, 2016 The word "this" in the second sentence is ambiguous (it could mean just "looping a script [anyhow]", or specifically "looping a script without a delay"). And other than that, nothing (no particular words) in that statement implies any connection between the "without a delay" and the "counting the amount of actions called by the script". Also, nothing implies that the "counted amount of actions" would be reset upon a delay. 0 Quote Share this post Link to post
Graf Zahl Posted June 8, 2016 As I said provided you read it in its entirety. 0 Quote Share this post Link to post
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.