|
| 12 Jul 2012 09:37 PM |
I need some top level string manipulators!
I won't post the script until a couple show themselves in vote of support. It's not a long script at all, its just a script I have to fragment a string and receive individual strings, quite simple really.
To be specific, there is only ONE line of script that doesn't work, and output wont tell me why. I've even gone to the point of making a printing output to find this out.
Help!!! |
|
|
| Report Abuse |
|
|
mamaguy
|
  |
| Joined: 07 Oct 2010 |
| Total Posts: 7073 |
|
|
| 12 Jul 2012 09:39 PM |
| I'm semi-good with string manipulation in lua. |
|
|
| Report Abuse |
|
|
|
| 12 Jul 2012 09:45 PM |
items = 0 recorded = "" search = script.Parent subject = script.Parent internal = search:GetChildren() while true do if recorded ~= subject.Name then if items == 0 then for e = 1, #internal do if string.sub(subject.Name, 1, #internal[e].Name) == internal[e].Name then items = items + 1 recorded = ""..string.sub(subject.Name, 1, #internal[e].Name).."" print(recorded) Instance.new("BoolValue", internal[e]).Name = "Item #"..items.."" end end end wait(1) followup = search:GetChildren() for i = 1, #followup do print("Here's the problem") print("Listing variables: Searching: "..followup[i].Name.." Recorded: "..recorded.."") print("Testing stringnumbers: Recorded: "..#recorded..", Search: "..#followup[i].Name..", Search in Subject: "..string.sub(subject.Name, #recorded+2, #recorded+2+#followup[i].Name)) print("Argument: ' if "..string.sub(subject.Name, #recorded+2, #recorded+2+#followup[i].Name).." == "..followup[i].Name.." then '") print("Y U NO WORK?") if string.sub(subject.Name, #recorded+2, #recorded+2+#followup[i].Name) == followup[i].Name then print("Argument passed") items = items + 1 print("Item added") recorded = recorded..", "..followup[i].Name.."" print("Recorded") print(recorded) print("Printed record") Instance.new("BoolValue", followup[i]).Name = "Item #"..items.."" print("Added value") end end end wait(0.1) end |
|
|
| Report Abuse |
|
|
|
| 12 Jul 2012 09:46 PM |
| Wow automatically I recognize some problems, I'll be right back with an updated version! |
|
|
| Report Abuse |
|
|
|
| 12 Jul 2012 09:49 PM |
items = 0 recorded = "" search = script.Parent subject = script.Parent while true do if recorded ~= subject.Name then if items == 0 then internal = search:GetChildren() for e = 1, #internal do if string.sub(subject.Name, 1, #internal[e].Name) == internal[e].Name then items = items + 1 recorded = ""..string.sub(subject.Name, 1, #internal[e].Name).."" print(recorded) Instance.new("BoolValue", internal[e]).Name = "Item #"..items.."" end end else wait(1) followup = search:GetChildren() for i = 1, #followup do print("Here's the problem") print("Listing variables: Searching: "..followup[i].Name.." Recorded: "..recorded.."") print("Testing stringnumbers: Recorded: "..#recorded..", Search: "..#followup[i].Name..", Search in Subject: "..string.sub(subject.Name, #recorded+2, #recorded+2+#followup[i].Name)) print("Argument: ' if "..string.sub(subject.Name, #recorded+2, #recorded+2+#followup[i].Name).." == "..followup[i].Name.." then '") print("Y U NO WORK?") if (string.sub(subject.Name, #recorded+2, #recorded+2+#followup[i].Name) == followup[i].Name) then print("Argument passed") items = items + 1 print("Item added") recorded = recorded..", "..followup[i].Name.."" print("Recorded") print(recorded) print("Printed record") Instance.new("BoolValue", followup[i]).Name = "Item #"..items.."" print("Added value") end end end end wait(0.1) end
|
|
|
| Report Abuse |
|
|
mamaguy
|
  |
| Joined: 07 Oct 2010 |
| Total Posts: 7073 |
|
|
| 12 Jul 2012 09:50 PM |
| Well, subject and search are the same things and what is this supposed to do? |
|
|
| Report Abuse |
|
|
|
| 12 Jul 2012 10:07 PM |
if (string.sub(subject.Name, #recorded+2, #recorded+2+#followup[i].Name) == followup[i].Name) then
THIS is the argument that wont complete.
This whole thing is to take a string list and check its children for actual objects. The search and subject will be different as this is in testing. Search will be the Parent of children being searched. Subject will be the object with the list.
Example:
Name = "Name1, Name2, Name3" Using string.sub, I want to make individual arguments for said names in the search. |
|
|
| Report Abuse |
|
|
|
| 12 Jul 2012 10:32 PM |
| Bump! Cmon scriptors get your mind workin'! |
|
|
| Report Abuse |
|
|
|
| 12 Jul 2012 11:01 PM |
Here is the exact scenario that is not functioning.
s=script.Parent i=s.Head o=s.Torso if string.sub(s.Name, #i.Name + 2, #i.Name + #o.Name + 2) == o.Name then print("This argument does not work.") end
Posting in a new thread for fresh support. |
|
|
| Report Abuse |
|
|
|
| 12 Jul 2012 11:24 PM |
items = 0 recorded = "" search = script.Parent subject = script.Parent while true do if recorded ~= subject.Name then if items == 0 then internal = search:GetChildren() for e = 1, #internal do if string.sub(subject.Name, 1, #internal[e].Name) == internal[e].Name then items = items + 1 recorded = ""..string.sub(subject.Name, 1, #internal[e].Name).."" print(recorded) Instance.new("BoolValue", internal[e]).Name = "Item #"..items.."" end end else wait(1) followup = search:GetChildren() for i = 1, #followup do print("Heres the problem") print("Listing variables: Searching: "..followup[i].Name.." Recorded: "..recorded.."") print("Testing stringnumbers: Recorded: "..#recorded..", Search: "..#followup[i].Name..", Search in Subject: "..string.sub(subject.Name, #recorded+2, #recorded+2+#followup[i].Name)) print("Y U NO WORK?") if (string.sub(subject.Name, #recorded+2, #recorded+2+#followup[i].Name) == followup[i].Name) then print("Argument passed") items = items + 1 print("Item added") recorded = recorded..", "..followup[i].Name.."" print("Recorded") print(recorded) print("Printed record") BV = Instance.new("BoolValue", followup[i]) BV.Name = "Item #"..items.."" print("Added value") end end end end wait(0.1) end
Maybe? |
|
|
| Report Abuse |
|
|