Not logged inOpenClonk Forum
Up Topic C4Script for everything

This board is threaded (i.e. has a tree structure). Please use the Reply button of the specific post you are referring to, not just any random button. If you want to reply to the topic in general, use the Post button near the top and bottom of the page.

Post Reply
In Response to Newton

>It's a simple map of strings to c4values


What's with for example vertex lists? What C4Value type whould that be? Is there a way to initialize arrays like this = {1,2,3,4} already? Otherwise I can't see how this can work.

>- C4Objects and C4Defs inherit from C4Proplist, and every object needs to have a proplist which is a C4Def in it's prototype chain


1. Do you think the prefix C4 for those is razonable?
2. How does inheriting work? Would it be possible to have objects which do not inherit from C4Object/C4Def, which one can not create in the game but use for inheritance? (-> Svens OOP suggestion)

>- C4IDs are replaced by (pointers to) proplists


How does this look like?

>How should the C4Script integration look like


How about this. All properties are set as static constants (with a prefix):

object Rock : C4Object {

// override standard definition set
// default values have been defined in C4Object
// this would require that one can redefine static (constants) in inherited objects
static defWeight = 10;
static defWidth = 5;
static defHeight = 5;

// new values like defIsWeapon could be added easily:
static defIsWeapon = true;

func Hit() {
  // access is as easy:
  if(defWeight > 5) { ... }
  // access to defs of other objects is easy
  if(CLNK::defWeight < defWeight) { ... }
}

};


Why like this? Because I don't see a reason why engine-used properties should be seperated from user-used properties in their syntax. And, I think this is the easiest and most intuitive way. Of course there would be no proplist then. Actions would have to be defined as actual maps like

static actWalk = {
Procedure = WALK,
FacetBase = 1,
Delay = 1,
...
};


, set by SetAction(actWalk) and accessed like C4ID::actWalk.Procedure

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill