obj/var/cost = 1
obj/someitem
suffix = "[src.cost]"
Why does this compile with errors?
-ST
ID:178468
![]() May 8 2002, 1:40 pm
|
|
obj/var/cost = 1 Why does this compile with errors? -ST |
Super16 wrote:
It needs to be called when obj is created. But it doesnt change, the cost changes after a while. So it just stays at 1 (the suffix) |
Vars initialized outside of New() must be initialized with constants. src.cost is not a constant. You would have more luck inside your New() proc. (suffix = "blah" should work outside of New() though.)
|
ACWraith wrote:
Vars initialized outside of New() must be initialized with constants. src.cost is not a constant. You would have more luck inside your New() proc. (suffix = "blah" should work outside of New() though.) Ummm, what? |
Sariat wrote:
ACWraith wrote: You cannot have a variables intial variable contain another variable. You would have to assign it at run time. obj/New() . = ..() suffic = "[cost]" |
Ebonshadow wrote:
Sariat wrote: I know, I have done that, but it doesnt update, the cost changes. So if the cost changes to 2, the suffix is still 1... PS- whats a suffic? :) |
Sariat wrote:
[snip] I know, I have done that, but it doesnt update, the cost changes.[snip] Sorry. I was still answering the first question. There is no way to directly link suffix and cost that I know of. There is the issue of the conversion from num to text to contend with. However, even if cost was also text, a change in one text would not affect the other text. You probably have to make sure to update suffix manually whenever the cost changes. |
Sariat wrote:
I know, I have done that, but it doesnt update, the cost changes. Well thats because you have to update suffix everytime you want it to update (duh). PS- whats a suffic? :)A typo of suffix A typo of sufic(mystic monk like) or The first half of a word that ends with ate that you should go do right now ;). |
You may want to assign the obj's Stat proc so that it updates its suffix to its cost.
obj/someitem That way, it will update automatically. The only problem is that it might give a tiny bit of lag. |
Sariat wrote:
I know, I have done that, but it doesnt update, the cost changes. Of course it doesn't update, for the same reason that setting x=sqrt(y) doesn't update x every time you change y. The engine has no way of knowing if you wanted to stick with that value or keep it connected somehow with the cost var; the language has no capability built in to tie the vars together like that--and most don't. Therefore, you have to create a new string every time cost changes. One way you could do that, as suggested, would be the Stat() proc, since that's where you'd see a suffix displayed anyway. Another choice is to use another proc for that: proc/SetCost(x) Lummox JR |
obj
bah
New()
suffix="bah"