generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: String Manipulators Required!

Previous Thread :: Next Thread 
Drak0Master is not online. Drak0Master
Joined: 10 Aug 2009
Total Posts: 836
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 is not online. 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
Drak0Master is not online. Drak0Master
Joined: 10 Aug 2009
Total Posts: 836
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
Drak0Master is not online. Drak0Master
Joined: 10 Aug 2009
Total Posts: 836
12 Jul 2012 09:46 PM
Wow automatically I recognize some problems, I'll be right back with an updated version!
Report Abuse
Drak0Master is not online. Drak0Master
Joined: 10 Aug 2009
Total Posts: 836
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 is not online. 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
Drak0Master is not online. Drak0Master
Joined: 10 Aug 2009
Total Posts: 836
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
Drak0Master is not online. Drak0Master
Joined: 10 Aug 2009
Total Posts: 836
12 Jul 2012 10:32 PM
Bump! Cmon scriptors get your mind workin'!
Report Abuse
Drak0Master is not online. Drak0Master
Joined: 10 Aug 2009
Total Posts: 836
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
ninjaknight101 is not online. ninjaknight101
Joined: 04 Apr 2011
Total Posts: 1281
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image