'S' update as of 4/12/11

New releases and general discussions.

Post » Thu Dec 15, 2011 7:33 pm

[QUOTE=Juryiel] I'm having a problem with loops:

->Make Super Array {""}: "ASDF"
->Make String Array {"ASDF"}: "stringasdf" with default 0
+"asdfloop" For Each String at {"ASDF"}

This causes a crash. [/QUOTE]

's' is very stable. That means, for me it is only crashing, if I did something wrong or illogical.
Be careful of what you define and how:
- You need a super to store some string arrays.
- You need one string array to store some strings.
- You need to tell the loop the complete path to the string array of interest to loop through.

In the example above you added a string array with the name "stringasdf" to the super "ASDF", but you expect 's' to loop through "ASDF", which is no string array. The correct path would be

"asdfloop" For Each String at {"ASDF", "stringasdf"}

Of course, you should add some strings to "stringasdf" or else there is nothing to loop through ;)

Here is an example cap: using_s_string_loop.captulamide2011-12-15 19:42:12
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Thu Dec 15, 2011 7:39 pm

Double post because of "500 - Internal server error"tulamide2011-12-15 19:40:53
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Sun Dec 25, 2011 4:03 am

Thanks for the reply. And sorry for the late response, I do read and appreciate all help, but as I said in another thread, I work on my game on and off in a casual pace :) I will give it a shot, I misunderstood how S works with loops, but now I think I get it.

But I was actually trying to loop through the string arrays that are part of "ASDF", so I guess instead I have to loop through using the Super loop right?Juryiel2011-12-25 04:10:01
B
11
S
2
G
3
Posts: 283
Reputation: 1,968

Post » Sun Dec 25, 2011 5:31 am

Hmm, how to reference the specific string array then?

So I have a Super "ASDF"
String array "stringasdf1"
String array "stringasdf2"
...
String array "stringasdfN"

Each has 3 strings in it.

I want to loop through the string arrays in "ASDF" (so not through the actual strings, but the arrays 1 to N themselves). However, I don't actually know the names ahead of time and there can be a wide variety of names, so I want some numerical or loop-based (e.g. current array in loop, loopindex, etc) way to access them. however, if I do:

{"ASDF","stringasdf1",1} this works but
{"ASDF",0,1} this doesn't work (or also loopindex instead of 0 doesn't work). How do i go about doing this?

I also tried using "l" but it's also crashing so I must be doing something wrong. I did this:

For Each Super in "ASDF"
S.s({"ASDF","stringasdf1",0}) ####This works
S.s({"l","loopname",0}) ####This crashes. Juryiel2011-12-26 07:51:46
B
11
S
2
G
3
Posts: 283
Reputation: 1,968

Post » Tue Dec 27, 2011 12:20 am

Ok I figured out how to do what I want. I didn't realize that array names and indices are not interchangeable (e.g. that if you want Value 3, in Array2, located in Array1, you don't do {"Array1",0,2} but you do {"Array1",0,"Array2",2}) but instead you specify the name of the array, and then the index you want. That was a bit confusing to me but I see why it was done the way it was and it is clearly the best way to do it even if unintuitive to noobs like me at first.

However, it seems that "end" doesn't work in the {""} address method. Instead, I have to do something like {"Array1",0,"Array2",S.sule({"Array1","Array2"})) to get the last element in Array2 or to add elements to the last structure in Array2 (note that this is different from adding to the last element in Array2 in which case you can add to "end")

Well it works, yay. If there's a better method to refer to the last element in {""} notation that would be great, I tried to parse the tutorials for the 50th time in figuring out my issues, but I seem to lose track and get confused of how this works :)
B
11
S
2
G
3
Posts: 283
Reputation: 1,968

Post » Tue Dec 27, 2011 3:41 am

Hmm ran into another problem:
Make Super Array {""}: "NPCDebuffs" with default 0
For Each NonPlayers (this is a family)
->S: insert super "default" to {"NPCDebuffs"}
->S: Make Super Array {"NPCDebuffs", S.sule({"NPCDebuffs"})}: str(NonPlayers.UID)
->DebugText: Set text to DebugText.Text & str(S.sule({NPCDebuffs",str(NonPlayers.UID)})) & " "


This will cause a crash. But if I put in the UID of the lowest NonPlayers object ("290" in this case), it works correctly. If I put in any of the other ones ("293", "296", "299" in this case), it will crash.

However, if I check the Size-1 of the "NPCDebuffs" super, it is actually 3, which is correct. So I guess the arrays are not being named correctly for whatever reason. Is there some way I can check the names ?

if I change ->S: Make Super Array {"NPCDebuffs", S.sule({"NPCDebuffs"})} to remove the S.sule, then it works. So I guess I'm still missing how this works conceptually speaking.

One other issue, is that if I try to get the size-1 of an array that's empty, I get a very large number. Is there some other way to determine if an array is empty?Juryiel2011-12-27 03:52:22
B
11
S
2
G
3
Posts: 283
Reputation: 1,968

Post » Mon Jan 30, 2012 1:24 am

The links in the first post don't work.
B
18
S
4
G
1
Posts: 413
Reputation: 2,512

Post » Thu Feb 02, 2012 6:57 pm

[QUOTE=Urled] The links in the first post don't work.[/QUOTE]

They seem to work fine for me? Are you still having problems? Maybe I can re-host them if needed.

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
45
S
17
G
37
Posts: 2,853
Reputation: 25,966

Post » Mon Mar 12, 2012 11:22 am

It would be desirable to have fuller manual of S-plugin if it is possible.
Grestord2012-03-12 11:24:24
B
3
G
1
Posts: 3
Reputation: 535

Post » Mon Mar 12, 2012 1:43 pm

hi grestord. I agree. There are a number of other improvements to S I'd like to make, aside from documentation. Since I wrote 's' I've learned alot, and I think I could make something much more accessible the second time around.

Unfortunately at the moment working fulltime on Spriter so I won't have time to work on any side projects like this for the time being. If you have any specific questions though, I or one of the other S users may be able to help you.lucid2012-03-12 13:46:30
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

PreviousNext

Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 1 guest