Duke4.net Forums: making con coding easier - Duke4.net Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

making con coding easier

User is online   Mark 

#1

I was browsing the con Wiki and had a thought pop into my head. (amazing )
Example:
findnearactor PIGCOP 2048 TEMP
ifvarn TEMP -1
{
getactor[TEMP].x MX
getactor[TEMP].y MY
getactor[THISACTOR].x x
getactor[THISACTOR].y y
subvarvar MX x
subvarvar MY y
getangle ANGVAR MX MY
setactor[THISACTOR].ang ANGVAR
}

Would it be feasible to somehow add the body of that code to eduke32 itself so that all the coder has to enter inside the actor code is "findnearactor PIGCOP 2048" ? There may be many more examples but I haven't thought this thru very far.
0

User is online   Danukem 

  • Duke Plus Developer

#2

Typically you DON'T want to turn to face a sprite just because you confirmed it was within a certain distance. In a real project, you could have defined states that contain the script needed to face an actor and do various other things, so you wouldn't be presented with code like that above when browsing through an actor. The purpose of having an example like that in the wiki is to show how to use the various commands. To be honest there are too many primitives in the language already, and a lot of them are kept around for backwards compatibility with old projects.

What you actually want, Mark, is a library of different states (functions) that perform common tasks. Those of us who have been scripting in CON for a long time each have our own libraries in effect (because we copy and past general purpose code from one project to another), but no one has tried to make an official library that I know of.
0

User is offline   Sangman 

#3

I've had the idea in my head for some time of making a CON-focussed development environment - standard libraries could be a part of that... As well as better warnings and compile errors while typing and such.
Would probably be a cool project but I dunno if the audience is large enough (plus I don't really know enough about CON coding myself to make it airtight)
0

User is online   Mark 

#4

Yep, I see your point Dan. A collection of states sounds useful. Maybe thats what I should try when I decide to get off my butt and do something with all those snippets of code I have gathered over the years.

This post has been edited by Mark: 06 May 2020 - 02:37 PM

0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#5

View PostMark, on 06 May 2020 - 09:35 AM, said:

Would it be feasible to somehow add the body of that code to eduke32 itself so that all the coder has to enter inside the actor code is "findnearactor PIGCOP 2048" ?

That's possible.

But there's no point, since it would only limit your options.
0

User is online   Mark 

#6

I mentioned I didn't think it thru. I see now why it isn't a great idea.
0

User is offline   Ninety-Six 

#7

I wonder if the idea couldn't be adapted to make it sort of a way for someone to get their feet wet with CON scripts. Sure, the result may be more limiting, but for entry-level changes there might be some worth until a person is comfortable enough to move on to the more advanced and less restrictive full script.
0

User is online   Danukem 

  • Duke Plus Developer

#8

View PostNinety-Six, on 07 May 2020 - 01:54 PM, said:

I wonder if the idea couldn't be adapted to make it sort of a way for someone to get their feet wet with CON scripts. Sure, the result may be more limiting, but for entry-level changes there might be some worth until a person is comfortable enough to move on to the more advanced and less restrictive full script.


That already exists, and I call it "CON classic" AKA CON script from Duke 1.3D back in '96. All those commands still work in EDuke32. For people who want to get started and don't have any programming experience, playing around with the original GAME.CON and looking at this old guide is still a good method.
2

User is online   Mark 

#9

Yep. I consulted that FAQ a lot when first starting to code.
0

User is offline   Jimmy 

  • Let's go Brandon!

#10

Dan is right. If you can't do classic level coding, you won't have a snowball's chance in Hell with the EDuke32 level of coding.
0

Share this topic:


Page 1 of 1
  • 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