Make My Dream

by Kidpaddle45
Drag & Drop instead of code.
ID:1296459
 
With V.0.7 Being uploaded tonight, here is the newest feature to help out the beginners with programming: Intelli-Sense!

For those who don't know what Intelli-Sense is, it's basically automatic suggestions generated for you depending on what you write.

For example, typing "fin" would generate "findtext(Haystack,Needle,Start=1,End=0)".
Clicking on the suggestion, automatically replace what you are typing.

Here's a video showing Intelli-Sense in action!
(Watch it in fullscreen, 720P to be able to see something)

Nice!
In response to Tom
Thanks dude! I appreciate for my hard-work.
Amazing.
Very cool. Just one thing. Wouldn't it be harder to move your mouse to the button to do it automatically? Programmers generally like to be able to do all their writing without having to use their mouse. Really any time using a mouse while programming is extra time.

Would be cool if it wrote the suggestion in different colored writing on the actual page. Like

<black>ic</black><blue>on = ""</blue>

And if you hit enter then it would turn it into

<black>icon = ""</black>

I don't know how possible it is for you to do something like that but using buttons to write code seems a little counter intuitive to me, especially since I can write so much faster than pressing a button.
That's also how I wanted it to be at first but it seems having a multi-line input disables any macro. Which means pressing ENTER or any other key would simply continue typing.

If anyone can help with this, page me. =D
In response to Kidpaddle45
I've experimented with this before. It disables the default command for the element but it doesn't stop you from creating a custom macro.

What you do is add a macro to your interface for enter and have it call a verb like mob/verb/input(). Then that verb checks if your element's focus variable is true, using winget(). If they have focus on it then make the appropriate actions.

That's how I always did it.
I didn't try checking if the focus variable was true. I'll give this a shot! Thank you for the suggestion.

There is still one bug though. The feature only works in the last line you are working on because from what I know, there are no ways to return what line you are typing in, in a multi-line input.
Multi-line input uses "\n" as its line break. I did some testing to make sure. html_encode() completely strips out these macros, but if you just run a findtext(string, "\n"), it'll give you the first line break. Run this through a loop to grab all the line places.

I suppose the tricky part would be figuring out where the cursor is.
Yeah lolol that's the hard part. What I'm doing right now is simply text2list and finding the last line using something like -> list[length(list)]

I would need a feature like: winget(current-line).
In response to Kidpaddle45
I just wrote the code to find the line breaks:

            var/theString = winget(usr,"chat.input","text")
var/theSubString = theString

var/currentIndex = findtext(theString,"\n")
var/allFound = 0
var/count = 0

if(currentIndex)
count ++
while(!allFound)
theSubString = copytext(theSubString,currentIndex+1,length(theSubString)+1)
currentIndex = findtext(theSubString,"\n")
if(currentIndex != 0)
count++
else
allFound = 1
world << "Count was [count]."
else
world << "Count was zero."
In response to Zecronious
lol, that's pretty much what I told him to do :P Except it was more vague. The problem of finding out where the user's cursor is still persists.
In response to Albro1
Quite, it's not a functionality intended for BYOND. BYOND isn't a text editor, therefore it was never added.
Thank you. This is similar to what I had but the issue isn't finding the number of line breaks, it's finding the current line focused (The line the user is currently typing in).

                var/T = winget(src,"default.Codes","text")
var/TXT = text2list(T, "\n")

Currently, all I can find is the last line which is simply by doing this: TXT[length(TXT)]
Since I'm using text2list. What I need is something like this:
TXT[CurrentLine] = Blablabla (Auto-Completion code)
In response to Kidpaddle45
Yeah, to be honest the simple answer is that you can't without using a different programming language.

Also, just because I was having fun..

    proc
getLineBreaks(theString,currentIndex = -1)

var/newIndex = findtext(theString,"\n")
if(currentIndex < 0 && !newIndex) return 0

if(newIndex)
var/theSubString = copytext(theString, newIndex+ 1, length(theString)+1)
return getLineBreaks(theSubString, currentIndex) + 1

else return 1
Alrighty, thanks a lot! =D
In response to Zecronious
So just set currentIndex to -1 by default, so you don't have to put -1 every time. lol
In response to Albro1
Yeah you're right, it was late so I forgot how to do that but I was sure there was a way . Oh well, I fixed it.
After Quadro's "Amazing" comment, I got lost.

Pretty interesting stuff there though.
Tried it. Impressed.
=D
Page: 1 2