Warfare Incorporated :: View topic - Persistent variable wants and oddities
Warfare Incorporated Forum Index
 FAQ   Search   Memberlist   Usergroups 
 Profile   Log in to check your private messages   Log in 
 
Persistent variable wants and oddities

 
Post new topic   Reply to topic    Warfare Incorporated Forum Index -> Enhancement Requests
View previous topic :: View next topic  
Author Message
ajcross
Very Active User


Joined: 23 Dec 2003
Posts: 113
Location: Kansas City

PostPosted: Fri May 07, 2004 9:34 am    Post subject: Persistent variable wants and oddities Reply with quote

1. Could Persistent Variables have a limit of 255 characters instead of 28? I was creating dynamic message triggers and had to use 2+ pvar to create messages.

2. Persistent Variables appear to have a String variable and an Integer variable.

'Set Persistent Variable' sets the String and if the value to set is numeric, it sets the integer.

'Modify Persistent Variable' modifies the Integer for Add or Subtract and not the String. I noticed this when my debugging Show Alert would not show changes to the Integer, only the String.

This is also a problem when you want a variable set to the value of another variable like this:
Set persistent variable 'MyVar1' to "{MyVar2}"
It won't get the current Integer value.

3. Can Integer persistent variables be used for Quantity Value's?
This would allow more dynamic Condition and Action Logic.

Right now, I have 'Area contains' triggers to check for different quantity values such as =0 units, >=1, >=3, >=5, >=7, etc to spawn enemy troops. With a Persistent Variable for the Quantity Value, I could have one trigger to spawn when Area count falls below the Persistent Variable.
Area 'SomeArea' contains AtLeast {MyVarA} Any Unit owned by AllSides

Right now, I can add/subtract a persistent variable from another with several triggers like this:

Trigger 1
Set persitent variable 'MyTemp' to "{MyVarA}"
Trigger 2
Test persistent variable 'MyTemp' is AtLeast 1
Modify persistent variable 'MyVarB': Add 1
Modify persistent variable 'MyTemp': Subtract 1
Preserve Trigger

I would rather have one line:
Modify persistent variable 'MyVarB': Add {MyVarA}

Conditions for this:
*Area Contains, Countdown Timer is, *Has Credits, Elapsed Time, Every NN seconds, Own Units

Actions for this:
Create Unit, *Modify Credits, *Modify Persistent Variable, Start Countdown Timer, Wait

* marks my most desired commands to compare qunatities to persistent variables.

4. Could persistent variable Integers be set with quantities from other commands? This is would be the values from the same conditions:
*Area Contains, Countdown Timer is, *Has Credits, Elapsed Time, Own Units

My favorite would be:
Modify persistent variable 'MyVar': Quantity in Area 'someArea' of 'unit types' owned by 'side'

Credits could use $credits or could be:
Modify persistent variable 'MyVar': Credits owned by 'side'

5. Could commands for Integer and String persistent variables be separated? This would avoid data type conflicts and be less confusing for a mission author.

I would:
a. make "Modify Persistent Variable 'text': Set" be the command to set the Integer value
b. stop "Set Persistent Variable" from setting the Integer value.

_________________
Andy Cross
Back to top
View user's profile Send private message
crakerz
Mega-Poster


Joined: 17 Sep 2003
Posts: 353
Location: California Bay Area

PostPosted: Fri May 07, 2004 1:57 pm    Post subject: Reply with quote

Andy,

Many of these have been talked about/asked for in other threads, and are great ideas. I wouldn't expect any great modifications to take place for a while though, now that v1.2 is released. Also, spiffcode has repeatedly stated its desire not to change too many things so current levels retain compatibilty between versions. Witness the "set pvar" issue in another thread (thankfully, there is a workaround). The things you suggest are very desirable, yet would require major revisions in the coding that would render all previous levels useless.

I do know that Scott has expressed a desire to see better logic, including things like Boolean operators, and the ability to use pvars for integer values. Maybe in the next major revision, who knows?

To add to some of your comments: all pvars are stored as text. You can only test that text for "integer" values, and you can only modify that text as an "integer" value. If you attempt to modify a "string" value, it will treat it as zero. For example, if you Set a pvar to "Hello" and then attempted to Add 10 to it, the result would be "10".


I was unable to duplicate your statement about setting a pvar to a pvar:

Set persistent variable 'MyTemp' to "{MyVarA}"

For one thing, the "{}" are not recognized/allowed in strings, as are not several other symbols (Heck, you can cause a level to crash or not even load with some symbol combos!) In fact, I've found it best to stick to Aa-Zz and 0-9. Could you please elaborate on how you were able to do that?

_________________
Why negotiate when you can just blow things up?
------------------------------------------------------
Back to top
View user's profile Send private message Send e-mail
ajcross
Very Active User


Joined: 23 Dec 2003
Posts: 113
Location: Kansas City

PostPosted: Fri May 07, 2004 3:38 pm    Post subject: Reply with quote

crakerz wrote:
The things you suggest are very desirable, yet would require major revisions in the coding that would render all previous levels useless.


I would still like to put the number of units in an area into a persistent variable and have $credits too from #4. These are the least difficult.

crakerz wrote:
To add to some of your comments: all pvars are stored as text. You can only test that text for "integer" values, and you can only modify that text as an "integer" value. If you attempt to modify a "string" value, it will treat it as zero. For example, if you Set a pvar to "Hello" and then attempted to Add 10 to it, the result would be "10".

I was unable to duplicate your statement about setting a pvar to a pvar:

Set persistent variable 'MyTemp' to "{MyVarA}"


I use this to debug my variables:
Condition:
Every 5 seconds
Action:
Show Alert "sc {StatusCode}"

{variableName} can be inserted in any text to show that persistent variable.

Something may have gotten fixed in 1.2.
When I used 'Set Persistent Variable', I would see the alert change
When I used 'Modify Persistent Variable', I would not see the alert change
This is why I thought there were two values per variable.

I checked this out:
Set persistent variable 'test1' to "12"
Set persistent variable 'test2' to "{test1}"
Ecom (SmallBottom w/ Close) from Andy to Andy: "test1: {test1}@ test2: {test2}"
Modify persistent variable 'test1': Add 1
Ecom (SmallBottom w/ Close) from Andy to Andy: "test1: {test1}@ test2: {test2}"

My ECOM's came out as:
test1: 12 test2: 12
test1: 13 test2: 13
This leads me to believe that test2 has '{test1}' as its value and outputting that in an alert or ecom will replace that with test1's value.

I had thought that test2 was getting test1's value. Oops.

_________________
Andy Cross
Back to top
View user's profile Send private message
crakerz
Mega-Poster


Joined: 17 Sep 2003
Posts: 353
Location: California Bay Area

PostPosted: Fri May 07, 2004 6:00 pm    Post subject: Reply with quote

ajcross wrote:
I would still like to put the number of units in an area into a persistent variable and have $credits too from #4. These are the least difficult.


Hey, I agree, but as I said, I don;t think it is a question of difficult, but compatibility/support.

ajcross wrote:
{variableName} can be inserted in any text to show that persistent variable.

Yes, I use that a lot (even in troubleshooting). Most of my levels use that device to some extent.

ajcross wrote:
I checked this out:
Set persistent variable 'test1' to "12"
Set persistent variable 'test2' to "{test1}"
Ecom (SmallBottom w/ Close) from Andy to Andy: "test1: {test1}@ test2: {test2}"
Modify persistent variable 'test1': Add 1
Ecom (SmallBottom w/ Close) from Andy to Andy: "test1: {test1}@ test2: {test2}"

My ECOM's came out as:
test1: 12 test2: 12
test1: 13 test2: 13
This leads me to believe that test2 has '{test1}' as its value and outputting that in an alert or ecom will replace that with test1's value.

I had thought that test2 was getting test1's value. Oops.


It led you or it still leads you? Sorry, but I wasn't sure from the above. If you create another trigger immediately following the above to test the value of test2, it won't be 12 or 13, but will be the string {test1}! What happened (and you have probably already figured this out) was this:

You set the value of test2 to the string"{test1}". When you put that into the ecom, that actual string was put in, which the engine looked at as "show the value of pvar test1", which was 13. If the above had actually worked, then the second ecom should have read:
test1: 13 test2: 12
because, test2 had never been modified (ie it would still have been twelve).

I can see where this might have a weird application, such as having a common ecom that you want to show different pvar values, which you pass through a common pvar, but other that.....BTW, I couldn't get quite the same effect in the alerts. Alerts don't like pvar strings with double {{}} in them!

_________________
Why negotiate when you can just blow things up?
------------------------------------------------------
Back to top
View user's profile Send private message Send e-mail
ajcross
Very Active User


Joined: 23 Dec 2003
Posts: 113
Location: Kansas City

PostPosted: Mon May 10, 2004 9:22 am    Post subject: Reply with quote

crakerz wrote:
ajcross wrote:
I would still like to put the number of units in an area into a persistent variable and have $credits too from #4. These are the least difficult.


Hey, I agree, but as I said, I don;t think it is a question of difficult, but compatibility/support.


How useful would these be to you? (as he shamelessly tries to keep the topic alive, so that the developers want to do it)

crakerz wrote:
ajcross wrote:
My ECOM's came out as:
test1: 12 test2: 12
test1: 13 test2: 13
This leads me to believe that test2 has '{test1}' as its value and outputting that in an alert or ecom will replace that with test1's value.


It led you or it still leads you? Sorry, but I wasn't sure from the above.

I can see where this might have a weird application, such as having a common ecom that you want to show different pvar values, which you pass through a common pvar, but other that.....BTW, I couldn't get quite the same effect in the alerts. Alerts don't like pvar strings with double {{}} in them!


Right now, "This leads me to believe that" test2 has '{test}' as its value. It never held 12 or 13. I had similar triggers that confirmed this.

I had really hoped that test2 was getting test's value rather than substituting test's value. This means that I have to use the trigger-expensive loops to transfer values.

I did have a common ECOM. This double substition would make it simpler. I would not have lots of pvars in the ECOM, I could have one pvar in the ECOM. That pvar could be set to use multiple other pvar's. Those pvar's would be set. Then the ECOM could display all the text.

I see that Show Alert has a problem showing ?test? for test2. I used ECOMs which showed test's value for test2.

_________________
Andy Cross
Back to top
View user's profile Send private message
LawrenceA
Administrator


Joined: 15 Feb 2010
Posts: 1135
Location: New Zealand

PostPosted: Sun Dec 19, 2010 2:46 am    Post subject: Reply with quote

crakerz wrote:

Set persistent variable 'MyTemp' to "{MyVarA}"

For one thing, the "{}" are not recognized/allowed in strings, as are not several other symbols (Heck, you can cause a level to crash or not even load with some symbol combos!) In fact, I've found it best to stick to Aa-Zz and 0-9. Could you please elaborate on how you were able to do that?


I just made a map thats a basic keyboard only to find crackerz speaks the truth.
it would be awesome if this was supported.
iv only done a bit because i suspected this might happen, but if anyone wants to look at it heres the link

_________________
You've just been
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Warfare Incorporated Forum Index -> Enhancement Requests All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2002 phpBB Group