Listing object
Jhames
14 Jan 2009, 20:23When list the objects in a room. The sentences says:
There is item1, item2, item3 and item4 here
I wish to know how to access the objects, one element by one.
So, the sentences says:
There is item1, and the item2 is in the corner, and the item3 is in your mouth, and item3 is invisible.
¿Any idea?.
Thanks.
I try to undertandt this sentences of Mabdrit, but, I don't know how to implement in a library.
for each object in <#quest.currentroom#> {
set <TLSthisObj;#quest.thing#>
if property <#quest.thing#;invisible> or property <#quest.thing#;hidden> then {
}
else {
if type <#quest.thing#;TLTactor> then {
if property <#quest.thing#;named> then {
set <TLScharList;#TLScharList# |b$capfirst(#@quest.thing#)$|xb, >
}
else set <TLScharList;#TLScharList# #(quest.thing):prefix# |b#@quest.thing#|xb, >
}
else{
set <TLSobjList;#TLSobjList# #(quest.thing):prefix#>
set <TLSobjList;#TLSobjList# |b#@quest.thing#|xb, >
}
}
}
if ($lengthof(#TLScharList#)$ >0) then {
set <TLNlengthOf;$lengthof(#TLScharList#)$ - 1>
set <TLScharList;$left(#TLScharList#;%TLNlengthOf%)$>
set <TLScharList;$TLFcontentFormat(#TLScharList#)$>
if ($instr(#TLScharList#;_and_)$ >0) then {
msg <#TLScharList# are here.|n>
}
else {
msg <#TLScharList# is here.|n>
}
}
if ($lengthof(#TLSobjList#)$ >0) then {
set <TLNlengthOf;$lengthof(#TLSobjList#)$ - 1>
set <TLSobjList;$left(#TLSobjList#;%TLNlengthOf%)$>
set <TLSobjList;$TLFcontentFormat(#TLSobjList#)$>
if ($instr(#TLSobjList#;_and_)$ >0) then {
msg <You can see #TLSobjList# here.|n>
}
else {
msg <You can see #TLSobjList# here.|n>
}
}
Alex
14 Jan 2009, 22:21In your example, for item2 set the suffix to "is in the corner".
The Description Preview will show you how the object will be described in the room description.
Jhames
14 Jan 2009, 23:49But, that's not the point.
I need change the last "and", of the list.
So if QUEST says:
There is item1, item2, and item3
QUEST says:
There is item1, item2, y item3
I need that, for make compatible with spanish language.
I know I can make this with Description-Style-Run Script, but doesn't work fine, because i can't change "and" by "y"
Alex
16 Jan 2009, 21:00Jhames
16 Jan 2009, 21:35If there are a new versión, I'll send the other words you must change for compatibility with other languages and some sugerences.
Thank you very much.
I can solve that problem if I modify the binary QUEST.EXE, and changes the bytes: "and" by ", y".
But I oblige the people that play the game, to use the modified file. And I don't like that.
I think Im Dead
17 Jan 2009, 21:00
set numeric <x; 0>
set string <item.list;>
for each object in <#quest.currentroom#> if not ($objectproperty(#quest.thing#; player)$) then {
inc <x>
set string <item%x%; #quest.thing#>
}
for <n;1;%x%> {
if (%n% = 1) set string <item.list; In this room you see #item%n%#> else {
if (%n% <> %x%) then set string <item.list; #item.list#, #item%n%#> else set string <item.list; #item.list#, y #item%n%#>
}
}
Like i said, I haven't messed with ASL in a good bit, but check the forums, and barring some formatting issues, something like this should work to make an alternate item list you could slip into your default room description.
Jhames
18 Jan 2009, 12:52FATAL ERROR: Unrecognised 'if' condition in 'for each object in <#quest.currentroom#> if not ($objectproperty(#quest.thing#; player)$) then {'
Could you check the code, please ????
I'm not very good with ASL language, yet....
Thank you again.
paul_one
18 Jan 2009, 14:16 for each object in <#quest.currentroom#> {
if not property <#quest.thing#; invisible> then {
set string <t.cont.list; #t.cont.list# #(quest.thing):prefix# |b#(quest.thing):alias#|xb,>
set string <t.cont.last; #(quest.thing):prefix# |b#(quest.thing):alias#|xb>
inc <t.cont.count>
}
}
if ( %t.cont.count% > 1 ) then {
set numeric <t.cont.pos; $instr(#t.cont.list#;, #t.cont.last#)$ - 1>
set string <t.cont.list; $left(#t.cont.list#;%t.cont.pos%)$ and #t.cont.last#.>
}
else {
set numeric <t.cont.pos; $lengthof(#t.cont.list#)$ - 1>
set string <t.cont.list; $left(#t.cont.list#;%t.cont.pos%)$.>
}
msg <#t.cont.list#>
}
I did something similar to the above to list out objects in/on an object.
This is because : what if you only have ONE object?
Anyhoo, I don't know if the above will cut and paste right or not.
Alex
18 Jan 2009, 21:49Bolumbero wrote:Thank you, "I think Im Dead", but QDK says something about one error:FATAL ERROR: Unrecognised 'if' condition in 'for each object in <#quest.currentroom#> if not ($objectproperty(#quest.thing#; player)$) then {'
Could you check the code, please ????
I'm not very good with ASL language, yet....
Thank you again.
Looks like it should be:
for each object in <#quest.currentroom#> if not property <#quest.thing#; player> then {