TGC Codebase Backup



This engine teach you how to manipulate strings on a funny way: by The Nerd

3rd Oct 2004 3:41
Summary

you will learn how to type a name in(you can also write other things) and then it will be spelled backwards:-).



Description



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    remstart
this engine is made by: The Nerd
this little engine can help you so you can learn more about strings
fell free to use the code in you game or program
remend

`´ okay first we need to make the input so the user can type a word in
`´ to make an input so the user can type a word in the program you just use the INPUT command
`´ after the input you can add a text like this:
`` INPUT "write you name : "
`´ now we need to make the word the user type in to a string you do it like this:
`´INPUT "write you name : ", name$
`´always remember the $ sign so DB knows to handle it as a string
`´ okay know we have this: INPUT "write you name : ", name$



`´ now we need to get a command to manipulate the string for that we use the MID$ command
`´here is what we have:
`´INPUT "write you name : ", name$
`´print mid$(name$, 10)
`´okay you see the (name$, 10) ??? that command let DB know that it take the string name$
`´wich is our users word and take the last letter 10
`´know we do this
`´print mid$(name$, 10)
`´print mid$(name$, 9)
`´print mid$(name$, 8)
`´print mid$(name$, 7)
`´print mid$(name$, 6)
`´print mid$(name$, 5)
`´print mid$(name$, 4)
`´print mid$(name$, 3)
`´print mid$(name$, 2)
`´print mid$(name$, 1)
`´wait key
`´end

remstart
so that lines mean that it can handle up to a word on 10 letters and spell it backwards!
and the commands WAIT KEY and END means that when it have spelled the word backwards it will wait
for a key to be pushed and then quit the program.
now you should try this program and see what that few lines really can do just push the execute button
if you want the program to handle more programs just play around:-)
you just copy a  line
and paste it and then you just make it to 11 here is an example:
print mid$(name$, 11)
now the program can handle 11 letters instead of 10.
remend

`` here is the program

input "write you name : ", name$
print mid$(name$, 10)
print mid$(name$, 9)
print mid$(name$, 8)
print mid$(name$, 7)
print mid$(name$, 6)
print mid$(name$, 5)
print mid$(name$, 4)
print mid$(name$, 3)
print mid$(name$, 2)
print mid$(name$, 1)
wait key
end