
EDuke32 Scripting "CON coding help"
#1795 Posted 21 December 2015 - 01:55 PM
Is this possible at all?
I've tried getplayer[THISACTOR].extra adding to that and then setting it, but even that wouldn't let me go over 100 health.
This post has been edited by Drek: 21 December 2015 - 01:57 PM
#1796 Posted 21 December 2015 - 02:29 PM
getplayer[THISACTOR].i temp setactor[temp].extra 200
Works for me.
Also, you can disable a sprite's hardcoded Polymer lights with SFLAG_NOLIGHT.
#1797 Posted 21 December 2015 - 02:59 PM
Drek, on 21 December 2015 - 01:55 PM, said:
You sure you wasn't using God Mode?
#1798 Posted 21 December 2015 - 03:19 PM
Hendricks266, on 21 December 2015 - 02:29 PM, said:
getplayer[THISACTOR].i temp setactor[temp].extra 200
Works for me.
Also, you can disable a sprite's hardcoded Polymer lights with SFLAG_NOLIGHT.
Thanks, I guess dealing with the setplayer command instead of the actor directly was the issue.
Fox, on 21 December 2015 - 02:59 PM, said:
Yeah, I did this...
getplayer[THISACTOR].extra temp addvar temp 2 setplayer[THISACTOR].extra temp
I knew the code would run because the pickup would disappear and the sound would play, but no health would be added over 100.
This post has been edited by Drek: 21 December 2015 - 03:19 PM
#1800 Posted 31 December 2015 - 03:23 AM
Setting the sprite's statnum to 1024 certainly does the trick - only it automatically destroys EVERY sprite in the same sector in one go and if one of those other sprites happens to be an enemy then it hangs Eduke !!
OK, in this instance setting the decorative sprite's cstat to 32768 is a viable alternative, but what is it about writing to statnum directly and if I did want to destroy an enemy how would I do that (assuming the enemy I want rid of is not THISACTOR so can't use killit) ?
TTFN,
Jon
#1801 Posted 31 December 2015 - 05:18 AM
#1802 Posted 31 December 2015 - 07:16 AM
edit; foxs answer was on the next page I didn't get to read... opps
This post has been edited by Drek: 31 December 2015 - 07:17 AM
#1803 Posted 31 December 2015 - 09:19 AM
Fox, on 31 December 2015 - 05:18 AM, said:
This doesn't really delete sprites, for example the Box (spritenum 951) vanishes but if an RPG subsequently lands nearby it still catches fire.
Works fine for enemies though, provided you manually adjust the kill count with addkills 1.
TTFN,
Jon
#1804 Posted 31 December 2015 - 10:08 AM
#1805 Posted 31 December 2015 - 11:39 AM
Trooper Dan, on 31 December 2015 - 10:08 AM, said:
Ah-ha ... I have a number of per-sprite vars which are actually only used by a few non-decorative sprites, so I could changespritestat 1, set one of these now spare vars to flag as "delete me" which I can then detect in EVENT_GAME. Cheers.
TTFN,
Jon
#1806 Posted 03 January 2016 - 11:16 AM
#1807 Posted 03 January 2016 - 12:17 PM
Trooper Dan, on 03 January 2016 - 11:16 AM, said:
'Course, we 'ad it 'ard, we used to live in't shoe box in middle of t'road. Kids these days don't know they're born.

One debug thing I'd really like to see is being able to output text in addlogvar; I'm using temp1, temp2, temp3 ... etc shared between loads of functions, would be nice if I could have:
addlogvar temp1 spriteId
with text "spriteId" written to logfile instead of text "temp1". When trying to debug something with 3 or 4 "temp" vars dumped out it can get a trifle confusing.
TTFN,
Jon
#1808 Posted 03 January 2016 - 12:34 PM
The first is within actual CON functions as it'd be nice to detect if user could be alerted if they are using an incompatible version. For example:
Quote
r5492 | hendricks266 | 2015-12-26 07:41:59 -0800 (Sat, 26 Dec 2015) | 3 lines
Add new spriteflag SFLAG_GREENSLIMEFOOD = 8388608, which controls whether GREENSLIME will eat a given actor.
The flag is automatically set on LIZTROOP, LIZMAN, PIGCOP, and NEWBEAST, .....
Excellent ! Now NEWBEASTHANGING can be made edible like it should have been in the first place. But if I make a map that relies on this feature then it'd be nice to find some way of warning the player e.g. if old version of eduke then automatically open a door sector which exposes wall with writing on that tells them they have the wrong version.
The other version detection that'd be nice is to only include a CON file if version >= some number is running as that'd allow libraries to be able to utilise newer features whilst remaining backwards compatible as it were.
TTFN,
Jon
#1809 Posted 03 January 2016 - 01:29 PM
You could always use EVENT_INIT and echo a quote with a required version string. However if it's something that will error out on older versions then I have no idea.
#1810 Posted 03 January 2016 - 04:47 PM
addvar sprite[THISACTOR].z 1024
A great deal of writing CON code involves getting struct members into variables and then manipulating those variables before putting them back into the structs. It makes for a lot of typing and it reduces readability.
#1811 Posted 04 January 2016 - 01:58 AM
Mblackwell, on 03 January 2016 - 01:29 PM, said:
Kinda what I wanted to
Trooper Dan, on 03 January 2016 - 04:47 PM, said:
addvar sprite[THISACTOR].z 1024
I could hazard a guess (and only a guess). Firstly it is an example of a read-modify-write operation of which I can't think of any others, everything seems to be a read or a modify or a write.
Secondly I suspect the original code may not be that well structured, why else would there be a need to use seperate "addvar" and "addvarvar" for example ?
But maybe something has changed - I noticed recently (r5499) that "set" can now be used to replace setvarvar, if it replaces setvar as well then excellent

Trooper Dan, on 03 January 2016 - 04:47 PM, said:
Totally agree. It would also save a few temp vars for me as I often find I end up loading struct members into temp vars at start of a function as they get used in multiple paths of the code.
TTFN,
Jon
#1812 Posted 04 January 2016 - 02:24 AM
Trooper Dan, on 03 January 2016 - 04:47 PM, said:
addvar sprite[THISACTOR].z 1024
A great deal of writing CON code involves getting struct members into variables and then manipulating those variables before putting them back into the structs. It makes for a lot of typing and it reduces readability.
Because it would be better to use Lua instead of rewriting the entire CON language to become more useful.
This post has been edited by Fox: 04 January 2016 - 02:24 AM
#1813 Posted 04 January 2016 - 08:50 PM
Trooper Dan, on 03 January 2016 - 04:47 PM, said:
addvar sprite[THISACTOR].z 1024
It has to do with how we represent parameters in bytecode when we parse the CONs. We no longer think it would be prohibitively difficult, but instead a matter subject to cost/benefit analysis on our development time--something which is starting to tilt toward benefit thanks to the Bombshell prequel!
The Mechanic, on 04 January 2016 - 01:58 AM, said:

Yes!
#1814 Posted 04 January 2016 - 09:23 PM
The Mechanic, on 04 January 2016 - 01:58 AM, said:

Check out the list in the latest gamedef.c under "const tokenmap_t altkeyw"
#1815 Posted 09 January 2016 - 10:29 PM
Like when you shoot a mob that moves or you don't perfectly point at it, you will still hit it with your weapon.
#1817 Posted 09 January 2016 - 10:41 PM
Actors and user actor as long it has "enemy"
Not notenemy?
This post has been edited by Zaxtor: 09 January 2016 - 10:42 PM
#1818 Posted 09 January 2016 - 11:02 PM
Actors and Useractors as long as they are "enemy" type.
#1819 Posted 15 January 2016 - 10:40 AM
That makes floor and ceiling blockable, unblockable etc (good for tror etc)
But is there a version for walls , especially redlines wall.
Like making a redline wall blockable, unblockable etc.
Example we put the number of the line so it doesn't change all redlines in the sector.
Only let say wall 9510 that I wanna block or unblock?
#1820 Posted 15 January 2016 - 10:51 AM
Zaxtor, on 15 January 2016 - 10:40 AM, said:
That makes floor and ceiling blockable, unblockable etc (good for tror etc)
But is there a version for walls , especially redlines wall.
http://wiki.eduke32....Cstat%28wall%29
#1821 Posted 15 January 2016 - 11:23 AM
Trooper Dan, on 15 January 2016 - 10:51 AM, said:
I saw that but do I use it the same as the ceiling and floor?
#1822 Posted 15 January 2016 - 01:07 PM
#1823 Posted 15 January 2016 - 03:45 PM
Fox, on 15 January 2016 - 01:07 PM, said:
How we identify the wall's number since a sector has 3 walls and up.
So we don't "block all 3 walls at once"
cstat I wanna use is block and is 1 according to the site.
1 just like everything else.
When I use "setwall[THISACTOR].cstat 1"
nothing happens at all.