pighead10
|
  |
| Joined: 03 May 2009 |
| Total Posts: 10341 |
|
|
| 22 Jun 2012 10:32 AM |
A user uses a plugin, which tells him to click in as many places as he likes to position the waypoints for a bot to walk to. The bot needs to realise these waypoints so it can walk to them. Storing only the position is not really an option, as users will want to reposition the waypoints.
So the bot needs to have some way of knowing which bricks it has to go to. I could use StringValues and store the name, but then the objects would have to be in the same directory and must not be renamed. ObjectValues fail when the user changes its parent or name in any way. What would be the best method? |
|
|
| Report Abuse |
|
|
NXTBoy
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 4533 |
|
|
| 22 Jun 2012 10:56 AM |
| Just put a bunch of parts in a model called "Waypoints" in the workspace? |
|
|
| Report Abuse |
|
|
pighead10
|
  |
| Joined: 03 May 2009 |
| Total Posts: 10341 |
|
|
| 22 Jun 2012 10:58 AM |
Forgot to mention a few points:
-There can be an unlimited amount of bots, so the waypoints will need to be matched to each one individually. -The waypoints need to be ordered. |
|
|
| Report Abuse |
|
|
|
| 22 Jun 2012 11:01 AM |
| You only need the position. If you want to edit the waypoints later, render them using those positions. |
|
|
| Report Abuse |
|
|
NXTBoy
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 4533 |
|
|
| 22 Jun 2012 11:11 AM |
| A JSON string stored in a script? |
|
|
| Report Abuse |
|
|
pighead10
|
  |
| Joined: 03 May 2009 |
| Total Posts: 10341 |
|
|
| 22 Jun 2012 11:20 AM |
@popin - but the user needs to reposition them. I could make another button which says "reposition" and make that edit the positions but that isn't really convenient for the user.
@NXT - JSON? *googles* |
|
|
| Report Abuse |
|
|
NXTBoy
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 4533 |
|
|
| 22 Jun 2012 11:30 AM |
Actually, it'd probably be better to just generate lua code:
Saving:
local listOfWaypoints = {...} --vector3s
local generatedSource = "" for _, vector in ipairs(listOfWaypoints) do if _ ~= 1 then generatedSource = generatedSource + ',\n' end generatedSource += ("\tVector3.new(%f, %f, %f)"):format(v.x, v.y, v.z) end
workspace.SomeBot.Waypoints.Source = "_G[script] = {\n"..generatedSource.."\n}\n"
Using in game:
print _G[workspace.SomeBot.Waypoints]
Loading from the plugin:
loadstring(workspace.SomeBot.Waypoints.Source)(); print _G[workspace.SomeBot.Waypoints] |
|
|
| Report Abuse |
|
|
NXTBoy
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 4533 |
|
|
| 22 Jun 2012 11:31 AM |
| Ok, so I wrote some of that as javascript. String concatenation is `..`, not `+`... |
|
|
| Report Abuse |
|
|
Oysi
|
  |
| Joined: 06 Jul 2009 |
| Total Posts: 9058 |
|
| |
|
zars15
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 9999 |
|
|
| 22 Jun 2012 12:44 PM |
| Ololol do it oysi style! Make so it makes grid like valve does. Make so it puts way points after 2 studs diognaly. |
|
|
| Report Abuse |
|
|
|
| 22 Jun 2012 02:03 PM |
@zars
You only need the positions when saving the waypoints, what do you not understand about that? When it comes time for user interaction, you render them and reference each waypoint from a table in your script.
omfgyusodothis |
|
|
| Report Abuse |
|
|
zars15
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 9999 |
|
|
| 22 Jun 2012 02:48 PM |
| That's what i meant. Each time it will create table with checkerboard pattern positions. |
|
|
| Report Abuse |
|
|
pighead10
|
  |
| Joined: 03 May 2009 |
| Total Posts: 10341 |
|
|
| 22 Jun 2012 04:40 PM |
"You only need the positions when saving the waypoints, what do you not understand about that? When it comes time for user interaction, you render them and reference each waypoint from a table in your script. "
What way which would be convenient for the user do you suggest I do this in?! |
|
|
| Report Abuse |
|
|
|
| 22 Jun 2012 07:15 PM |
| You start rendering at startup, and save the positions per change. |
|
|
| Report Abuse |
|
|
|
| 22 Jun 2012 08:33 PM |
@pig this is what popin is saying i think
1) user clicks to place waypoints 2) user wants to reposition waypoints. press reposition button and make waypoints visible 3) user clicks waypoint, then clicks again to move it 4) repeat 3 until done repositioning. then click "save" button or something. |
|
|
| Report Abuse |
|
|
pighead10
|
  |
| Joined: 03 May 2009 |
| Total Posts: 10341 |
|
|
| 23 Jun 2012 04:25 AM |
"I could make another button which says "reposition" and make that edit the positions but that isn't really convenient for the user."
No one reads my posts? |
|
|
| Report Abuse |
|
|
|
| 23 Jun 2012 10:38 AM |
| WHY DID THIS QUESTION NEED BE ASKED? WHAT SORT OF MENTAL DEFICIENCY DO YOU HAVE? |
|
|
| Report Abuse |
|
|
pighead10
|
  |
| Joined: 03 May 2009 |
| Total Posts: 10341 |
|
|
| 23 Jun 2012 10:50 AM |
| The question needed to be asked because I couldn't think of a better way than the ones I had suggested. Apparently neither can anyone here, because scripters are sticking to the stereotype of "efficiency > user convenience", which sort of beats the purpose of my plugin... :) |
|
|
| Report Abuse |
|
|
|
| 23 Jun 2012 01:40 PM |
@pighead
OMFG WHAT DO YOU NOT UNDERSTAND ABOUT SAVING POSITION--- YOU KNOW WHAT, SINCE YOU OBVIOUSLY HAVEN'T LEARNED ANYTHING THROUGH YEARS OF SCRIPTING I SUGGEST YOU ACTUALLY TRY FROM NOW ON.
*hits pighead over the head with a cast iron frying pan* |
|
|
| Report Abuse |
|
|
pighead10
|
  |
| Joined: 03 May 2009 |
| Total Posts: 10341 |
|
|
| 23 Jun 2012 01:46 PM |
*engages in lightsaber/cast iron frying pan war*
what do you not understand about my scenario. Yes, I can save position but then to edit the position while still being convenient to the user... |
|
|
| Report Abuse |
|
|
|
| 23 Jun 2012 02:40 PM |
You are writing the code that changes the actual position of the "node." Seriously, you can dynamically save the content as it changes.
1. Render nodes based on position 2. Save node position when changed
WHAT DO YOU NOT UNDERSTAND ABOUT THAT?! IT'S PERFECTLY [expletive] TRANSPARENT AND REQUIRES NO USER INTERACTION!!! |
|
|
| Report Abuse |
|
|
pighead10
|
  |
| Joined: 03 May 2009 |
| Total Posts: 10341 |
|
|
| 23 Jun 2012 03:07 PM |
| and how do I detect when they have been changed! |
|
|
| Report Abuse |
|
|