-
Notifications
You must be signed in to change notification settings - Fork 20
Feature: printf()
Rook edited this page Apr 1, 2015
·
1 revision
The function printf() in Rhost can be used to greatly reduce coding in efforts for outputs, screens and data display. It can automatically center, justify and wrap the text parameters given to it.
Consider the following examples:
> @emit printf(|$-12s|$12s|$^12s$&14s$_12s|,a b c, d e f, g h i, wrap(lnum(20),12, l, |, |), j k l)
|a b c | d e f| g h i |0 1 2 3 4 5 |j k l|
|6 7 8 9 10 |
|11 12 13 14 |
|15 16 17 18 |
|19 |
> @emit printf($14&s $^4&s $-3&s $15&s,
iter(Bruised|Hurt|Injured|Wounded|Mauled|Crippled|Incapacitated,##,|,%R),
iter(|-1|-1|-2|-2|-5|,##,|,%r),iter(lnum(1,7),%[[if(gte(get(%#/damage),##),X,%b)]%],,%r),
* Aggravated%RX Lethal%R/ Bashing)
Bruised [ ] * Aggravated
Hurt -1 [ ] X Lethal
Injured -1 [ ] / Bashing
Wounded -2 [ ]
Mauled -2 [ ]
Crippled -5 [ ]
Incapacitated [ ]
> @emit [printf($-10|"'s$-60|"s,a b c d e f g h i j k l m n o p q r s t u v w x y z,
this is a test a groovy test blah blah blah [repeat(blah%b,100)])]END!
a b c d e this is a test a groovy test blah blah blah blah blah blah
f g h i j blah blah blah blah blah blah blah blah blah blah blah blah
k l m n o blah blah blah blah blah blah blah blah blah blah blah blah
p q r s t blah blah blah blah blah blah blah blah blah blah blah blah
u v w x y blah blah blah blah blah blah blah blah blah blah blah blah
z blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah END!