Is there a possible way I could create a varible everytime someone does something with a mob, and name it something such as /var/src.name_blah
and it would show up as, if say my name was Valderalg, Valderalg_blah?
For an example, I use a verb to interact with Bob, the cook, he creates a var saying Valderalg_owesme+=blah.
Something like that?
Another thing, is it possible to set something so that verbs cannot be typed into the command prompt?
ID:172875
Mar 16 2004, 11:31 am
|
|
In response to Foomer
|
|
Thanks, exactly what I was looking for, but another question. Lets say, I wanted to take the list and run a loop checking each variable inside it, and finding which one was the largest, if they were say, numbers. Can't figure it out for some reason.
|
In response to Valderalg
|
|
Valderalg wrote:
Thanks, exactly what I was looking for, but another question. Lets say, I wanted to take the list and run a loop checking each variable inside it, and finding which one was the largest, if they were say, numbers. Can't figure it out for some reason. Use the max proc. It takes any number of arguments and returns the one with the highest value. It can also take a list as an argument. var/largest_number = max(list_name) If your list might contain both text and numbers, use this instead: var/list/number_list = new for (var/x as num in list_name) number_list += x var/largest_number = max(number_list) If you give max a list with both numbers and text, you'll get a type mismatch error when it is called. |
In response to Sarkhan
|
|
One more question, cause I havent really used assosiative list
Mobs: You Bob list: anger_list Now, for the example: You hit bob using a verb, or whatever, bob naturally will be angry at you, and lets say we add 5 to his anger_list towards you. NOW, lets say bob has had past... bad experiences and his anger towards you is now higher than anyone elses, so he decides he is going to go after you now. the problem: How could I do something exactly like this? I have something that works, i just cant find a correct way to check which mob has the highest hate in the list, if the mob still exist(someone else might have beat them to it, if you know what i mean). Any help GREATLY appreciated, this one has had me stumped for awhile. PS: let me know if you need more detail/this doesnt make sense. |
In response to Valderalg
|
|
let me break it down some more, maybe this will help.
Holt, the barbarian attacks Sslis, the snake monster, the snake monster obviosly doesn't like that, so adds Holt to his agry_at list. Now, Holt's friend, Halt, attacks Sslis too, but hes weaker, so he doesnt really do much damage to Sslis's thick skin, but Sslis obviously doesn't have that hard of a thick skin, because he gets upset and adds Halt to his anger list, just lower down on it. See what im trying to do here? Then every few seconds i have a check to see whos on whos anger list, and go after the one on top, and occasionly the person with the second most hate. Does this make any sense at all? Could anyone offer me any more help? I seem to be only having a problem with going through and finding who has what ammount of anger, then doing something to them, and so on |
Here's an example:
<code>mob var/list/custom_vars = list() verb/AddCustom(new_var as text) custom_vars[new_var] += rand(1, 100) verb/AccessCustom() for(var/v in custom_vars) src << "[v] = [custom_vars[v]]"</code>
I tend to use that for programming skills into my MUD, because it makes it possible to add new skills and check their levels on the fly. If I want to see if the player has any skill in Tracking, I just check mob.skills["Tracking"]. It'll either be null if there's no entry in the skills list, or it'll give me the value of the entry.