Jump to content

Goto Line, Basically ;)


sal_vager

Recommended Posts

Unfortunately this doesn't work anymore :(

Click here to go to the end of this post :D Update: Super Bonus Content!

Do you want to be able to go to specific lines in your post? I think you do, maybe it's for a mission report, or a challenge scoreboard, or maybe to pertinent parts in a large Sci Labs argume... er I mean discussion.

Well now you can do exactly that instead of spamming posts below the OP with the new and shiny Goto and Line tags :D

Here's how it looks, you'll need a Goto tag:

 
[noparse][Goto=10]Click here to go to the end of this post :D[/Goto][/noparse]

And a Line tag to go to, like this:

 
[noparse][Line=10]Welcome to the end of the post, enjoy![/line][/noparse]

You can have as many Goto's as you need as long as each one matches up to a Line, letting you organise your OP's or even posts within a thread for easier reading.

A line can be anything you want, from Basic style line numbers to keywords to entire paragraphs, you can even put a Line inside a Goto and vice versa.

Known bugs/features, a Goto will go to the first matching Line in a page, potentially causing mayhem just like the real Goto command.

Welcome to the end of the post, enjoy!

Big thanks to Vexx32, KasperVld and TechnicalFool for helping me with this.

Back to top.

 


 

And for a bonus, why not try the Post tag? These will let you link to any post on the forums without opening another browser tab or window.

This:

[noparse]Link[/noparse]

makes this:

Link

Thanks to Red Iron Crown for this one.

Back to top.

Link to comment
Share on other sites

This is BS. Everybody knows that a GOTO statement should link to a line number. So you number your lines... and then start adding minor numbers in between to make space for new lines... Then when you run out of digits you start adding "subnumbers"... Then you ditch everything out of frustration and go play with Pascal. :D

Oh my beloved Oruga 1.0, what might have you become if it wasn't because of QBASIC 1.1 (and my ignorance about sub-routines).

[/old_f$%&t_rant]

EDIT: darn, you make want to search for my QuickBasic 7 and code away some stuff. :D

Link to comment
Share on other sites

This is great, but don't you think it would be better to implement a [POINTER] tag that allows you to jump to a specific portion of the post, then forces the reader to return to the original position once he has read the indicated line(s)?

Link to comment
Share on other sites

[programmer] But goto is an unsafe command and is a security hazard! [/programmer]

Seriously, though, this is a great feature

Even before I opened the thread, I knew someone was going to say this. :D

Link to comment
Share on other sites

This is great, but don't you think it would be better to implement a [POINTER] tag that allows you to jump to a specific portion of the post, then forces the reader to return to the original position once he has read the indicated line(s)?

Just use another Goto :)

Now if only we could make an "If" statement in BB code...

Link to comment
Share on other sites


if (stupidpost == True)
deletePost(explosions=True)
else:
pass

Python pseudocode, of course.

Now, the only reason this would be hard to implement on the forums is defining "stupidPost"... The explosions would be the easy part.

This should be a pretty accurate first-order approximation:

function stupidpost(null){

return true

}

(My pseudocode knows no language)

Link to comment
Share on other sites

That's closest to JavaScript, I should think.

Me, I think that algorithm can use some improvement (bring some C# in here, you plebs!):

public bool stupidPost(Post target, User author) {
if (target.content.Length % 2 == 0)
return true;
else {
Random rnd = new Random();
int random = rnd.Next();
bool stupid = (random % 2 == 0);
switch (author.accountType) {
case AccountTypes.curiousGeorge:
return true;
break;
case AccountTypes.standard:
if (stupid)
return true;
else
return false;
break;
default:
return false;
break;
}
}
}

Edited by vexx32
Link to comment
Share on other sites

public bool stupidPost(Post target, User author) {
if (target.content.Length % 2 == 0)
return true;
else {
Random rnd = new Random();
int random = rnd.Next();
bool stupid = (random % 2 == 0);
switch (author.accountType) {
case AccountTypes.curiousGeorge:
return true;
break;
case AccountTypes.standard:
if (stupid)
return true;
else
return false;
break;
default:
return false;
break;
}
}
}

Rename some of those variables and I think you've figured out how they set Kerbal professions.

Link to comment
Share on other sites

  • 2 weeks later...
Does this work only with line numbers, or with labels, too? Y'know, it's not like it's 1985 anymore.

Why not test it? :)

[noparse][goto=test]Goto the test![/goto]

1 Not it
2 Not it
3 Not it
4 Not it
5 [line=test]The test[/line]
6 Not it
7 Not it
8 Not it
9 Not it[/noparse]

Goto the test!

1 Not it

2 Not it

3 Not it

4 Not it

5 The test

6 Not it

7 Not it

8 Not it

9 Not it

Looks like it works to me :)

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...