if (GetBoolean(player.parent, "alreadysearched")) {
msg ("You've already searched here.")
}
else {
if (HasScript(player.parent, "search")) {
do(player.parent, "search")
}
else {
msg ("You search but find nothing.")
}
player.parent.alreadysearched = true
}
Can you just add a scenery object called "room" and give it other names like "area", "surroundings", etc and then add a command for each "room" object called "search; explore; analyze" etc. then just run an 'If' script for the results. Each 'Else If' would need to have a set/unset flag for each unique response.
If I understand your problem correctly, that should work? I just based a little game on that very concept.
Sorry if I misunderstood your intent.
The complicated way is to set up a global command, and have it check the current room
<command name="character_stat_screen_command">
<pattern>stats</pattern>
<script>
ClearScreen
msg ("Strength: " + player.strength)
msg ("Endurance: " + player.endurance)
msg ("Dexterity: " + player.dexterity)
msg ("Agility: " + player.agility)
msg ("Speed: " + player.speed)
msg ("Luck: " + player.luck)
msg ("Intelligence: " + player.intelligence)
msg ("Spirituality: " + player.spirituality)
msg ("Mentality: " + player.mentality)
// etc etc etc
wait {
ClearScreen
}
</script>
</command>
<command name="adding_five_integers_command" parameters="value1,value2,value3,value4,value5">
<pattern>add #text1# #text2# #text3# #text4# #text5#</pattern>
<script>
sum = value1 + value2 + value3 + value4 + value5
msg (value1 + " + " + value2 + " + " + value3 + " + " + value4 + " + " + value5 + " = " + sum)
</script>
</command>
// the inputs may need to be converted into 'ints' for the arithmetic-addition, if they're 'strings' still, obviously
// can't remember if quest handles this or not for you
<command name="global_search_command">
<pattern>search</pattern>
<script>
if (HasScript (player.parent, "search") {
invoke (player.parent.search)
} else {
msg ("You're unable to search this room and~or weren't able to find anything of value")
}
</script>
</command>
<object name="room1">
</object>
<object name="room2">
<attr name="search" type="script">
firsttime {
MoveObject(gold_coin, player)
} otherwise {
msg ("You already searched this room thoroughly, there's nothing that you missed.")
}
</attr>
</object>
<object name="room3">
<attr name="search" type="script">
msg ("Upon searching, you set off a trap, gruesomely resulting in your messy death.")
msg ("GAME OVER")
finish
</attr>
</object>
<object name="room4">
<attr name="search" type="script">
firsttime {
msg ("You search and search, yet are unable to find anything of significance")
} otherwise {
msg ("You already searched this room thoroughly, there's nothing that you missed.")
}
</attr>
</object>
<object name="player">
</object>
<object name="gold_coin">
</object>
HegemonKhan wrote:"Just to clarify, Pix, if I set up that global command, would I be able to assign "If's" to each specific room?
Command Pattern
"global_pillage_command"
Name: pillage
Unresolved object text:
//SCRIPT
if (HasScript (player.parent, "pillage") {
invoke (player.parent.pillage)
}
else {
msg ("You're unable to search this room and~or weren't able to find anything of value")
}
//((^---- this is failing to load))
//INDIVIDUAL ROOMS
object name = "creation_room"
//ADD ATTRIBUTE
pillage (command pattern)
//ROOM SCRIPTS
//BEFORE OR AFTER ENTERING THE ROOM
firsttime {
msg ("You cannot search this room, but you're getting the hang of it!")
} otherwise {
msg ("Nope.")
}
//NEXT INDIVIDUAL ROOM (that you can actually search)
//ADD ATTRIBUTE
pillage (command pattern)
//ROOM SCRIPTS
//BEFORE OR AFTER ENTERING THE ROOM
firsttime {
If (RandomChance(40)) {
msg ("You found blah blah blah!)
Move blah blah to inventory
}
else if {
msg ("You found 10 blah blah gold")
set variable or attribute player.gold = playergold + 10
}
else if {
msg ("Blurg!")
}
else {
msg ("You already searched this room thoroughly, there's nothing that you missed.")
}
^---- ((is this how it's done?))
Neonayon wrote:if (HasScript (player.parent, "pillage") {
invoke (player.parent.pillage)
}
else {
msg ("You're unable to search this room and~or weren't able to find anything of value")
}
//((^---- this is failing to load))
if (HasScript (player.parent, "pillage") {
do (player.parent.pillage)
}
else {
msg ("You're unable to search this room and~or weren't able to find anything of value")
}
your Command's 'pattern' should be: pillage
(during game play, you'd type in the pattern, which in this case, would be: pillage)
your Command's name should be: (whatever you want as its name ~ you don't need the global, nor underscores, in it, as that's just something I like to do to convey it's to be a global Command and not a local-room Command, and I just like underscores, lol)
no, you don't want to 'add pillage (command pattern)' to your rooms!
you want to create~add a 'pillage' Script Attribute to your rooms:
'room1' -> 'Attributes' Tab -> Attributes -> Add -> (see below)
// and do the same for: room2, room3, etc etc etc
(Object Name: room1)
Attribute Name: pillage
Attribute Type: script
Attribute Value: (add in your scripts: add new script)
also, this means *NO* usage of 'onenterroom' and 'onexitroom' Scripts for the room, in relation to your 'pillage' Command. We're making~adding our own Script Attribute, called 'pillage', to the room, for our 'pillage' Command to check for and possibly call upon ~ activate it.
I'm not familar with your doing of (or what you mean by):
//add attribute
pillage (command pattern)
<!--Saved by Quest 5.6.5783.24153-->
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="searching">
<gameid>47c5d11e-6314-4f54-89b2-455fb853eba3</gameid>
<version>1.0</version>
<firstpublished>2015</firstpublished>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
<exit alias="east" to="room_with_something">
<inherit name="eastdirection" />
</exit>
</object>
<command name="search_room">
<pattern>search;pillage;search room;search area</pattern>
<script>
if (GetBoolean(player.parent, "alreadysearched")) {
msg ("You've already searched here.")
}
else {
if (HasScript(player.parent, "search")) {
do (player.parent, "search")
}
else {
msg ("You search but find nothing.")
}
player.parent.alreadysearched = true
}
</script>
</command>
<object name="room_with_something">
<inherit name="editor_room" />
<search type="script">
msg ("You search the room and find a gem.")
gem.visible = true
</search>
<object name="gem">
<inherit name="editor_object" />
<visible type="boolean">false</visible>
<take />
</object>
<exit alias="west" to="room">
<inherit name="westdirection" />
</exit>
</object>
<walkthrough name="test">
<steps type="simplestringlist">
search
search
east
search
take gem
search
</steps>
</walkthrough>
</asl>