Direct Events that hurt/heal units?

Discussion and development of scenarios and campaigns for the game.

Moderator: Forum Moderators

Dacyn
Posts: 1855
Joined: May 1st, 2004, 9:34 am
Location: Texas

Post by Dacyn »

quartex wrote:So attributes are protected, somehow, so you can't access them except by copying them into temporary variables?
Exactly:
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:
Dacyn wrote:is there some kind of problem with full interpolation?
Trying to implement it everywhere would have efficiency problems.
quartex
Inactive Developer
Posts: 2258
Joined: December 22nd, 2003, 4:17 am
Location: Boston, MA

Post by quartex »

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?
dms
Posts: 56
Joined: August 11th, 2004, 9:08 pm
Location: New Zealand

Post by dms »

quartex wrote: [set_variable]
name=temp_x
value=$locs[$i].x
[/set_variable]

[set_variable]
name=temp_y
value=$locs[$i].y
[/set_variable]
What happens if you change this bit to:

[set_variable]
name=temp_x
to_variable=$locs[$i].x
[/set_variable]

[set_variable]
name=temp_y
to_variable=$locs[$i].y
[/set_variable]

?
quartex
Inactive Developer
Posts: 2258
Joined: December 22nd, 2003, 4:17 am
Location: Boston, MA

Post by quartex »

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.
dms
Posts: 56
Joined: August 11th, 2004, 9:08 pm
Location: New Zealand

Post by dms »

I got it!

It works if you leave out the first $ sign:


[set_variable]
name=temp_x
to_variable=locs[$i].x
[/set_variable]

[set_variable]
name=temp_y
to_variable=locs[$i].y
[/set_variable]
User avatar
Elvish_Pillager
Posts: 8137
Joined: May 28th, 2004, 10:21 am
Location: Everywhere you think, nowhere you can possibly imagine.
Contact:

Post by Elvish_Pillager »

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.
value={ANYTHING} sets the variable to {ANYTHING}, with NO interpolation.

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.
Dacyn
Posts: 1855
Joined: May 1st, 2004, 9:34 am
Location: Texas

Post by Dacyn »

quartex wrote:why am I getting the first set of coordinates over and over?
Here's what happens when '$locs[$i].x' is interpolated fully:
$locs[$i].x
$locs[(value of "i")].x
(value of "locs[(value of "i")].x")
And when it is interpolated simply:
$locs[$i].x
(value of "locs")[$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".
quartex wrote:to_variable= is just a shortcut for format= which I believe is just a shortcut for value=$
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:I have no way of knowing what the actual contents of locs[$i].x and locs[$i].y are
Dave wrote:'message' in [message]
(is not "protected")
Also, you could look at a savefile.
quartex
Inactive Developer
Posts: 2258
Joined: December 22nd, 2003, 4:17 am
Location: Boston, MA

Post by quartex »

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.
quartex
Inactive Developer
Posts: 2258
Joined: December 22nd, 2003, 4:17 am
Location: Boston, MA

Post by quartex »

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.
User avatar
Elvish_Pillager
Posts: 8137
Joined: May 28th, 2004, 10:21 am
Location: Everywhere you think, nowhere you can possibly imagine.
Contact:

Post by Elvish_Pillager »

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.
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.

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.
quartex
Inactive Developer
Posts: 2258
Joined: December 22nd, 2003, 4:17 am
Location: Boston, MA

Post by quartex »

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.
User avatar
Elvish_Pillager
Posts: 8137
Joined: May 28th, 2004, 10:21 am
Location: Everywhere you think, nowhere you can possibly imagine.
Contact:

Post by Elvish_Pillager »

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.
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.
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.
MadMax
Posts: 1792
Joined: June 6th, 2004, 3:29 pm
Location: Weldyn, Wesnoth

Post by MadMax »

Still Still OT: Safari is working fine for me.

EDIT: it just crashed.
"ILLEGITIMIS NON CARBORUNDUM"

Father of Flight to Freedom
http://www.wesnoth.org/wiki/FlightToFreedom
Post Reply