replace function
Author |
Message |
ecookman
![](http://compsci.ca/v3/uploads/user_avatars/5690458955648ca661c338.gif)
|
Posted: Mon Nov 10, 2008 11:50 am Post subject: replace function |
|
|
just wondering
i found a script that draws a picture of a skull and crossbones by drawing dots
the script is huge like 30 seconds of fast scrolling huge
and iu thought it wouyld be cool if i put in a delay after one so it draws one dot at a time and you watch it fill in
BUT i don't want to send pressing downarrow and then enter to make spaces here is a sample of the code
raw.Dot (0, 0, 7)
Draw.Dot (0, 1, 7)
Draw.Dot (0, 2, 7)
Draw.Dot (0, 3, 7)
Draw.Dot (0, 4, 7)
Draw.Dot (0, 5, 7)
Draw.Dot (0, 6, 7)
Draw.Dot (0, 7, 7)
Draw.Dot (0, 8, 7)
Draw.Dot (0, 9, 7)
Draw.Dot (0, 10, 7)
Draw.Dot (0, 11, 7)
Draw.Dot (0, 12, 7)
i think you ge the idea
and so instead of pressing keys on the keyboard for hours i was wonderting if the replace function cn do something like thii
FIND WHATl: Draw.Dot ([make this anything])
REPLACE WITH: Draw.Dot ([make this anything]) delay (50)
ya so if this is possible please tell me
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Vermette
![](http://compsci.ca/v3/uploads/user_avatars/637825944810b5d4444c6.jpg)
|
Posted: Mon Nov 10, 2008 12:12 pm Post subject: RE:replace function |
|
|
Notepad -> Edit -> Replace
replace ")" with ") delay(50)" if that's the proper syntax for what you're trying to do. I'm going on a limb here and thinking you don't have other code mixed in, so you should be able to run that and be done in a few seconds.
Now, I'm a little busy right now at work, but I'm sure before I get home to give you a little more info someone will come along and post some info on using regex to get the job done. This would be a single line problem/solution on a *nix system
|
|
|
|
|
![](images/spacer.gif) |
Insectoid
![](http://compsci.ca/v3/uploads/user_avatars/13760332514cbd0ce972eaa.jpg)
|
Posted: Mon Nov 10, 2008 12:20 pm Post subject: RE:replace function |
|
|
Turing has a replace function built in.
|
|
|
|
|
![](images/spacer.gif) |
delparnel
![](http://compsci.ca/v3/uploads/user_avatars/980326151490c8c77b2278.jpg)
|
Posted: Mon Nov 10, 2008 12:27 pm Post subject: Re: replace function |
|
|
Self-modifying code??
|
|
|
|
|
![](images/spacer.gif) |
Insectoid
![](http://compsci.ca/v3/uploads/user_avatars/13760332514cbd0ce972eaa.jpg)
|
Posted: Mon Nov 10, 2008 12:29 pm Post subject: RE:replace function |
|
|
no...it's a button, you click it, type what you want to replace, and what to replace with, and click replace...
So, he wants to replace the code while it's running?
|
|
|
|
|
![](images/spacer.gif) |
OneOffDriveByPoster
|
Posted: Mon Nov 10, 2008 12:43 pm Post subject: Re: replace function |
|
|
ecookman @ Mon Nov 10, 2008 11:50 am wrote: and iu thought it wouyld be cool if i put in a delay after one so it draws one dot at a time and you watch it fill in Might be more fun to draw one of the dots at random (and not in order).
|
|
|
|
|
![](images/spacer.gif) |
The_Bean
![](http://compsci.ca/v3/uploads/user_avatars/8459755754b4009cee84e9.jpg)
|
Posted: Mon Nov 10, 2008 4:10 pm Post subject: Re: replace function |
|
|
Well I was bored during fourth today and saw this, so i decided to make something using Draw.Dot myself.
It turned out to be 62724 lines with delays.
Takes roughly 22 minutes of mouse scrolling to get to the bottom. (Yes I scrolled the mouse for 22 minutes straight)
Arranged from darkest to lightest colours by row.
Only took an hour to make minus the scrolling. (thats 8.7 pixels/second, I know I'm crazy)
Doesn't draw any white dots.
Totally worth it.
Currently working on something 4 times the size.
Description: |
|
![](http://compsci.ca/v3/pafiledb/images/icons/clip.gif) Download |
Filename: |
DrawDot.t |
Filesize: |
1.23 MB |
Downloaded: |
106 Time(s) |
|
|
|
|
|
![](images/spacer.gif) |
Dan
![](http://wiki.compsci.ca/images/archive/3/3c/20100325043407!Danspic.gif)
|
Posted: Mon Nov 10, 2008 5:12 pm Post subject: RE:replace function |
|
|
You could just make a function that takes the same arguments as Draw.dot and then has two comands in it, the first is Draw.Dot(the args from the function) and then the second is a delay.
Then you would only have to replace the Draw.Dot with the function name of the function you made. This method also makes it easier to change the length of the delay.
If turing had better OOP you would be able to make a child of Draw and override Draw.dot with your own function with a delay and then call the super.dot. However i don't think turing lets you make a child class of Draw (tho i have not tryed).
|
Computer Science Canada
Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more! |
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
andrew.
|
Posted: Mon Nov 10, 2008 7:14 pm Post subject: RE:replace function |
|
|
This is not related to the original post, but Dan said something about OOP and that triggered a question in my head. I remember a while ago, I got my hands on a version of Turing that was object-oriented. I don't have it anymore, but I was just wondering if anyone has ever used this and how good is the OOP in it?
|
|
|
|
|
![](images/spacer.gif) |
[Gandalf]
![](http://compsci.ca/v3/uploads/user_avatars/189297994e4c716fec7f1.png)
|
Posted: Mon Nov 10, 2008 7:27 pm Post subject: RE:replace function |
|
|
Any of the (relatively) newer versions of Turing support OOP, though not extremely well. The download section has various object oriented versions (usually just your standard version) of Turing available to download.
For more info about this, take a look at Cervantes' trilogy of tutorials on classes.
|
|
|
|
|
![](images/spacer.gif) |
|
|