
EDuke32 Scripting "CON coding help"
#887 Posted 06 August 2012 - 11:54 AM
#888 Posted 07 August 2012 - 05:25 AM

cant you show me exactly i how can do it?
because ive tried many combinations of this + that aplayer code, but still it isnt working properly.
video is here: video
im trying to make own mod, something like slendergame.net with nice atmosphere, but first problem is these lighting, and another one is i dont know how control if is crosshair on or off.
I know maybe in some data or cfg file can be this information stored, but that isnt very useful because i need control it in .CON
I'd appreciate any help, thanks!
This post has been edited by Biturbo: 07 August 2012 - 05:34 AM
#889 Posted 07 August 2012 - 11:27 AM

#890 Posted 07 August 2012 - 03:46 PM
Biturbo, on 07 August 2012 - 05:25 AM, said:
gamevar thunder_count 0 0 gamevar runonce 0 2 gamevar default_cshade 0 2 // to store the original sector shade gamevar default_fshade 0 2 // to store the original sector shade gamevar new_cshade 0 2 gamevar new_fshade 0 2 useractor notenemy LIGHTING_ICON cstat 32768 ifvare runonce 0 // we only want to store the shade at its default value { getsector[THISACTOR].floorshade default_fshade getsector[THISACTOR].ceilingshade default_cshade setvar runonce 1 } ifvarg thunder_count 30 // if the counter is above a good value { setvarvar new_cshade default_cshade setvarvar new_fshade default_fshade subvar new_cshade 10 // subtract! lower numbers are brighter numbers subvar new_fshade 10 ifvarg thunder_count 35 // I made two stages of brightness for the heck of it { subvar new_cshade 10 subvar new_fshade 10 } setsector[sector_pos].floorshade new_fshade setsector[sector_pos].ceilingshade new_cshade } else // otherwise just keep the default/original sector shade { setsector[THISACTOR].floorshade default_fshade setsector[THISACTOR].ceilingshade default_cshade } enda actor APLAYER ifvare thunder_count 0 ifrnd 16 // we only start counting sometimes { setvar thunder_count 1 } else ifvarg thunder_count 0 // count as long as the var is more than 0 { addvar thunder_count 1 ifvarg thunder_count 40 // reset it when it goes over the max value we want setvar thunder_count 0 } // rest of player code enda
#891 Posted 07 August 2012 - 10:25 PM
rasmus thorup, on 07 August 2012 - 11:27 AM, said:

That is circuitous. Use getuserdef[THISACTOR].crosshair only to see if the user has enabled or disabled the crosshair in their options. You should not change it because that would alter their preference.
Instead, utilize EVENT_DISPLAYCROSSHAIR. If you want to forcefully disable the crosshair, in that event, "setvar RETURN -1". If you only want to change the crosshair image, I added functionality so that all you have to do is set RETURN to the tilenum of the image you want to use. If you are doing anything more fancy than that, such as color palette or positioning changes, let me know and I will help you with that.
#892 Posted 24 August 2012 - 11:34 AM
Hendricks266, on 26 July 2012 - 06:21 PM, said:
Do you know of any other instances where there is something you cannot do in EVENT_GAME that you can effectively only do in actor code?
So hey, now that you've got your new computer, any chance of this happening soonish? I'm sort of bedridden post-surgery for the next couple of days, I'd love to be able to finish up that mutator I was working on.

#893 Posted 02 September 2012 - 02:00 AM
or i need to edit eduke32.exe ?
This post has been edited by Biturbo: 02 September 2012 - 02:16 AM
#894 Posted 10 September 2012 - 05:30 PM
onevent EVENT_PREGAME { ifvarn sprite[THISACTOR].htextra -1 { redefinequote 254 Actor (%d) Extra (%d) Htextra (%d) Owner (%d) qsprintf 254 254 THISACTOR sprite[THISACTOR].extra sprite[THISACTOR].htextra player[THISACTOR].i echo 254 } } endevent
Shooting something with a hitscan weapon works fine:
Actor (448) Extra (24) Htextra (9) Owner (644)
But shooting them with anything else (freezer, RPG, etc.) only seems to output for spawned debris, gibs, and other effects. The original actor doesn't show up in the output.
Is this a bug, or am I doing things wrong?
#895 Posted 17 September 2012 - 07:37 AM
onevent EVENT_DISPLAYMENU myospal 160 100 3281 0 1024 0 endevent
This works perfectly.
Now, I want to do this for the loadingscreen and the screen where Duke Nukem 3D pops up (#2493)
I already searched in the wiki for events but all I can find is EVENT_LOGO and EVENT_DISPLAYLOADINGSCREEN, but these are used to draw sprites on the background. So no luck with that.
Are there other events or are there some other tricks I can use.
Thanks in advance
#896 Posted 17 September 2012 - 07:50 AM
*EDIT* My mistake about the first part. You're probably going to have to just replace that tile in the art files.
This post has been edited by EmericaSkater: 17 September 2012 - 08:00 AM
#897 Posted 17 September 2012 - 08:08 AM
EmericaSkater, on 17 September 2012 - 07:50 AM, said:
*EDIT* My mistake about the first part. You're probably going to have to just replace that tile in the art files.
Already replaced the tiles, even with widescreen ones. But he automaticly scales them to 4:3 size. I can't add the myospal or rotatesprite command to GETLOADTILE? Or am I wrong...
#898 Posted 17 September 2012 - 08:25 AM
http://wiki.eduke32....AYLOADINGSCREEN can be used to draw on top of everything else. You could make everything blank and then draw whatever you wanted.
#899 Posted 17 September 2012 - 09:07 AM
Mblackwell, on 17 September 2012 - 08:25 AM, said:
http://wiki.eduke32....AYLOADINGSCREEN can be used to draw on top of everything else. You could make everything blank and then draw whatever you wanted.
Yeah, I knew that, but I have some idea's

#900 Posted 17 September 2012 - 09:20 AM
#901 Posted 18 September 2012 - 09:59 PM
#902 Posted 18 September 2012 - 11:53 PM
I've been thinking of incorporating some of the math commands added in EDuke 2.1.1, though obviously not the dumb ones like finddist2d. Thoughts?
#903 Posted 19 September 2012 - 04:26 AM
#905 Posted 19 September 2012 - 05:39 AM
#906 Posted 19 September 2012 - 05:51 AM
This post has been edited by Fox: 19 September 2012 - 05:51 AM
#907 Posted 19 September 2012 - 06:12 AM
#908 Posted 19 September 2012 - 06:18 AM
But using CON you can force them to remain only blocked. So you can have objects like Doom, which block your passage but let projectiles fly across it.
#909 Posted 19 September 2012 - 06:22 AM
Fox, on 19 September 2012 - 06:18 AM, said:
Maybe that's why I assumed they (blocking players & blocking bullets) are one and the same.
#910 Posted 19 September 2012 - 07:04 AM
Hendricks266, on 18 September 2012 - 11:53 PM, said:
Adding these seems sensible, since what we have now with dist and ldist can lead to kind of API-inverted code ("set sprite positions, call dist, reset positions." Ugh.)
By the way, they compute pretty crude approximations to the hypotenuse length, for example ldist is
125/128 * max(x,y) + 53/128 * min(x,y).
See the second answer for this question on stackoverflow for the idea behind it (53/128 = 0.41406, sqrt(2)-1 = 0.41421, approximately).
Quote
I'm less sure about those ones being useful. The composite ones like "sin(a - b)" can make sense in a floating point setting, where computing them in a special fashion may significantly increase accuracy, but with integers being the only numeric type in CON, there's not much to be gained. For the hypotenuse length, we have calchypotenuse (unwieldy long name for fear of name collisions). I'm not very happy with the way it turned out though, it currently has a discontinuity at the squared hypotenuse equalling INT32_MAX. X raised to the Yth power is something that CON is missing, but again, with only integers there doesn't seem to be much use for it, since you'd most often use Y=2 or Y=3. Mod and abs would not add anything really new. This leaves the tangent and the logarithm: the first can be calculated by a ratio of the sine to the cosine (with appropriate scaling), and a base-2 log could be useful (but possible to code as loop currently[*]), the natural one looking out of place again.
[*]edit: I'm thinking about the rounded variety here, like "log2(9)=3".
#911 Posted 19 September 2012 - 11:28 AM
If not, would this be at all possible to implement? I can see several potential uses for this.
#912 Posted 19 September 2012 - 11:41 AM
As far as adding math commands, I think the more coding features into the engine is always better. The "power" or exponent math would be very attractive for some stuff I'm doing (expvar and expvarvar?). I think having better trig functions would be awesome, but exactly which ones or how they're implemented I'll leave guessing up to people more involved.
This post has been edited by Reaper_Man: 19 September 2012 - 12:25 PM
#913 Posted 19 September 2012 - 12:38 PM
Reaper_Man, on 19 September 2012 - 11:41 AM, said:
Do you need the ability to pass fractional bases or exponents? In that case, we'd need to decide where to place the implicit binary point. (Or pass numerator and denominator separately, but I guess that would be just as confusing.)
Quote
In which way "better"? CON's sine and cosine have 15 bits of precision. Approximate arctangent is there (getangle), tangent can be calculated as mentioned previously. Is there anything practical missing?
#914 Posted 19 September 2012 - 01:11 PM
I'm sorry I meant "more" and not "better". I also can't think of anything off hand, I haven't had to do trig math in eduke in a while, so hopefully someone else can field that better.
EDIT
An absolute value command would be useful too (absvar).
This post has been edited by Reaper_Man: 19 September 2012 - 02:21 PM
#915 Posted 19 September 2012 - 03:15 PM
ifvarl X 0 mulvar X -1
for the "absvar" function.
#916 Posted 19 September 2012 - 04:47 PM
Reaper_Man, on 19 September 2012 - 11:41 AM, said:
I like yours better.
Reaper_Man, on 19 September 2012 - 11:41 AM, said:
I used to think this but then I realized I only wanted it for ^0.5 to do a square root and then I discovered the sqrt command. Generally you'll only want a square or cube, so you can mulvarvar 2-3 times. Much more and the int32s could overflow.
Helixhorned, on 19 September 2012 - 12:38 PM, said:
This reminds me: there are two things I have promised to add that will have to involve integer <--> float conversion for use in CON. One is a "rotatemodel" command which will be rotatesprite with additional model parameters such as pitch and roll added. The other is a userdef control for the ambient light level. Should I use the same mulscale implementation as the trig commands, use a numerator/denominator style, or something different? I like the fraction myself.