define game <Test Game>
asl-version <410>
background <black>
foreground <white>
start <StartRoom>
end define
define options
debug on
panes off
end define
define room <StartRoom>
alias <Start Room>
look <A most boring location.>
north {
goto <$GetRandomLocation$> }
south {
goto <$GetRandomLocation$> }
west {
goto <$GetRandomLocation$> }
east {
goto <$GetRandomLocation$> }
northwest {
goto <$GetRandomLocation$> }
southwest {
goto <$GetRandomLocation$> }
southeast {
goto <$GetRandomLocation$> }
northeast {
goto <$GetRandomLocation$> }
end define
define room <AnotherRoom>
alias <Another Room>
look <Another boring location.>
south <StartRoom>
end define
define room <YetAnotherRoom>
alias <Yet Another Room>
look <Yet another boring location.>
south <StartRoom>
end define
define function <GetRandomLocation>
set numeric <num; $rand(1; 2)$>
select case <%num%> {
case <1> set string <Location; AnotherRoom>
case <2> set string <Location; YetAnotherRoom>
}
return <#Location#>
end definenorth <$GetRandomLocation$>I saved that and then loaded it. But I am running 4.0.5 (went to update, it says mine is the latest version, it is lite not pro if that makes a diff?)
Anyhow, it only seems to send me to "Yet Another boring Location", never "Another Boring Location" (Could be the version difference?)
Also, bar editing the ASL directly in say notepad, how do I edit $GetRandomLocation$ ?
Overcat wrote:Anyhow, it only seems to send me to "Yet Another boring Location", never "Another Boring Location" (Could be the version difference?)
Hmm. Are you sure? I thought that too, when I first ran it - but it was just that the same room was randomly selected several times in a row. Works for me. How many times do you check it? You can type 'south' or 's' repeatedly, since both "Another Boring Location" and "Yet Another Boring Location" exit southward to the start room.
Overcat wrote:Also, bar editing the ASL directly in say notepad, how do I edit $GetRandomLocation$ ?
I'm using 4.1 Beta, so I don't know if the following will be the same for you:
In the tree at the left in the QDK window, navigate to Game -> Functions. 'GetRandomLocation' should be listed on the right after you click 'Functions'. Click 'GetRandomLocation', and then click the 'Edit' button. A window will pop up that allows you to edit the script statement by statement.
If that doesn't work for you, then perhaps 4.05 is just layed out differently. (I don't use the QDK, so I can't recall what any of the differences are between the new and old versions.) If it is the case that it's just layed out differently, try to find somewhere in the interface that allows you to edit 'functions'. Maybe the tutorial will have something on that.
For others (including Alex) who may have attempted this, for some reason this statement would not work:
north <$GetRandomLocation$>
Alex wrote:
For others (including Alex) who may have attempted this, for some reason this statement would not work:
north <$GetRandomLocation$>
This seems to work fine for me in the latest build, possibly it was fixed as a side-effect of me fixing something else. I'll update the beta build soon.
...
north {
goto <$GetRandomLocation$> }
...
north {
goto <$GetRandomLocation$> }
south ...north <$GetRandomLocation$>
south ...north {
goto <$GetRandomLocation$> }north
<$GetRandomLocation$>north { goto <$GetRandomLocation$> }Changing it to
north {
<$GetRandomLocation$> }
south ...
Makes the room have its exits, but when you enter a direction, nothing happens
north <someroom>north {
<$GetRandomLocation$>
msg <North it is!> }north { goto <$GetRandomLocation$> }
Leaves the location in the available list - but does nothing when you enter the direction command.
define object <SomeObject>
...
action <SomeAction> { msg <Action fired.> }
...
end definedefine object <SomeObject>
...
action <SomeAction> {
msg <Action fired.> }
...
end defineAlex wrote:
For others (including Alex) who may have attempted this, for some reason this statement would not work:
north <$GetRandomLocation$>
This seems to work fine for me in the latest build, possibly it was fixed as a side-effect of me fixing something else. I'll update the beta build soon.
north {
goto <$GetRandomLocation$> }