Two Questions[SOLVED]

Io

Question 1: Speaking To named characters. So let's say I create a character called DwarfTest, and he's Male(named). That means under Object, Display verbs, I can both Look At and Speak To him by default.

My problem is, whenever I use the generic Speak To, all I get is He/She/It says nothing. If I want my own custom dialogue, I have to delete Speak To and create my own custom Speak To under the Verbs tab. What I want to know is if I can manipulate the generic Speak To somehow, because I can't find anything that'd let me.

Question 2: Making verbs visible/usable versus invisible/unusable. So let's say I have a spaceship game. In my game I'm piloting a space ship, and I come across planets. These planets I randomly generate using a PlanetBase object stuck in a debugroom. I understand how to make the planets random.

In this example, I want my spaceship to be able to Land On planets that have Inhabited=True, but not Land On planets that have Inhabited=False. Not only that, I don't even want the OPTION to Land On planets that have Inhabited=False. How do I both hide this variable AND keep it from being manually accessed by typing it in? I can't find anything that might let me hide variables. Maybe I'm just overlooking something obvious.

I am using 5.7.2, any help is appreciated.


If I want my own custom dialogue, I have to delete Speak To and create my own custom Speak To under the Verbs tab. What I want to know is if I can manipulate the generic Speak To somehow, because I can't find anything that'd let me.

I can't type worth anything while recording my screen for some reason, but this should fix you up regardless:


I want my spaceship to be able to Land On planets that have Inhabited=True, but not Land On planets that have Inhabited=False. Not only that, I don't even want the OPTION to Land On planets that have Inhabited=False. How do I both hide this variable AND keep it from being manually accessed by typing it in?

When you clone PlanetBase:

If the clone is not inhabited, try adding this line to the code (REVISED):

new_clone.landon = null
new_clone.generatedverbslist = new_clone.generatedverbslist - "Land on"

This assumes you're cloning the object like this (using any variation of CloneObject):

new_clone = CloneObject(PlanetBase)
new_clone.Inhabited = false

It also assumes that your "Land On" verb is actually named landon.

If you post your cloning script, we can get more specific.


Io

Originally I used

set (PlanetBase, "alias", "Nonlandable")
set (PlanetBase, "Inhabited", False)
CloneObjectAndMove (PlanetBase, IntroRoom)
set (PlanetBase, "alias", "Landable")
set (PlanetBase, "Inhabited", True)
CloneObjectAndMove (PlanetBase, IntroRoom)

With the verb landon "Land On" being

if (this.Inhabited=True) {
  msg ("You land.")
}
else {
 msg ("You can't land, but this shouldn't even fire.")
}

The new_clone.landon doesn't work. It works if I do

set (PlanetBase, "landon", null)

But trying to use new_clone.landon = null gets me the error:

Error running script: Error compiling expression 'new_clone': Unknown object or variable 'new_clone'

This 'generated verbs list' looks useful, though. But it doesn't seem to be a default attribute. Do I need to add it in?


Io

Also, this seems to 'kill' landon permanently. If I want to create a planet that can be landed on, I can't, because the method I'm using kills landon at the parent. But the new_clone code isn't working for me either.


Io

Wait, I've got it. I can use foreach to filter for planet clones after the fact and kill landon there.

foreach (obj, FilterByAttribute(GetDirectChildren(IntroRoom),"prototype",PlanetBase)) {
  if (obj.Inhabited=False) {
    set (obj, "landon", null)
  }
}

The new_clone.landon doesn't work.

That's because you aren't cloning your objects the way I was assuming your were. (I did provide an example to illustrate, in my defense.)

You don't use the new_clone variable to clone any objects. In your code, new_clone does not exist.


Let's say you first create the object PlanetBase

You set "Inhabited" to true. You set up the landon verb. And you make the alias "Landable".

From that point, you could just:

// The first clone can be landed on, so we do nothing but clone it:
new_clone = CloneObjectAndMove (PlanetBase, IntroRoom)

// The second clone can NOT be landed on, so we change things:
new_clone = CloneObjectAndMove (PlanetBase, IntroRoom)
set (new_clone, "alias" "Nonlandable")
set (new_clone, "Inhabited", false)
set (new_clone, "landon", null)
new_clone.generatedverbslist = new_clone.generatedverbslist - "Land on"

this seems to 'kill' landon permanently

That's because you made the landon verb on the main object null.

The landon verb on the clone is what needs to be set to null (which deletes the attribute).


This 'generated verbs list' looks useful, though. But it doesn't seem to be a default attribute.

It does not exist until play begins.

Quest looks through all the objects, and, if you have added verbs to an object, it generates generatedverbslist for that object.

Do I need to add it in?

Negative.


I can use foreach to filter for planet clones after the fact and kill landon there.

Heck yeah!

Look at you go!

That does what I was doing, just at a different time in the code.

If the "Land on" verb still shows up on uninhabited planets, change it to this:


foreach (obj, FilterByAttribute(GetDirectChildren(IntroRoom),"prototype",PlanetBase)) {
  if (obj.Inhabited=False) {
    set (obj, "landon", null)
    obj.generatedverbslist = ListExclude(obj.generatedverbslist, "Land on")
  }
}


Sorry, you can't post that here. <-- INCORRECT!!!


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums