Mystic Software Forums
Mystic Software => General Discussion => Topic started by: matt72186 on September 18, 2004, 04:41:56 AM
-
<!--r1--><div class='codetop'>CODE</div><div class='codemain'><span style="font-family:courier;font-size:11px;white-space:pre;"><span style="color:#F80;">
<a name="ID585af8303d7c349e3a89aa9340f3846dLINE1" />:: <span style="color:#F80;">1</span> :: </a>
<a name="ID585af8303d7c349e3a89aa9340f3846dLINE2" />:: <span style="color:#F80;">2</span> :: <span style="color:#00F;font-weight:bold;">If</span><span style="color:#94F;">(rpgcodehighlighter==<span style="color:#888;">"Awesome"</span>)</span> <span style="color:#084;font-style:italic;">//test<span></a>
<a name="ID585af8303d7c349e3a89aa9340f3846dLINE3" />:: <span style="color:#F80;">3</span> :: <span style="color:#94F;">{</span>
<a name="ID585af8303d7c349e3a89aa9340f3846dLINE4" />:: <span style="color:#F80;">4</span> :: <span style="color:#00F;font-weight:bold;">MWin</span><span style="color:#94F;">(<span style="color:#888;">"This tool rocks"</span>)</span></a>
<a name="ID585af8303d7c349e3a89aa9340f3846dLINE5" />:: <span style="color:#F80;">5</span> :: <span style="color:#94F;">}</span>
<a name="ID585af8303d7c349e3a89aa9340f3846dLINE6" />:: <span style="color:#F80;">6</span> :: <span style="color:#00F;font-weight:bold;">Else</span><span style="color:#94F;">()</span></a>
<a name="ID585af8303d7c349e3a89aa9340f3846dLINE7" />:: <span style="color:#F80;">7</span> :: <span style="color:#94F;">{</span>
<a name="ID585af8303d7c349e3a89aa9340f3846dLINE8" />:: <span style="color:#F80;">8</span> :: <span style="color:#00F;font-weight:bold;">MWin</span><span style="color:#94F;">(<span style="color:#888;">"It still is cool!!!"</span>)</span></a>
<a name="ID585af8303d7c349e3a89aa9340f3846dLINE9" />:: <span style="color:#F80;">9</span> :: <span style="color:#94F;">}</span>
<a name="ID585af8303d7c349e3a89aa9340f3846dLINE10" />:: <span style="color:#F80;">10</span> :: </a>
<a name="ID585af8303d7c349e3a89aa9340f3846dLINE11" />:: <span style="color:#F80;">11</span> :: <span style="color:#084;font-style:italic;">*comment</span>
<a name="ID585af8303d7c349e3a89aa9340f3846dLINE12" />:: <span style="color:#F80;">12</span> :: </a>
<a name="ID585af8303d7c349e3a89aa9340f3846dLINE13" />:: <span style="color:#F80;">13</span> :: </a>
</span><form action="sources/misc/save_prg.php" method="POST"><textarea style="display:none" name="source">
If(rpgcodehighlighter=="Awesome") //test
{
MWin("This tool rocks")
} //test
Else()
{
MWin("It still is cool!!!")
}
//Comment
*comment
</textarea><input type="submit" value="Save" /><input type="checkbox" name="html" value="true" /> Save As HTML?</form></span></div><span style="display:none"><!--er1--><!--r2-->
If(rpgcodehighlighter=="Awesome") //test
{
MWin("This tool rocks")
} //test
Else()
{
MWin("It still is cool!!!")
}
//Comment
*comment
<!--er2--><!--r3--></span><!--er3-->
Yes it works! so from now on if you use RPG Code in your posts make sure you use the [ rpgcode ] bbcode, it'll syntax highlight your code, indent it, and will allow anyone to save your code as plain RPG Code or as a Syntax Highlighted HTML. Essentially this allows instant hosting of RPG Code files directly from the forum.
-
<!--rpgcode1--><div class='codetop'>CODE</div><div class='codemain'><span style="font-family:courier;font-size:11px;white-space:pre;">
<span style="color:#00F;font-weight:bold;">If</span><span style="color:#80F;">(</span>thenewcode$=="bodatious"<span style="color:#80F;">)</span>
{
<span style="color:#00F;font-weight:bold;">MWin</span><span style="color:#80F;">(</span>"This is the awsomexe"<span style="color:#80F;">)</span>
}
<span style="color:#00F;font-weight:bold;">If</span><span style="color:#80F;">(</span>thenewcode$=="bogus"<span style="color:#80F;">)</span>
{
<span style="color:#00F;font-weight:bold;">MWin</span><span style="color:#80F;">(</span>"Then I'm a monky's <span style="color:#048;">uncle!</span>"<span style="color:#80F;">)</span>
}
</span></div><!--rpgcode2--><hr /><form action="sav_rpgcode.php" method="POST"><a href="javascript:ShowHide('rpgcode0.06336900 1095523822_open','rpgcode0.06336900 1095523822_closed');">Save RPG Code</a>
<span id="rpgcode0.06336900 1095523822_open" style="display:none;"><textarea name="code" cols="60" rows="10">
If(thenewcode$=="bodatious")
{
MWin("This is the awsomexe")
}
If(thenewcode$=="bogus")
{
MWin("Then I'm a monky's uncle!")
}
</textarea>
<input type="submit" value="Save File" />
Preferred output method
RPG Code Program (*.prg): <input type="radio" name="output" value="program" checked />
HTML Syntax Highlighted (*.html): <input type="radio" name="output" value="html" />
GZip Compression?: <input type="checkbox" name="compress" value="true" /><hr /></span></form><!--rpgcode3-->
Very Happy Razz
-
Ooo, nice. Let's see if we can break it...
<!--rpgcode1--><div class='codetop'>CODE</div><div class='codemain'><span style="font-family:courier;font-size:11px;white-space:pre;">
<span style="color:#084;font-style:oblique;">*Board airship</span>
#<span style="color:#00F;font-weight:bold;">newplyr</span><span style="color:#80F;">(</span>"airship.tem"<span style="color:#80F;">)</span>
#<span style="color:#00F;font-weight:bold;">putplayer</span><span style="color:#80F;">(</span>playerHandle[0]$,playerX[0]!,playerY[0]!,<span style="color:#F80;">2</span><span style="color:#80F;">)</span> *We'll assume the layer 2 is the "air" layer
<span style="color:#084;font-style:oblique;">*And to land:</span>
#<span style="color:#00F;font-weight:bold;">newplyr</span><span style="color:#80F;">(</span>"hero.tem"<span style="color:#80F;">)</span>
#<span style="color:#00F;font-weight:bold;">putplayer</span><span style="color:#80F;">(</span>playerHandle[0]$,playerX[0]!,playerY[0]!,<span style="color:#F80;">1</span><span style="color:#80F;">)</span> * 1 is the ground layer
<span style="color:#084;font-style:oblique;">*Now, of course all this does is change the hero into a flying ship and</span>
<span style="color:#084;font-style:oblique;">*back again at will. If you want to leave the ship and have it stay there</span>
<span style="color:#084;font-style:oblique;">*for you to come back to later, you'll have to "remember" where you</span>
<span style="color:#084;font-style:oblique;">*parked it. Your landing method would look something like this:</span>
#<span style="color:#00F;font-weight:bold;">newplyr</span><span style="color:#80F;">(</span>"hero.tem"<span style="color:#80F;">)</span>
#<span style="color:#00F;font-weight:bold;">putplayer</span><span style="color:#80F;">(</span>playerHandle[0]$,playerX[0]!,playerY[0]!,<span style="color:#F80;">1</span><span style="color:#80F;">)</span>
<span style="color:#084;font-style:oblique;">*Remember where we put it</span>
#<span style="color:#048;">airship_X_location!</span>=playerX[0]!
#<span style="color:#048;">airship_Y_location!</span>=playerY[0]!
#airship_board$=BoardTitle[8]$
<span style="color:#084;font-style:oblique;">* You have to get creative here, since there's no variable that</span>
<span style="color:#084;font-style:oblique;">*contains the name of the current board. One way is to fill in</span>
<span style="color:#084;font-style:oblique;">*the name of the current board as one the layer names in the</span>
<span style="color:#084;font-style:oblique;">*board editor.</span>
#<span style="color:#00F;font-weight:bold;">layerput</span><span style="color:#80F;">(</span><span style="color:#048;">airship_X_location!</span>,airship_Y_location, <span style="color:#F80;">2</span>, "airship.gph"<span style="color:#80F;">)</span> * set down an image of the parked airship on the board
<span style="color:#084;font-style:oblique;">*Now to get on the airship, you need to check if the player is standing over it:</span>
#<span style="color:#00F;font-weight:bold;">if</span><span style="color:#80F;">(</span>airship_board$=BoardTitle[8]$<span style="color:#80F;">)</span>
{
#<span style="color:#00F;font-weight:bold;">if</span><span style="color:#80F;">(</span><span style="color:#048;">airship_X_location!</span>=playerX[0]!<span style="color:#80F;">)</span>
{
#<span style="color:#00F;font-weight:bold;">if</span><span style="color:#80F;">(</span><span style="color:#048;">airship_Y_location!</span>=playerY[0]!<span style="color:#80F;">)</span>
{
#<span style="color:#00F;font-weight:bold;">newplyr</span><span style="color:#80F;">(</span>"airship.tem"<span style="color:#80F;">)</span>
#<span style="color:#00F;font-weight:bold;">putplayer</span><span style="color:#80F;">(</span>playerHandle[0]$,playerX[0]!,playerY[0]!,<span style="color:#F80;">2</span><span style="color:#80F;">)</span>
}
}
}
<span style="color:#084;font-style:oblique;">* Also, you'll probably want the player to be able to see the airship</span>
<span style="color:#084;font-style:oblique;">* if you leave the board and come back. In your warp programs,</span>
<span style="color:#084;font-style:oblique;">* you'll have to do something like this:</span>
#<span style="color:#00F;font-weight:bold;">send</span><span style="color:#80F;">(</span> ... <span style="color:#80F;">)</span>
#<span style="color:#00F;font-weight:bold;">if</span><span style="color:#80F;">(</span>airship_board$=BoardTitle[8]$<span style="color:#80F;">)</span>
{
#<span style="color:#00F;font-weight:bold;">layerput</span><span style="color:#80F;">(</span><span style="color:#048;">airship_X_location!</span>,<span style="color:#048;">airship_Y_location!</span>, <span style="color:#F80;">2</span>, "airship.gph"<span style="color:#80F;">)</span>
}
#done
</span></div><!--rpgcode2--><hr /><form action="sav_rpgcode.php" method="POST"><a href="javascript:ShowHide('rpgcode0.60424900 1095534496_open','rpgcode0.60424900 1095534496_closed');">Save RPG Code</a>
<span id="rpgcode0.60424900 1095534496_open" style="display:none;"><textarea name="code" cols="60" rows="10">
*Board airship
#newplyr("airship.tem")
#putplayer(playerHandle[0]$,playerX[0]!,playerY[0]!,2) *We'll assume the layer 2 is the "air" layer
*And to land:
#newplyr("hero.tem")
#putplayer(playerHandle[0]$,playerX[0]!,playerY[0]!,1) * 1 is the ground layer
*Now, of course all this does is change the hero into a flying ship and
*back again at will. If you want to leave the ship and have it stay there
*for you to come back to later, you'll have to "remember" where you
*parked it. Your landing method would look something like this:
#newplyr("hero.tem")
#putplayer(playerHandle[0]$,playerX[0]!,playerY[0]!,1)
*Remember where we put it
#airship_X_location!=playerX[0]!
#airship_Y_location!=playerY[0]!
#airship_board$=BoardTitle[8]$
* You have to get creative here, since there's no variable that
*contains the name of the current board. One way is to fill in
*the name of the current board as one the layer names in the
*board editor.
#layerput(airship_X_location!,airship_Y_location, 2, "airship.gph") * set down an image of the parked airship on the board
*Now to get on the airship, you need to check if the player is standing over it:
#if(airship_board$=BoardTitle[8]$)
{
#if(airship_X_location!=playerX[0]!)
{
#if(airship_Y_location!=playerY[0]!)
{
#newplyr("airship.tem")
#putplayer(playerHandle[0]$,playerX[0]!,playerY[0]!,2)
}
}
}
* Also, you'll probably want the player to be able to see the airship
* if you leave the board and come back. In your warp programs,
* you'll have to do something like this:
#send( ... )
#if(airship_board$=BoardTitle[8]$)
{
#layerput(airship_X_location!,airship_Y_location!, 2, "airship.gph")
}
#done
</textarea>
<input type="submit" value="Save File" />
Preferred output method
RPG Code Program (*.prg): <input type="radio" name="output" value="program" checked />
HTML Syntax Highlighted (*.html): <input type="radio" name="output" value="html" />
GZip Compression?: <input type="checkbox" name="compress" value="true" /><hr /></span></form><!--rpgcode3-->
-
Not bad. It strips out empty newlines, though (which really isn't too much of a problem). Also, maybe a fix for the same line comments would be to detect if there's a ")" preceeding the "*".
-
Ooooo! An Admin double posting!? What next a police officer running a red light?
Wait...nevermind.... :unsure:
-
Well actually in TK3 the * for comments is a bit deprecated now in favor of double slashes //, a meager attempt to distinguish multiplication from //, * comments are left in for backwards compatibility of course, but currently I'm only accepting // for comments and only * comments if they're on their own line.
Hmm... I think I'll add a check for ) before a * for those comments, that'll work better
-
Ooooo! An Admin double posting!?
*Bans Dude Man*
-
Very Happy OH NO I'VE BEEN BANNED! Razz
LOL, Your funny Xorguy!
But that was mean....now I'm sad Sad ....
Razz