| View previous topic :: View next topic |
| Author |
Message |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Sat Sep 07, 2002 2:45 pm Post subject: |
|
|
This is an example of the 'Secret Language' that some little children use, in other words: 'hello world' will be translated into 'ifmmp xpsme'.
| Code: |
%%String = abcdefghijklmnopqrstuvwxyz
rem This number can higher than 26
%%Charactersup = 27
gosub Characterup
info %%String
exit
:Characterup
if @greater(%%Charactersup,26)
repeat
%%Charactersup = @diff(%%Charactersup,26)
until @greater(26,%%Charactersup)
end
%z = 0
repeat
if @not(@greater(@fadd(@asc(@substr(%%String,%z,%z)),%%Charactersup),@asc(z)))
if @not(@equal(@asc(@substr(%%String,%z,%z)),32))
%%String = @strins(@strdel(%%String,%z,%z),%z,@chr(@fadd(@asc(@substr(%%String,%z,%z)),%%Charactersup)))
else
%%String = @strins(@strdel(%%String,%z,%z),%z,@chr(32))
end
else
if @not(@equal(@asc(@substr(%%String,%z,%z)),32))
%%String = @strins(@strdel(%%String,%z,%z),%z,@chr(@diff(@fadd(@asc(@substr(%%String,%z,%z)),%%Charactersup),26)))
else
%%String = @strins(@strdel(%%String,%z,%z),%z,@chr(32))
end
end
%z = @succ(%z)
until @equal(@pred(%z),@len(%%String))
exit |
|
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Sat Sep 07, 2002 4:07 pm Post subject: |
|
|
LOL, "pig latin" anyone?
| Code: |
rem -- Use @trim() on unknown strings --
%%tmp = "this is a test"
OPTION FIELDSEP, @chr(32)
REPEAT
PARSE "%a", %%tmp
%%tmp = @strdel(%%tmp, 1, @succ(@len(%a)))
%s = %s@substr(%a, 2, @len(%a))" "@substr(%a, 1)ay" "
UNTIL @greater(1, @len(%%tmp))
INFO %s
|
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Sat Sep 07, 2002 6:54 pm Post subject: |
|
|
His tay s iay aay est tay??
Well, if pigs speak like that, isn't it better if they go to school???  |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Sat Sep 07, 2002 7:21 pm Post subject: |
|
|
LOL skit,
I guess for it to be "proper" pig latin, it should treat
dual letters that make one sound (such as "th", "ch",
etc.) as a single letter.
For example, "this" should prolly be "is thay". It just
didn't really seem worth the trouble...
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Sat Sep 07, 2002 7:27 pm Post subject: |
|
|
I can't get enough of all these String manipulate functions.
| Code: |
%%Reverse = "This is a test"
gosub Reverse-wfw
info %%Reverse
exit
:Reverse-wfw
option fieldsep,@chr(32)
repeat
parse "%%word",%%Reverse
%%Reverse = @strdel(%%Reverse,1,@succ(@len(%%word)))
if @not(@equal(%%justavariable,))
%%justavariable = %%justavariable" "
end
if %%word
repeat
%%justavariable = %%justavariable@substr(%%word,@len(%%word),@len(%%word))
%%word = @strdel(%%word,@len(%%word),@len(%%word))
until @greater(1,@len(%%word))
end
until @greater(1,@len(%%Reverse))
%%Reverse = %%justavariable
exit |
Ps. Does anybody have an idea for another one? |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Sat Sep 07, 2002 7:54 pm Post subject: |
|
|
OK, here's a more grammatically correct "pig latin" example...
Feel free to add more stuff to list 1 and 2 (or to the code).
| Code: |
rem -- Use @trim() on unknown strings --
%%tmp = "this is a serious test"
rem -- Some starting letter pairs that make one sound --
LIST CREATE, 1
LIST ADD, 1, "th"
LIST ADD, 1, "ch"
LIST ADD, 1, "ph"
rem -- Some two letter words starting with a vowel --
LIST CREATE, 2
LIST ADD, 2, "at"
LIST ADD, 2, "if"
LIST ADD, 2, "is"
LIST ADD, 2, "of"
LIST ADD, 2, "on"
OPTION FIELDSEP, @chr(32)
REPEAT
LIST SEEK, 1, 0
LIST SEEK, 2, 0
PARSE "%a", %%tmp
rem -- Starting with letter pair --
if @match(1, @substr(%a, 1, 2))
%s = %s@substr(%a, 3, @len(%a))" "@substr(%a, 1, 2)ay" "
else
rem -- Single letter word, or two letter word starting with vowel --
if @equal(@len(%a), 1) @both(@equal(@len(%a), 2), @match(2, %a))
%s = %s%a" "ay" "
else
%s = %s@substr(%a, 2, @len(%a))" "@substr(%a, 1)ay" "
end
end
%%tmp = @strdel(%%tmp, 1, @succ(@len(%a)))
UNTIL @greater(1, @len(%%tmp))
INFO %s
|
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Sat Sep 07, 2002 8:10 pm Post subject: |
|
|
Next thing to make: a pig spell-checker???
Oops... I made something like that already for Serge:
| Code: |
dialog CREATE,Spell checker,-1,0,541,253
dialog ADD,EDIT,TEXT,22,20,318,182,hllo hwo are you tody in ameriiica,MULTI,WRAP,SCROLL
dialog ADD,BUTTON,BUTTON1,210,18,64,24,Spellcheck
dialog ADD,BUTTON,BUTTON2,180,344,180,24,No suggestion
dialog ADD,LIST,SUGGESTIONS,36,344,180,138,SORTED,CLICK
dialog ADD,TEXT,word,22,346
dialog ADD,MENU,-,ENTER|ENTER
dialog SHOW
list add,SUGGESTIONS
list create,1
list loadtext,1,sorted
"
"hello
"america
"hi
"hill
"hull
"how
"who
"ho
"tod
"toady
"today
"todd
:evloop
wait event
%%event = @event()
goto %%event
:Button1button
%%text = @trim(@dlgtext(TEXT))
option fieldsep,@chr(32)
%%chr32pos = @pos(@chr(32))
:spellcheckloop
parse "%%word",%%text
dialog set,word,%%word
%%text = @strdel(%%text,1,@succ(@len(%%word)))
list seek,1,0
list seek,SUGGESTIONS,0
if @equal(@item(SUGGESTIONS,0))
list delete,SUGGESTIONS
end
rem %x countains the number off suggestions
%x = 5
repeat
if @greater(%x,0)
%z = 0
repeat
if @match(1,@substr(%%word,%z,@fadd(%z,2)))
if @not(@match(SUGGESTIONS,@item(1)))
list add,suggestions,@item(1)
end
end
%z = @succ(%z)
until @equal(%z,@len(%%word))
end
%x = @pred(%x)
until @equal(%x,0)
wait event
%%event = @event()
if @equal(%%event,SUGGESTIONSCLICK)
%%newtext = %%newtext @item(SUGGESTIONS)
dialog set,text,@trim(%%newtext %%text)
list clear,SUGGESTIONS
list add,SUGGESTIONS
if @not(@null(%%text))
goto spellcheckloop
end
end
if @equal(%%event,Button2button)
%%newtext = %%newtext %%word
dialog set,text,@trim(%%newtext %%text)
list clear,SUGGESTIONS
list add,SUGGESTIONS
if @not(@null(%%text))
goto spellcheckloop
end
end
if @equal(%%event,close)
goto Close
end
%%text =
%%newtext =
%%word =
goto evloop
:Button2button
rem Only works if the spell-checker is activated...
goto evloop
:Entermenu
warn "This is disable. Make the script to work with @cr()@chr(10)"
goto evloop
:Close
exit
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|