Direct Events that hurt/heal units?
Moderator: Forum Moderators
Exactly:quartex wrote:So attributes are protected, somehow, so you can't access them except by copying them into temporary variables?
Dave wrote:Full interpolation of variables (as opposed to simple interpolation where the value begins with a '$' and has the name of a variable as the entire variable) occurs only in the following instances:
'name', 'format', 'to_variable' in [set_variable]
'message' in [message]
You can achieve all other effects by using [set_variable] to set a temporary variable.
I might be willing to add full interpolation to other attributes that especially need it.
David
Dave wrote:Trying to implement it everywhere would have efficiency problems.Dacyn wrote:is there some kind of problem with full interpolation?
I'm sorry, but I still don't understand what the issue of full interpolation has to do with my problem. [store_locations] creates an array of x and y coordinates. I iterate through the array, copy each set of coordinates into a set of temporary variables. I think use those temp x and y coordinates to edit a unit's hitpoints. And yet, when I copy any set of coordinates out of the array beyond the first, all I get are the first set of coordinates over and over. Copying out of the array seems to be simple enough, why am I getting the first set of coordinates over and over?
What happens if you change this bit to:quartex wrote: [set_variable]
name=temp_x
value=$locs[$i].x
[/set_variable]
[set_variable]
name=temp_y
value=$locs[$i].y
[/set_variable]
[set_variable]
name=temp_x
to_variable=$locs[$i].x
[/set_variable]
[set_variable]
name=temp_y
to_variable=$locs[$i].y
[/set_variable]
?
to_variable= is just a shortcut for format= which I believe is just a shortcut for value=$. Either way changing value=$ to to_variable= doesn't change the output.
I also tried the macro {VARIABLE temp_x $locs[$i].x}, but that didn't fix the problem either. I don't think the problem is in how I copy of the variables out of the array. Unfortunately since the array is protected, I can't print the contents of the array itself, so I have no way of knowing what the actual contents of locs[$i].x and locs[$i].y are.
I also tried the macro {VARIABLE temp_x $locs[$i].x}, but that didn't fix the problem either. I don't think the problem is in how I copy of the variables out of the array. Unfortunately since the array is protected, I can't print the contents of the array itself, so I have no way of knowing what the actual contents of locs[$i].x and locs[$i].y are.
- Elvish_Pillager
- Posts: 8137
- Joined: May 28th, 2004, 10:21 am
- Location: Everywhere you think, nowhere you can possibly imagine.
- Contact:
value={ANYTHING} sets the variable to {ANYTHING}, with NO interpolation.quartex wrote:to_variable= is just a shortcut for format= which I believe is just a shortcut for value=$. Either way changing value=$ to to_variable= doesn't change the output.
format and to_variable are very different as well.
It's all fun and games until someone loses a lawsuit. Oh, and by the way, sending me private messages won't work. :/ If you must contact me, there's an e-mail address listed on the website in my profile.
Here's what happens when '$locs[$i].x' is interpolated fully:quartex wrote:why am I getting the first set of coordinates over and over?
And when it is interpolated simply:$locs[$i].x
$locs[(value of "i")].x
(value of "locs[(value of "i")].x")
The first one is equivalent to the x-coordinate of the i-th member of "locs"; the second is equivalent to the x-coordinate of the 1st member of "locs".$locs[$i].x
(value of "locs")[$i].x
(value of "locs")[(value of "i")].x
No. 'to_variable=' is a shortcut to 'format=$'. 'value=' is different; it stores any '$'s into the variable instead of interpolating them first. It is useless for this kind of thing; in fact, that is why the keys 'to_variable' and 'format' were added.quartex wrote:to_variable= is just a shortcut for format= which I believe is just a shortcut for value=$
quartex wrote:I have no way of knowing what the actual contents of locs[$i].x and locs[$i].y are
(is not "protected")Dave wrote:'message' in [message]
Also, you could look at a savefile.
Thanks for explaining the difference Dacyn, the distinction is subtle, but has a huge difference in the end. Your thorough explanation makes it much clearer. This reminds me of pointers in C/C++, another concept I had to work hard getting my brain around. The wiki help pages are good,, but your help makes a huge difference.
- Elvish_Pillager
- Posts: 8137
- Joined: May 28th, 2004, 10:21 am
- Location: Everywhere you think, nowhere you can possibly imagine.
- Contact:
Now you can stick more hooks in it! Make it play the 'poison hit' sound! And then you can make a macro to display those fading numbers! Oh wait, you can't... or can you? *hacks aound some* ah yes, there's two ways to do it; one takes up more computer memory, the other is less 'realistic' looking.quartex wrote:It works! It works! I'm so happy I could jump for joy. It's a wonderful feeling when you've been slaving over a program for hours and it finally works. Couldn't have done it without everyone's help. Thanks again.
However, what would be really nice is a tag that actually goes and does the whole process, such as dealing damage of a certain type and displaying those numbers, which are now virtually impossible.
Not-edit: The first time I tried to post this, Safari told me that it couldn't access any data from this location. I repeatedly tried accessing the forums after, and I recieved that error, and "could not access the page after trying for 60 seconds", and "Could not connect to the server http://www.wesnoth.org", AND "phpBB: Critical Error Could not connect to database".
It's all fun and games until someone loses a lawsuit. Oh, and by the way, sending me private messages won't work. :/ If you must contact me, there's an e-mail address listed on the website in my profile.
- Elvish_Pillager
- Posts: 8137
- Joined: May 28th, 2004, 10:21 am
- Location: Everywhere you think, nowhere you can possibly imagine.
- Contact:
Still OT: It usually posts anyway for me, too, but this time it didn't even do that. Sometimes it posts without attachments when that happens, too.quartex wrote:OT: often when I post replies with safari, it says "can't access this page after trying for 60 seconds". However when i go back later, the reply has been posted to the thread. The error message was not that i couldn't post the reply, but that is couldn't load the confirmation page.
It's all fun and games until someone loses a lawsuit. Oh, and by the way, sending me private messages won't work. :/ If you must contact me, there's an e-mail address listed on the website in my profile.
Still Still OT: Safari is working fine for me.
EDIT: it just crashed.
EDIT: it just crashed.
"ILLEGITIMIS NON CARBORUNDUM"
Father of Flight to Freedom
http://www.wesnoth.org/wiki/FlightToFreedom
Father of Flight to Freedom
http://www.wesnoth.org/wiki/FlightToFreedom