Hello everyone. Here is a tip. If you have a problem as in you don't know how to do something for your game, see if you can set a variable to help it. E.G: I have a note that you cant read cause the writing is too small, so you need a magnifying glass. I think you can set some code for it but I dont know it. So I set a variable hasglass and when you pick up the hasglass = 1. So you make it for the read verb for your note say if usr.hasglass = 0 usr << "It is too small writing" etc. I hope this has helped you.
From Cjpe
ID:149518
Apr 10 2002, 7:58 pm
|
|
In response to Lord of Water
|
|
If you have a variable(or an associative list) for everytime you have something like that, you will quickly build up immense amounts of useless variables or a huge amount of lag when searching through a list. Lucky for us all, there is a great way to do something without all the variable mumbo-jumbo. locate(). (Look it up!)
If you want to do more than simply check for an item existance, you can even set up a system of 'item requirements', so you can check a variable(or list) to see if the person has the required items to use it. Mayby something like this? atom/movable/CheckReq(O) // prototype proc for all movable atoms obj/verb/Equip() Of course this is all hypothetical code, and it won't even compile if you were to copy-paste it and properly indent. And I guess I strayed a bit off-point, but the point was : There are much better ways of doing things like this. Having huge lists of item variables would become tedious very fast, and very slow. As a side note, setting things like equipment variables to boolean values is a bad idea. What if you have to find the item you are wearing in your right hand? Instead of simply extracting it from a variable, you'd have to loop through items and check their variables. Alathon |
Though all of these vars probably have very legit uses, why not condense them down into an associative list?
mob/var/list/itemCheck = list()
Then, you don't even have to define the vars. You can do it like this:
This makes a lot less work for you as you create more specialized items that require variable checks of this sort.
-Lord of Water