using properties for player features
shandlia
05 Oct 2006, 23:03darkgoddessnight
05 Oct 2006, 23:51GameBoy
06 Oct 2006, 04:22Elexxorine
06 Oct 2006, 13:56shandlia
06 Oct 2006, 16:37' "Demo"
' Created with QDK 3.53 - UNREGISTERED VERSION
!include <net.lib>
define game <Demo>
asl-version <350>
gametype multiplayer
start <start>
game info <Created with QDK 3.53 - UNREGISTERED EVALUATION VERSION.>
player startscript for each object in <$name(%userid%)$> move <#quest.thing#;player%userid%>
disconnect {
for each object in <player%userid%> move <#quest.thing#; $name(%userid%)$>
set string <lastroom; #quest.currentroom[userid]#>
}
define options
login on
register on
end define
define synonyms
end define
define room <start>
script if got <self> then goto <#lastroom#> else goto <creation>
end define
define room <2>
north <3>
end define
define room <3>
north <4>
south <2>
end define
define room <4>
south <3>
end define
define room <creation>
command <create self> {
clone <body; self; creation>
property <self; race=race>
conceal <self>
give <self>
goto <2>
}
define object <body>
invisible
end define
end define
define text <intro>
end define
define text <win>
end define
define text <lose>
end define
I'm guessing it has something to do with quest.currentroom[userid] but have no idea what it should be instead. quest.currentroom[player%userid%] maybe?
Elexxorine
06 Oct 2006, 20:10Your start script says: for each object in <$name(%userid%)$> move <#quest.thing#;player%userid%>
Firstly: <#name[userid]#> not <$name(%userid%)$>, it's a string not a function and indexs don't need %'s and are done with square brackets, these should be just to the right of the 'p' key...
Secondly: <#quest.thing#;player%userid%> should be <#quest.thing#; #player[userid]#>
Thirdly: the code itself doesn't actually make sesne, tranlated it goes: 'When the player joins, look for each object in the '#name[userid]#' room and move them to the player's inventory. At start up they will have no 'name' string and this code will give an error.... remove it to the log in script....
I think Im Dead
13 Oct 2006, 04:08It's basically reiterating what Elexxorine has said, but try coding what you are going for in these steps, and it should fall together perfectly.
1) player startscript, if exists <$name(%userid%)$> then for each object in <$name(%userid%)$> move to <player%userid%>, else create room <$name(%userid%)$>, then add properties to that room.
(The problem here is quest won't save properties for rooms generated dynamically, so in actuallity it helps to make seperate objects in the room with a similar naming scheme for subsets of character's properties, like $name(%userid%)$-Info, $name(%userid%)$-Stats, or whatever.)
2) disconnect, for each object in <player%userid%> move to <$name(%userid%)$> then disconnect.
And with that you've got a maintainable no frills player recognition and persistent inventory/properties system.
Of course you don't have to bother even having the disconnect or startup if you were to bypass the built in player inventory and log in systems all together but that's a tidbit for another subject.