"Create" problem

tvisarl
12 Jul 2016, 12:58

Sorry for the preceding post. My mistake. I would delete it if I knew how to do it.

Actually, my question is this : I can't figure out how "create" and "GetObject" work together.

If I say :
create ("zut", "whatever")

zut = GetObject ("something")

then Quest ALWAYS answers that zut isn't an object. Can you help?

Sorry again for my mistake,
Thierry


Pertex
12 Jul 2016, 14:05

create ("zut")
zut = GetObject ("apple")

works fine for me (if an object apple exists).
But you don't need to create an object when you use GetObject afterwards. just

zut = GetObject ("something")


The Pixie
12 Jul 2016, 14:53

The create command makes an object with the given name (and of the type "whatever"), so you need to use that name to get the object.

create ("zut", "whatever")
obj = GetObject ("zut")

Now the variable obj holds the new object, which has the name "zut" and is of type "whatever".


tvisarl
12 Jul 2016, 15:31

Thanks to you both.
Problem solved, but this forum's format has changed completely and I no longer know how to use attachments or even how to search the forum.
Out of sheer curiosity now, another question: when you add an object to an ObjectList, what does the list actually contain? Duplicates of the objects or just pointers to the originals?
Sorry for the nuisance.
Thierry


hegemonkhan
12 Jul 2016, 18:15

Lists do NOT contain the actual-('physical') Objects, just their names (references), which you can thus then act upon though. Think of Lists as like a PE (physical education / exercise) school class coach'/teacher's student roster, having the names of the students, but those students aren't actually on that student roster paper (lol). However, the PE coach/teacher, can use that student roster to bark orders to those students.

for example:

<game name="example">
  <attr name="start" type="script">
    foreach (character_variable, global_data_object) {
      msg (character_variable.greeting_string_attribute)
    }
  </attr>
</game>

<object name="room">
  <object name="player">
    <attr name="greeting_string_attribute" type="string">Hi, my name is player.</attr>
  </object>
  <object name=""HK">
    <attr name="greeting_string_attribute" type="string">Hi, my name is Hegemon Khan, but you can call me hk for short.</attr>
  </object>
  <object name="Thierry">
    <attr name="greeting_string_attribute" type="string">Bonjour, my name is Thierry.</attr>
  </object>
</object>

<object name="global_data_object">
  <attr name="playable_character_objectlist_attribute" type="objectlist">player;HK;Thierry</attr>
</object>

the 'player', 'HK', and 'Thierry' Player Objects are 'physically' located in 'room' Room Object, but they can be acted upon (in this example, displaying/messaging their 'greeting_string_attribute' String Attribute), via using the 'playable_character_objectlist_attribute' Objectlist Attribute of the 'global_data_object' Object.


Jay Nabonne
13 Jul 2016, 06:30

Just to be clear, object references are not their names (which are strings) but rather an internal reference type. :) (Don't you just love overloaded terms?)


Jay Nabonne
13 Jul 2016, 06:34

(I just realized these new forums don't have smileys...)


bergedorfcacher
13 Jul 2016, 06:55

Let's hope there are still some people who can interpret smileys without them being translated into cute little pictures before! :-))


hegemonkhan
13 Jul 2016, 13:30

Thank you, again, for more insight into how quest is (internally) programmed, Jay!

<object name="player">
</object>

String Attribute: player.name // it's (String) Value is: "player" // player.name = "player"
Object Reference: player

is this correct? or are the Object References only existing with/for Objectlist Attributes and Object Attributes and as Arguments/Parameters for Functions/Commands/Delegates/etc?

No term is more 'overloaded' than....

type

arg... this term is used for like everything... laughs.


The Pixie
13 Jul 2016, 13:53

This is true. I have learnt to my cost never to name anything "type", be it a class, a database column, a variable, etc. because of the risk that something is already using that word.

And "sort" is not a good alternative...


Alex Warren
13 Jul 2016, 13:59

So true. I definitely made some bad naming choices! As they say, naming is hard.

Using the word "type" less is something I'll be bearing in mind for QuestKit.

Also @Jay, these days smileys are built in to Unicode 😀 👻 👑🐻 - most modern OSes have some kind of emoji picker, so there's no need to build additional features to support them in the forums. (phpBB is old)


hegemonkhan
13 Jul 2016, 15:54

it's not just quest's programming, Alex. I use too many 'type' labels: 'eye_type', 'hair_type', 'body_type', 'weapon_type', etc etc etc, lol.
(I need to get a thesaurus, and look up similes for 'type', laughs)

unfortunately, 'type', is just a so universally descriptive label/word... it's like "stuff" or "thing"...

(I don't ever have a problem with accidentally over-riding anything, due to my convention of using very descriptive, aka long/verbose, names/labels, laughs. I also don't use the conventional camel-case and etc forms, as I have trouble with uppercase and lower case, and have a hard time reading the name/label too, having the underscores being as close as I can get to spaces, really makes it easier to read for me. I don't know why, but I just have a hard time reading these, for example: HegemonKhan and hegemonKhan, vs easy to read: hegemon_khan)