Mr. Gorbachev, tear down this wall...

Forgewright
Walls, floor, ceilings are everywhere in a room. I have a room filled with many rooms. If the player wants to look at the walls in one room and all the walls are pretty much the same, I can put an object called walls in the game branch of the tree instead of every room and let the same description be used everywhere. Ahh, but how do I call the description for walls when the player 'looks' at them?

I'm speaking GUI here guys.I'm thinking a "Get input" and then an "if result = walls" script. Does the result have to be "look at walls" exactly or would "climb walls" bring the same description as "Look at walls" if I use this method. I saw this discussion somewhere before but when I search I get to many results and am told to narrow my search.

What say ye?

HegemonKhan
see here, as this is probably the best way of doing it:

viewtopic.php?f=18&t=5178

ask if you need any help or got any questions.

Forgewright
That's the post I saw HegemonKhan. Just have to be careful to only place objects in the parent room that are in the child rooms be cause if I had say, lava in the parent room and not in all the child rooms a certain anal player would want to type " look at lava" and would get the description even though lava was not in the child room. Then again this could be solved by an "If player.parent = " script.

Thanks for the guidance.

Forgewright
when I set up the transparent rooms, the walls are shown as a visible object. if i set the walls to not visible then you can't "look' at them. I don't want the walls to show but if the "sneaky" player wants to look at them anyway, they should be able to look at them. If I set the scenery attribute to false in a when "entering room" script then the game freezes and is forced to shut down. I have worked on this all day and failed to find a usable code. It's really more about learning code than it is making the game right now so any help would...ahh... help.

Solved

HegemonKhan
congrats! what was the issue(s) and how did you solve it(them) ???

Forgewright
I am not 100% on this but I believe the "Visible" and "Scenery" boxes need to be checked on the 'Setup" tab of every room within the parent room. Also, on the 'Game Start" script for entering a room I set the player.parent attribute "transparent' to true. Then added 'transparent to each rooms attributes and set to false. This way as I went from room to room I could always see the description for the Walls, ceiling and floor objects I added to the main parent room of all the other rooms if I "looked" at them. Upon leaving the child rooms the Transparent would be set back to false.

Now I went a little crazy on a test game for this and added sand to the "floor" object, after all, after years of orcs traveling over the stone floor I'm sure they would have ground out some sand. I can see the sand when I "Look at sand" but get a weird error when I want to "take the sand".
sandtakeerror.PNG


I have no clue where to find where this error is referencing. I know I don't have to "take the sand but like I said before it's about being able to code it if I want it. I know the sand is visible but out of reach so I made a script on the "ontake" attribute for sand and had it cloned and moved to the player which I narrowed this change as the cause of the error. And I get no action from the script just the error.

Is "moving" something to the player the same as putting it in inventory?

The Pixie
Go into code via the tools menu, and do a search (CTRL-F) for:

HasString(obj, "alias")

That is where the error is. If you can post the lines of code around that, we could have a look as to why it is happening (though it looks like obj does not hold a value).

If you cannot find that string in your game, it is probably in a library. In that case, could you post your whole game?

Incidentally, if you paste error messages as text rather than an image it will be easier for us to copy text out of it and allow others uses to find it in a search if they have a similar error message.

Is "moving" something to the player the same as putting it in inventory?


Yes.

jaynabonne
Many times, the error you see will be when running code deeper in the Quest engine, so you might not be able to find it in your game source as such. (For example, I doubt you're directly checking obj.gender). It might be your code, but it also might not - just keep that in mind. In particular, the first expression mentioned in your error can be found in the Quest function "GetDisplayAlias".

What the errors are indicating is that code is being called with null instead of a valid object. Given the words "not open" at the end, I suspect it's running this dynamic template:

<dynamictemplate name="ObjectNotOpen">CapFirst(GetDisplayAlias(object)) + " " + Conjugate(object, "be") + " not open."</dynamictemplate>

You'll get the first part of your error in GetDisplayAlias and the second part (about obj.gender) in Conjugate.

That template is used in "DoTake" when the object is not "reachable". There is this bit of code in DoTake:

    else if (not ListContains(ScopeReachable(), object)) {
msg (prefix + DynamicTemplate("ObjectNotOpen", GetBlockingObject(object)))
}

The object is probably not reachable, but GetBlockingObject is returning null, which is mucking up the error message. This is likely a bug in Quest's handling of "take" with things that can't be taken in some cases, but without some code to run directly, I can't be sure. If you could provide more details, I could try to reproduce it.

Unfortunately, Quest does all this processing before seeing if the object can even be taken. Even if you change the parent objects so that the errors don't happen, the player would still be given some message like "XXX is not open", which makes no sense.

If this is a big enough problem for yo, I could try to provide a patched DoTake with a fix.

Forgewright
Ok, post errors as text not images. Check! But I am unable to highlight and copy text from the running game. so I'll have to not be lazy and write it out in notepad. lol

I recreated the error in a small copy of the game.

I don't think you will need the sub-files.

Heres the code....
<!--Saved by Quest 5.6.5621.18142-->
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Redemption2">
<gameid>2b866ef5-3b7b-4948-8315-fa53a8d86c8f</gameid>
<version>1.0</version>
<firstpublished>2015</firstpublished>
<showtitle type="boolean">false</showtitle>
<attr name="feature_pictureframe" type="boolean">false</attr>
<multiplecommands />
<command_newline />
<defaultfontsize type="int">14</defaultfontsize>
<appendobjectdescription />
<autodescription />
<attr name="autodescription_youarein_useprefix" type="boolean">false</attr>
<pov type="object">player</pov>
<start type="script"><![CDATA[
picture ("GargoyleComp0027.jpg")
msg ("You are quite an intimadating creature brought to earth from Hell by a mage wanting to gain control of the country of Bristol. He was once a High Mage of the King's court but after defying the King he was sentenced to death but escaped. His powers have grown after accepting the blessing of the evil Goddess Hessis. <br/><br/>You are bound by the evil that corrupts this mage, Karnuke, and he will stop at nothing to exact his revenge upon the people of Bristol. Your own evil is being tested after your exploration of the areas surrounding Mount Mormont. Something inside you has changed. Something inside you wants out....<br/><br/>")
]]></start>
<roomenter type="script">
set (player.parent, "transparent", true)
</roomenter>
</game>
<command>
<pattern>land</pattern>
<script>
if (not IsSwitchedOn(player)) {
msg ("You are not flying...")
ShowRoomDescription
}
else {
msg ("You pull in your wings and land...")
SwitchOff (player)
stop sound
play sound ("146977__jwmalahy__desk-thud.wav", true, false)
set (player, "You are", "walking")
ShowRoomDescription
}
</script>
</command>
<command>
<pattern>fly</pattern>
<script><![CDATA[
if (not IsSwitchedOn(player)) {
play sound ("244982__ani-music__wing-flap-flag-flapping-5a.wav", false, true)
SwitchOn (player)
msg ("<br/>You spread your wings and take flight.")
ShowRoomDescription
set (player, "You are", "flying")
EnableTurnScript (flyingturncounter)
player.attackbonus = player.attackbonus + 8
player.damagebonus = player.damagebonus + 8
player.agility = player.agility + 8
player.defence = player.defence * 2
}
else {
msg ("<br/>Hear that flapping sound. It's a pretty good indicator that your ass is flying.")
ShowRoomDescription
}
]]></script>
</command>
<command>
<pattern>turn</pattern>
<script>
if (IsSwitchedOn(player)) {
msg ("Let's just agree that turning to stone while flying is not your best option.....")
}
else if (player.turn = "Stone") {
msg ("You turn back to flesh.")
set (player, "turn", "Stone")
play sound ("Reverse-SoundBible.com-643522429.wav", true, false)
}
else if (player.turn = "Flesh") {
msg ("You turn to stone.")
set (player, "turn", "Stone")
play sound ("Reverse-SoundBible.com-643522429.wav", false, false)
transform
}
</script>
</command>
<object name="Bristol">
<inherit name="container_open" />
<alias>Bristol</alias>
<descprefix type="string"></descprefix>
<attr name="feature_container" type="boolean">false</attr>
<open type="boolean">false</open>
<close type="boolean">false</close>
<scenery />
<displayverbs type="stringlist">
<value>Look at</value>
</displayverbs>
<object name="Mount Mormont">
<inherit name="container_open" />
<alias>Mount Mormont</alias>
<attr name="feature_container" type="boolean">false</attr>
<open type="boolean">false</open>
<close type="boolean">false</close>
<scenery />
<displayverbs type="stringlist">
<value>Look at</value>
</displayverbs>
<usestandardverblist />
<object name="Floor">
<inherit name="surface" />
<inherit name="editor_object" />
<scenery />
<alias>Floor</alias>
<look>The floor has a layer of sand and dirt which has been ground by passing orcs and other creatures that are held here by Karnuke, the evil mage.</look>
<transparent />
<feature_container />
<open />
<close type="boolean">false</close>
<displayverbs type="stringlist">
<value>Look at</value>
</displayverbs>
<usestandardverblist />
<hidechildren type="boolean">false</hidechildren>
<object name="Sand">
<inherit name="editor_object" />
<scenery />
<alt type="stringlist">
<value>dirt</value>
</alt>
<usestandardverblist type="boolean">false</usestandardverblist>
<look>Looks like sand with some dirt mixed in.....</look>
<takemsg>Ok, you scoop up some sand and carry it with you</takemsg>
<alias>sand</alias>
<ontake type="script">
CloneObjectAndMove (Sand, player)
</ontake>
<take />
</object>
<object name="Cave">
<inherit name="container_open" />
<transparent />
<descprefix type="string"></descprefix>
<usedefaultprefix />
<scenery />
<alias>Cave</alias>
<attr name="feature_container" type="boolean">false</attr>
<open type="boolean">false</open>
<close type="boolean">false</close>
<displayverbs type="stringlist">
<value>Look at</value>
</displayverbs>
<usestandardverblist />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
<inherit name="switchable" />
<inherit name="namedmale" />
<turn>Flesh</turn>
<hitpoints type="int">30</hitpoints>
<feature_switchable />
<switchonmsg>"You spread your wings and begin to fly."</switchonmsg>
<switchoffmsg>"You pull in your wings and glide to a landing.</switchoffmsg>
<usedefaultprefix type="boolean">false</usedefaultprefix>
<alias>Eanatas</alias>
<look>A vicious demon from Hell. You are aligned within the fire elements, giving you an advantage over others whom are susceptable to fire and making you a more resistant to fire attacks. Flying or turning to stone will give you advantages as well.</look>
<drop type="boolean">false</drop>
</object>
</object>
<object name="Ceiling">
<inherit name="editor_object" />
<scenery />
<look>The ceiling arches from wall to wall. There are roots that break though here and there, no doubt from the few mighty trees that grow on the suface of Mount Mormont.</look>
<alias>Ceiling</alias>
<displayverbs type="stringlist">
<value>Look at</value>
</displayverbs>
<usestandardverblist />
<object name="roots">
<inherit name="editor_object" />
</object>
</object>
<object name="Walls">
<inherit name="editor_object" />
<inherit name="surface" />
<alt type="stringlist">
<value>wall</value>
</alt>
<displayverbs type="stringlist">
<value>Look at</value>
</displayverbs>
<look>The walls are carved from the stone mountain. They are gray and curve outward from the floor and arch back into the ceiling.</look>
<drop type="boolean">false</drop>
<inroomdescription type="string"></inroomdescription>
<visible />
<scenery />
<alias>walls</alias>
<usestandardverblist type="boolean">false</usestandardverblist>
<feature_container />
</object>
</object>
</object>
</object>
</asl>


Some of the commands don't work yet. Some attributes are missing. I was just pulling some things out of the original game so I could work on the coding error.

jaynabonne
Here is a patched version of DoTake. Unfortunately, it's one of those monolithic core functions, so in order to add the requisite three lines, you're going to have to insert this entire function into your game. But it should work. Just copy and paste it before the closing </aslx> tag in your game in Code View. (Thanks for the sample code. It made it much easier for me to put together a fix knowing I was seeing what you were seeing.)

  <function name="DoTake" parameters="object, ismultiple">
prefix = ""
if (ismultiple) {
prefix = GetDisplayAlias(object) + ": "
}

if (object.parent = game.pov) {
msg (prefix + DynamicTemplate("AlreadyTaken", object))
}
else if (not object.parent = game.pov.parent) {
msg( prefix + DynamicTemplate("TakeUnsuccessful", object))
}
else if (not ListContains(ScopeReachable(), object)) {
msg (prefix + DynamicTemplate("ObjectNotOpen", GetBlockingObject(object)))
}
else {
volume = 0
continue = true

foreach (obj, GetAllChildObjects(game.pov)) {
if (HasInt(obj, "volume")) {
volume = volume + obj.volume
}
}

if (not Contains(game.pov, object)) {
volume = volume + GetVolume(object,true)
}

if (HasInt(game.pov, "maxvolume")) {
if (volume > game.pov.maxvolume) {
continue = false
if (HasString(game.pov, "containerfullmessage")) {
message = prefix + game.pov.containerfullmessage
}
else {
message = prefix + DynamicTemplate("FullInventory", object)
}
}
}

children = GetDirectChildren(game.pov)
if (HasInt(game.pov, "maxobjects")) {
if (game.pov.maxobjects > 0) {
if (ListCount(children) >= game.pov.maxobjects) {
continue = false
if (HasString(game.pov, "containermaxobjects")) {
message = prefix + game.pov.containermaxobjects
}
else {
message = prefix + DynamicTemplate("MaxObjectsInInventory", object)
}
}
}
}

if (continue = false) {
msg (message)
}
else {
found = true
takemsg = object.takemsg

switch (TypeOf(object, "take")) {
case ("script") {
if (ismultiple) {
OutputTextNoBr (prefix)
}
do (object, "take")
takemsg = ""
}
case ("boolean") {
if (object.take = true) {
object.parent = game.pov
if (takemsg = null) {
takemsg = DynamicTemplate("TakeSuccessful", object)
}
}
else {
found = false
}
}
case ("string") {
object.parent = game.pov
takemsg = object.take
}
default {
found = false
}
}

if (not found and takemsg = null) takemsg = DynamicTemplate("TakeUnsuccessful", object)

if (LengthOf(takemsg) > 0) {
msg (prefix + takemsg)
}

if (HasScript(object, "ontake")) {
do (object, "ontake")
}

if (found and GetBoolean (object, "scenery") and object.parent = game.pov) {
object.scenery = false
}
}
}
</function>

In case anyone is curious, I just added this part:

    else if (not object.parent = game.pov.parent) {
msg( prefix + DynamicTemplate("TakeUnsuccessful", object))
}

Basically, if the object in question isn't even in the same room as the player, then it just says you can't take it.

Forgewright
I cant get your function to function.

I forgot that I was trying something different in the game code I uploaded, I made the floor with the sand first, made it a transparent surface and then added the room and walls to it as objects/rooms. That way the floor was already a parent and was visible where ever you went.

Sure seems a lot easier to have each room inherit the object "sand" when the game starts or copy and paste a sample room with all the little hidden nuances, floor, ceiling, walls, etc. as I add each room and build on that.

I thought I could add the object 'Sand' to the parent room if the player tried to take it but the "take" verb doesn't seem to run the script if the object doesn't already exist in the room your in. ohh, maybe I could add the object when the player "looked" at it? Well, again it would just be easier to just add the object to each room.....

Of course by now it would be easier to add the object "sand" to each room but like I said before, It's about learning the code right now, not the game.

jaynabonne
I seem to have gone off on the wrong tack (or maybe I'm confused now). I had assumed the sand was meant to not be take-able, so the code I added in prevented that from happening. If you do want to actually take the sand, then you'll probably have to either duplicate the sand object or create a copy of it that you can added into the inventory when taken.

Also, could you expand a bit on "I can't get your function to function." There are any number of reasons for that (from you didn't put it into your game correctly to it doesn't do what you want), and knowing how it's failing for you will help to correct the problem.

Forgewright
lol jay. I put it just above the asl closing like you said. I just meant I was still unable to "take" the sand. When I saw the last line of your function (which by the way, will have me studying it for quite some time in the future) I realize I didn't explain myself very well.

jaynabonne
So if you want the sand to show up in all these rooms and it's also take-able, what happens after you take it? Does it still show up in those other rooms? If so, then you'll definitely need more than one "sand" object, one for the common scenery and one to hold. That will require a bit more logic, and the "fix" I gave you definitely won't work. :)

Forgewright
I figured I would have to clone and move the object to the player. I tried it but I keep getting no response. I have to learn the exact settings for transparent, visible, scenery and the right description box and so on. I try different set ups and sometimes think my script isn't working but it could be my object settings. I opened Pandora's box with this one. If you give a room a "transparent" attribute with out the "container" specification on the "tabs" bar, I am finding that the game freezes up when I change the value to "true" during the game. Well I assume that is what it is. The game just says that windows has to shut it down without an explanation. I just need to take a little more time with it. Work has me beat. Working with the code an hour after work is not going to cut it.

To answer your first question. I have never successfully taken the sand. It always tells me I can't take it. I have learned not to work on problems on the full game. You have to isolate it in small sample games, otherwise you get a big fat mess of changes and easily get lost and confused.

Forgewright
Well, I found an easy way to get what I wanted. I just created a model room with all the little items I wanted to be in every room, Floor, walls, ceiling, sand, or whatever and put the settings and descriptions the way I wanted them. Now when I want to add a room I just copy and paste the model where I want and build from there instead of using the "Add Room" option.

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

Support

Forums