Duke4.net Forums: EDuke32 Scripting - Duke4.net Forums

Jump to content

  • 117 Pages +
  • « First
  • 59
  • 60
  • 61
  • 62
  • 63
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1801

Don't set the statnum to 1024, that's asking for problems. You can delete other sprites by setting their x/yrepeat to zero. It doesn't work with certain sprites such as projectiles, but it should do the job with decorative sprites or enemies.
2

User is offline   Kyanos 

#1802

early morning answer is to try sizeat 0 0


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

0

#1803

 Fox, on 31 December 2015 - 05:18 AM, said:

Don't set the statnum to 1024, that's asking for problems. You can delete other sprites by setting their x/yrepeat to zero. It doesn't work with certain sprites such as projectiles, but it should do the job with decorative sprites or enemies.


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
0

User is offline   Danukem 

  • Duke Plus Developer

#1804

First, I would change the sprite's statnum to 1 (make it an actor). Use the changespritestat command for that so that the linked lists of statnums is updated. Now that the sprite is statnum 1, it will run actor code in EVENT_GAME or if you have it defined as an actor and you can use the killit command on it. Or, changing its size to 0 0 might actually delete it at that point.
1

#1805

 Trooper Dan, on 31 December 2015 - 10:08 AM, said:

First, I would change the sprite's statnum to 1 (make it an actor). Use the changespritestat command for that so that the linked lists of statnums is updated. Now that the sprite is statnum 1, it will run actor code in EVENT_GAME or if you have it defined as an actor and you can use the killit command on it. Or, changing its size to 0 0 might actually delete it at that point.


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
0

User is offline   Danukem 

  • Duke Plus Developer

#1806

I changed a line of code and it introduced a divide by zero error in a distant part of the code (a value that couldn't have been zero before now could be). The compiler of course tells me exactly which line of code was trying to divide by zero...and it made me remember a darker time. It was about 8 years ago that a forum member named Hunter_Rus introduced the feature whereby the compiler actually tells you what line of code is fucking up. Before then, you would get an error or warning but you had no idea where in the code it happened. Debugging was so much harder back then.
1

#1807

 Trooper Dan, on 03 January 2016 - 11:16 AM, said:

Before then, you would get an error or warning but you had no idea where in the code it happened. Debugging was so much harder back then.


'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. :thumbsup:

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
1

#1808

Is it possible to detect the version of eduke that is running ? There are two types of detection I'd like.

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
1

User is offline   Mblackwell 

  • Evil Overlord

#1809

There used to be a command "enhanced", but it's not functional anymore.

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.
0

User is offline   Danukem 

  • Duke Plus Developer

#1810

I know this was covered a long time ago, but could someone explain why it would be prohibitively difficult to enhance CON language so that we can do things like this:

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.
2

#1811

 Mblackwell, on 03 January 2016 - 01:29 PM, said:

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.


Kinda what I wanted to hear read. What I mean is it confirms I haven't missed something in the documentation.

 Trooper Dan, on 03 January 2016 - 04:47 PM, said:

I know this was covered a long time ago, but could someone explain why it would be prohibitively difficult to enhance CON language so that we can do things like this:

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 :thumbsup: (about 1/3rd of my errors these days is using e.g. xxxvar instead of xxxvarvar). It was one of the things that prompted my previous question about being able include a CON file if above a certain version.

 Trooper Dan, on 03 January 2016 - 04:47 PM, said:

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.


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
1

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1812

 Trooper Dan, on 03 January 2016 - 04:47 PM, said:

I know this was covered a long time ago, but could someone explain why it would be prohibitively difficult to enhance CON language so that we can do things like this:

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

1

User is offline   Hendricks266 

  • Weaponized Autism

  #1813

 Trooper Dan, on 03 January 2016 - 04:47 PM, said:

I know this was covered a long time ago, but could someone explain why it would be prohibitively difficult to enhance CON language so that we can do things like this:

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:

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 :thumbsup:

Yes!
2

User is offline   Danukem 

  • Duke Plus Developer

#1814

 The Mechanic, on 04 January 2016 - 01:58 AM, said:

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 :thumbsup:


Check out the list in the latest gamedef.c under "const tokenmap_t altkeyw"
0

User is offline   Zaxtor 

#1815

What is the code again for "Auto aiming/target"
Like when you shoot a mob that moves or you don't perfectly point at it, you will still hit it with your weapon.
0

User is offline   Mblackwell 

  • Evil Overlord

#1816

Afaik any actor flagged as an enemy will get autoaimed at.
0

User is offline   Zaxtor 

#1817

works only on actors or
Actors and user actor as long it has "enemy"
Not notenemy?

This post has been edited by Zaxtor: 09 January 2016 - 10:42 PM

0

User is offline   Mblackwell 

  • Evil Overlord

#1818

Correct

Actors and Useractors as long as they are "enemy" type.
0

User is offline   Zaxtor 

#1819

You know we have setsector[THISACTOR].floorstat xxx and setsector[THISACTOR].ceilingstat xxx
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?
0

User is offline   Danukem 

  • Duke Plus Developer

#1820

 Zaxtor, on 15 January 2016 - 10:40 AM, said:

You know we have setsector[THISACTOR].floorstat xxx and setsector[THISACTOR].ceilingstat xxx
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
0

User is offline   Zaxtor 

#1821

 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?
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1822

Cstat is available for both floor/ceiling and walls, but they use different values.
0

User is offline   Zaxtor 

#1823

 Fox, on 15 January 2016 - 01:07 PM, said:

Cstat is available for both floor/ceiling and walls, but they use different values.


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.
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1824

That's because THISACTOR has no use in setwall. It equals the ID of the current actor or player running the code. You have to find the ID of a specific wall.
0

User is offline   Zaxtor 

#1825

 Fox, on 15 January 2016 - 03:54 PM, said:

That's because THISACTOR has no use in setwall. It equals the ID of the current actor or player running the code. You have to find the ID of a specific wall.

Ok

btw
I know the wall's ID but I am sure is not setwall[14299].cstat 1

(14299 is the wall's ID / number)

This post has been edited by Zaxtor: 15 January 2016 - 04:11 PM

0

User is offline   Mblackwell 

  • Evil Overlord

#1826

It would be exactly that actually.
0

User is offline   Zaxtor 

#1827

I'll pass
I'm way too confused

This post has been edited by Zaxtor: 15 January 2016 - 05:36 PM

0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1828

 Mblackwell, on 15 January 2016 - 05:33 PM, said:

It would be exactly that actually.

If I recall it correctly, [] only accepts variables. For a good reason...
0

#1829

When Duke's path is blocked he often grunts or spurts out "Where is it?". Now, I have an object - a custom switch - which of course could block Duke. So, you press my custom switch and it operates fine but duke still grunts. What is the correct way to stop this happening ?

Initially what I tried was setting a flag when switch was pressed and in EVENT_SOUND checking if flag was set and grunt sound was being attempted and blocking it. Unfortunately, the code that decides Duke's path is blocked and plays the relevant sound occurs BEFORE event game and hence before I can set my flag. D'oh!

So, as a workaround, in the undocumented EVENT_WORLD I set a count to zero, then in EVENT_GAME if any of my blocking objects is within 1024 units of player then I increment the count. Then in EVENT_SOUND only allow grunts if count is zero. Hack ! (If I *want* to make the duke grunt sound, I set the counter to -30000 ... hack-squared!)

Now, if in mapster I set my switch as non-blocking then Duke never grunted. Strangely, if I set it to blocking but switched off blocking during initiaisation then Duke _did_ grunt. Suggests there is some statusy thing somewhere I need to set on my objects (it 'aint statnum, I checked).

Any ideas ?

TTFN,
Jon
0

#1830

 Zaxtor, on 15 January 2016 - 10:40 AM, said:

You know we have setsector[THISACTOR].floorstat xxx and setsector[THISACTOR].ceilingstat xxx
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?


If you want to target a particular wall - I'm assuming it is in THISACTOR's sector - try making the wall the first wall of a sector. Then do something like the following (assumes you have a global gamevars "temp1" and "temp2"

getsector[THISACTOR].wallptr temp1   // = firstwall
getwall[temp1].cstat temp2
orvar temp2 1
setwall[temp1].cstat temp2


TTFN,
Jon
0

Share this topic:


  • 117 Pages +
  • « First
  • 59
  • 60
  • 61
  • 62
  • 63
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic


All copyrights and trademarks not owned by Voidpoint, LLC are the sole property of their respective owners. Play Ion Fury! ;) © Voidpoint, LLC

Enter your sign in name and password


Sign in options