Welcome to the Builder Academy

Question room.people and Curly Braces

More
17 Jul 2015 03:54 #5435 by krell
When I use the people argument to room I get this closing curly brace in front of the result. It makes it difficult where a script requires some math between different MOBs, rooms or objects IDs.

eg:
Code:
%echo% %self.room.people%

Will echo }1 if I'm in the same room as the MOB it's attached too.

So, am I only seeing this on my copy of the MUD or is this an intentional design?

Please Log in or Create an account to join the conversation.

More
18 Jul 2015 03:47 #5436 by Parnassus
I don't understand the bit about doing math between ids. If you're trying to subtract the id of mob1 from the id of mob2, it seems to me you might as well almost use random numbers.

As far as I know, the curly brackets DO indicate ids but I can't think of a time I've ever used them although they do make things more specific. For instance, I want to indicate this fido instead of that fido but they both have the same vnum. However, I can't think of a use to take this fido's id and subtract it from that fido's id.

I think the }1 is you, the first file. The }ids on players seem set but on other things seem changeable. I know that mobs will change, depending on when they're loaded, but I don't know if a sentinel mob that's limited to one instance will always be the same since it will always load at the same place on the list. I also don't know if rooms change after reboot.

Please Log in or Create an account to join the conversation.

More
18 Jul 2015 04:00 #5437 by krell
Replied by krell on topic room.people and Curly Braces

Parnassus wrote: I don't understand the bit about doing math between ids. If you're trying to subtract the id of mob1 from the id of mob2, it seems to me you might as well almost use random numbers.


If you have two different MOBs that load in a zone they will have id's that change on loading, but the values between them will always n apart. That's why I'd want to do math. :)

As far as I know, the curly brackets DO indicate ids but I can't think of a time I've ever used them although they do make things more specific. For instance, I want to indicate this fido instead of that fido but they both have the same vnum. However, I can't think of a use to take this fido's id and subtract it from that fido's id.


I'm trying to find a way to use differences in VNUMs. I can't seem to figure out the proper inheritance for that to work though with the script I'm working on.

I think the }1 is you, the first file.


Yes, that is correct. ;)

The }ids on players seem set but on other things seem changeable. I know that mobs will change, depending on when they're loaded, but I don't know if a sentinel mob that's limited to one instance will always be the same since it will always load at the same place on the list. I also don't know if rooms change after reboot.


Please see first response above.

Please Log in or Create an account to join the conversation.

More
18 Jul 2015 04:06 #5438 by Parnassus
Have you tried using the id as a string and stripping the first character, then using the remainder as a number? I remember seeing how to strip the character but I've forgotten it right now.

Please Log in or Create an account to join the conversation.

More
18 Jul 2015 04:08 #5439 by krell
Replied by krell on topic room.people and Curly Braces
I was considering doing that, but I don't know how with dg. I'd probably have to convert the string to integer too.

Please Log in or Create an account to join the conversation.

More
18 Jul 2015 04:15 #5440 by Parnassus
Hmm, words use extract, but I still can't remember characters :(

Please Log in or Create an account to join the conversation.

Time to create page: 0.208 seconds