ACS help - probabilities
ACS help - probabilities
hi
ok so it goes like this.
i need a kind of 3 number-based lock script to open a door
kind of like a vault code
say if the correct number order is 7-3-9 u will have to scroll numbers from 1-9 (zero not included) on each rank
here's a little salt to it!
if u hit the wrong code, a trap will open instead. teleport a humongous # monsters for instance
here's a lil early idea i drew.
since i know minor basic scripting i only imagined the floor to go one way (say to lower floor by xx) or maybe could be done without scripting? idk
http://s15.postimg.org/gc2v81oor/code2.jpg
*additional info: the code however will be partially revealed on the floor (by smaller sectors that lit as the player goes in a maze to press buttons that raise the floors), however, using electronic digits can be tricky, due to the common lines, ex. 2 with 3, 9 with 5, and thus this is will force one to try both!
ok so it goes like this.
i need a kind of 3 number-based lock script to open a door
kind of like a vault code
say if the correct number order is 7-3-9 u will have to scroll numbers from 1-9 (zero not included) on each rank
here's a little salt to it!
if u hit the wrong code, a trap will open instead. teleport a humongous # monsters for instance
here's a lil early idea i drew.
since i know minor basic scripting i only imagined the floor to go one way (say to lower floor by xx) or maybe could be done without scripting? idk
http://s15.postimg.org/gc2v81oor/code2.jpg
*additional info: the code however will be partially revealed on the floor (by smaller sectors that lit as the player goes in a maze to press buttons that raise the floors), however, using electronic digits can be tricky, due to the common lines, ex. 2 with 3, 9 with 5, and thus this is will force one to try both!
Last edited by Mr.T on Fri Nov 20, 2015 11:22 pm, edited 1 time in total.
- Sean
- IRC Operator
- Posts: 982
- Joined: Thu Jan 16, 2014 9:09 pm
- Location: United Kingdom
- Clan: Zandronum
- Clan Tag: [Za]
- Contact:
RE: ACS help - probabilities
And what precisely do you want help with..?
<capodecima> i dont say any more word without my loyer jenova
-
- Retired Staff / Community Team Member
- Posts: 2569
- Joined: Sat Jun 02, 2012 2:44 am
- ZZYZX
- Posts a lot
- Posts: 742
- Joined: Thu Jun 07, 2012 5:56 pm
- Location: Ukraine
- Clan: A3
- Clan Tag: [A3]
RE: ACS help - probabilities
1. Use UDMF for easier line tagging and easier combining of tags with ACS_Execute. In case you already have your map in Doom or Hexen format, lossless conversion to UDMF is possible.
2. Haven't tested, but this code is very simple so it should work OOB:
3. Use as special 80 on three (or more) lines (s2code array size should match).
The line that has the special should be tagged and this line's tag should be passed as the first argument to the script (ltag).
The first argument to the script should be the current line's position in the code, starting from zero. i.e. first digit is 0, second is 1, third is 2.
4. In case you need to make the code random (per map load), make second array, initialize it in OPEN script, and compare s2code to that second array every time the player flips a digit. But that doesn't make sense. If I needed a randomizer like that I'd just make it randomly accept any code and save that code for further use (if any even).
5. Your picture is garbage, didn't get it.
6. Catastrophe's link is clearly made by someone who doesn't know about arrays and StrParam (that, or the article was made in ancient dinosaurZDoom 1.x times), and it's not advised to code like that in 2015. Seriously. My script is 3 times smaller. They also didn't know about modulo operator (%) and used horrible 'if' instead. For this, there is no excuse, as modulo operator was there since 1995.
2. Haven't tested, but this code is very simple so it should work OOB:
Code: Select all
int s2code[3]; // not sure you can define variables like this, if not then int s2code[] instead
script 2 (int ltag, int lnum)
{
s2code[lnum] = (s2code[lnum]+1) % 10; // if 0 is not allowed, then "s2code[lnum] = (s2code[lnum] % 9) + 1;" instead.
SetLineTexture(ltag, SIDE_FRONT, TEXTURE_MIDDLE, StrParam(s:"DIGIT", d:s2code[lnum])); // display current number. you must have DIGIT0 through DIGIT9 textures for this, otherwise rename.
if (s2code[0] == 1 && s2code[1] == 2 && s2code[2] == 3) // do something if code is 123. you may put this in separate script/switch instead.
{
// meow here
}
else if (Random(0, 256) < 32)) // have 1/8 chance of a trap in case of wrong code
{
// make trap code here
}
}
The line that has the special should be tagged and this line's tag should be passed as the first argument to the script (ltag).
The first argument to the script should be the current line's position in the code, starting from zero. i.e. first digit is 0, second is 1, third is 2.
4. In case you need to make the code random (per map load), make second array, initialize it in OPEN script, and compare s2code to that second array every time the player flips a digit. But that doesn't make sense. If I needed a randomizer like that I'd just make it randomly accept any code and save that code for further use (if any even).
5. Your picture is garbage, didn't get it.
6. Catastrophe's link is clearly made by someone who doesn't know about arrays and StrParam (that, or the article was made in ancient dinosaurZDoom 1.x times), and it's not advised to code like that in 2015. Seriously. My script is 3 times smaller. They also didn't know about modulo operator (%) and used horrible 'if' instead. For this, there is no excuse, as modulo operator was there since 1995.
Last edited by ZZYZX on Sat Nov 21, 2015 7:09 am, edited 1 time in total.
quality DoomExplorer hackeringFilystyn wrote:Do you know what windows.h is? It's D, DWORD.
overcomplicated ZDoom grenade
random Doom things
GZDoomBuilder-Bugfix
RE: ACS help - probabilities
so whats wrong with this
i made new 0-9 textures named digitX
front line of sector is 80:script execute argument 1: 1, texture linedef is line id 1, arg.1: 2 line id 2, and arg.1: 3 line id 3
the numbers change fine altho first and second are linked (if first is 3 and second key showing 0 and i press it shows 4) third button is alright
i tagged sectors to lower but it wont work..
and no i use hexen format i never used udmf b4
where did i mess up
Code: Select all
int s2code[3];
script 2 (int ltag, int lnum)
{
s2code[lnum] = (s2code[lnum]+1) % 10;
SetLineTexture(ltag, SIDE_FRONT, TEXTURE_MIDDLE, StrParam(s:"DIGIT", d:s2code[lnum]));
if (s2code[0] == 1 && s2code[1] == 2 && s2code[2] == 3)
Floor_LowerToNearest (19, 50);
else if(s2code[0] == 1 && s2code[1] == 2 && s2code[2] == 4)
Floor_LowerToNearest (20, 200);
}
front line of sector is 80:script execute argument 1: 1, texture linedef is line id 1, arg.1: 2 line id 2, and arg.1: 3 line id 3
the numbers change fine altho first and second are linked (if first is 3 and second key showing 0 and i press it shows 4) third button is alright
i tagged sectors to lower but it wont work..
and no i use hexen format i never used udmf b4
where did i mess up

Last edited by Mr.T on Sat Nov 21, 2015 8:12 pm, edited 1 time in total.
- ZZYZX
- Posts a lot
- Posts: 742
- Joined: Thu Jun 07, 2012 5:56 pm
- Location: Ukraine
- Clan: A3
- Clan Tag: [A3]
RE: ACS help - probabilities
Linked? I think it's just that s2code is uninitialized and contains random garbage. That sometimes happens in map global arrays.
Try saying int s2code[3] = {0, 0, 0};
If that doesn't help, then you probably messed up with script arguments or line tags.
...wait.
Means you do (1, 0), (2, 1), (3, 2) instead of (1, 1), (2, 2), (3, 3).
Try saying int s2code[3] = {0, 0, 0};
If that doesn't help, then you probably messed up with script arguments or line tags.
...wait.
arg1 starts at ZERO, line id starts at ONE. Also line id is arg2, not arg1. Doesn't your GZDB put argument names in there??Mr.T wrote:front line of sector is 80:script execute argument 1: 1, texture linedef is line id 1, arg.1: 2 line id 2, and arg.1: 3 line id 3
Means you do (1, 0), (2, 1), (3, 2) instead of (1, 1), (2, 2), (3, 3).
Last edited by ZZYZX on Sat Nov 21, 2015 8:34 pm, edited 1 time in total.
quality DoomExplorer hackeringFilystyn wrote:Do you know what windows.h is? It's D, DWORD.
overcomplicated ZDoom grenade
random Doom things
GZDoomBuilder-Bugfix
RE: ACS help - probabilities
no it just says argument 1 argument 2 argument 3
numbers texture only works when i put argument 1 2 3 not 0 1 2
and only in (argument 1) box not (argument 2)
am i missing something (on top are line ids on bot are scr. executors)
http://s12.postimg.org/f8t9mm38s/acs.jpg
int s2code[3] = {0, 0, 0}; didnt change anything either
(if the above code is what it is) i already set the texture # to zero
edit: can there be a check button? or will the script execute/work right as u enter the right combination?
numbers texture only works when i put argument 1 2 3 not 0 1 2
and only in (argument 1) box not (argument 2)
am i missing something (on top are line ids on bot are scr. executors)
http://s12.postimg.org/f8t9mm38s/acs.jpg
int s2code[3] = {0, 0, 0}; didnt change anything either
(if the above code is what it is) i already set the texture # to zero
edit: can there be a check button? or will the script execute/work right as u enter the right combination?
Last edited by Mr.T on Sat Nov 21, 2015 9:58 pm, edited 1 time in total.
- ZZYZX
- Posts a lot
- Posts: 742
- Joined: Thu Jun 07, 2012 5:56 pm
- Location: Ukraine
- Clan: A3
- Clan Tag: [A3]
RE: ACS help - probabilities

Also if you want a check button just put the if() in another script and run it from another switch.
edit: lol this picture is wrong, for it to work this way you better change script 2 to
Code: Select all
script 2 (int lnum, int ltag)
Last edited by ZZYZX on Sat Nov 21, 2015 10:20 pm, edited 1 time in total.
quality DoomExplorer hackeringFilystyn wrote:Do you know what windows.h is? It's D, DWORD.
overcomplicated ZDoom grenade
random Doom things
GZDoomBuilder-Bugfix
RE: ACS help - probabilities
oh k nice
i flipped the arguments too
script 2 (int lnum, int ltag)
now finally works!!! thank you
only check button left!
edit: done. tnx again
i flipped the arguments too
script 2 (int lnum, int ltag)
now finally works!!! thank you

only check button left!

edit: done. tnx again
Last edited by Mr.T on Sat Nov 21, 2015 11:09 pm, edited 1 time in total.