Problem with timed event

This forum is meant for requesting technical support or reporting bugs.

Moderators: time-killer-games, Vengeance66, Candle, reneuend, GM-Support

Problem with timed event

Postby Lyberodoggy » Mon Sep 08, 2008 9:32 am

I was trying to simulate the typing of a word using VBS, but I can't seem to get it right.
This is the code I used, you can modify it freely, as long as you make it finally work...

Code: Select all
Sub typemsg(msgtobedisp,textindex)
messagelen=len(msgtobedisp)
For i=1 to messagelen
letter=mid(msgtobedisp,i,1)
Action.CreateTimedEvent (i*(0.5)),"text(textindex).caption=text(textindex).caption+ConvertQuotesIntoDoubleQuotes(letter)",False
Next
End Sub
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby mercedes » Mon Sep 08, 2008 9:54 am

I gather u are trying to do a procedure here..? or are u trying to do vbs in the advanced...and use this as a procedure..i feel like playing..so tell me what u are trying to do...:P
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby Lyberodoggy » Mon Sep 08, 2008 9:55 am

This code goes to vbs procedures
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby mercedes » Mon Sep 08, 2008 10:04 am

Just out of curiosity..are u wanting it so someone has to hit a hotspot to get it going...or just appear when the frame loads...and the typing just starts up, sort of thing...

Edit..never mind..I think i know what u are trying to do..i see u edited what i was going to mention..:P Either that or I had it in there twice..lol..

Peace..
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby Lyberodoggy » Fri Sep 12, 2008 11:07 pm

Any luck here?
Anyone???
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Chromegloss55 » Sat Sep 13, 2008 1:51 am

I'll have a look at that and see what I can do...
_________________
Learning Disorders Forum
Last edited by Chromegloss55 on Tue Feb 24, 2009 3:26 pm, edited 1 time in total.
Chromegloss55
Forum Master
 
Posts: 630
Joined: Sat Nov 03, 2007 2:49 pm
Location: God Knows!

Postby Lyberodoggy » Sat Sep 13, 2008 10:36 am

Thanks...
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Mystery » Sat Sep 13, 2008 11:44 am

After 3 hours of experimenting with it, I have to say that I got some interesting results, but not what I wanted :P
Still trying, cause I think this would be a great effect :D But I don't think I can get it right :P

Just 2 remarks (correct me if I'm wrong as this could be):

Wouldn't it be necessary to increase the message length on each "loop"?
In your current code [letter=mid(msgtobedisp,i,1)], in each round there would be only 1 letter displayed I think.

Somehow, multiple timed events don't seem to work. I've also tried it with a specific script to display a certain word in a certain textbox, but after the second letter it stopped for some reason :?
Have you already tried it with a specific code, too? Have you been able to create a multiple timed event that works for the contents of a textbox?
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby Lyberodoggy » Sat Sep 13, 2008 11:52 am

Hmm... I will try...

Yes the code displays one letter with every timed event. Each letter has its own event I hope...
Without the timer, the script works, but it's useless...
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Mystery » Sat Sep 13, 2008 11:57 am

Okay, I'm curious if you get the multiple timed event work for one specific textbox with a specific word...
For me, either it stops after the 2nd letter, or it only displays the last letter of the word.


Hmmm, but for a typewriter effect, wouldn't you want to display an increasing number of letters in a textbox? Like for example to type the word "hello", wouldn't you want to display first "h" then short time later "he", then "hel" etc. up to "hello"?
Or did I misunderstand something?
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby Lyberodoggy » Sat Sep 13, 2008 12:30 pm

Yes, that's what I tried to do...

I 'm now trying to develop a self calling procedure, putting all my efforts on it...

EDIT: This is the best I can do, but it's still not working:

Code: Select all
sub typemsgselfcall(msgtobedisp,i,textindex)
If i=0 then i=1
letter=mid(msgtobedisp,i,1)
CreateTimedEvent 1,"Text(textindex).caption=Text(textindex).caption+letter"
If i<len(msgtobedisp) Then
i=i+1
CreateTimedEvent 1,"typemsgselfcall msgtobedisp,i,textindex"
End If
End Sub
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Mystery » Sat Sep 13, 2008 12:34 pm

Going to check it, and try too, I'll post if I figure out anything useful.
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby Lyberodoggy » Sat Sep 13, 2008 12:39 pm

By removing one timed event I actually got it type the H...

The thing is that probably i isnt increasing and dunno why
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Mystery » Sat Sep 13, 2008 12:41 pm

Yeah, same here, I've been able to type a typewriter message with the first letter. Instead of "hello", it typed hhhhhh :lol: But it didn't want to stop, lol.
Guess we are near :P
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby Lyberodoggy » Sat Sep 13, 2008 12:43 pm

really?
Can you give me that code? Because I only managed to project the first letter once...

For what I have understood, it must be some compatibility issue between the texts and timers...
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Mystery » Sat Sep 13, 2008 12:52 pm

I've changed it, cause I wanted it to work first for a specific case, and then try to generalize it.

Code: Select all
sub typemsgselfcall
If i=0 then i=1
letter=mid(msgtobedisp,i,1)
CreateTimedEvent 1,"Text(1).caption=Text(1).caption+letter"
If i<len(msgtobedisp) Then
i=i+1
CreateTimedEvent 1,"typemsgselfcall"
End If
End Sub


Plus in the frame properties:
Code: Select all
msgtobedisp="multiplication"
typemsgselfcall


And added one textbox by right clicking on that frame (typed "1")

This displays
"1" plus adds each second an m infinitely
:lol:

So the counter still doesn't work.
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby Lyberodoggy » Sat Sep 13, 2008 1:03 pm

Hmm.. Can't get that to work either. The i is counting normally, but even m isn't displayed
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Lyberodoggy » Sat Sep 13, 2008 1:05 pm

OMG WORKED FINALLY!!!

Just take the first timed event off (leave the code, just strip off the timed event). It works!
Thanks Mystery!
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Mystery » Sat Sep 13, 2008 1:06 pm

Have you created the variant variables "letter" and "msgtobedisp" ?

What?!?
Gonna try.

Ummm, can you tell me which code, please? I'm confused by now :P
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby Lyberodoggy » Sat Sep 13, 2008 1:14 pm

This is the code that worked (modified yours):

Code: Select all
sub typemsgselfcall
If i=0 then i=1
letter=mid(msgtobedisp,i,1)
Text(1).caption=Text(1).caption+letter
If i<len(msgtobedisp) Then
i=i+1
CreateTimedEvent 0.1,"typemsgselfcall"
End If
End Sub


And here's a sample project:
Attachments
type.zip
(101.8 KiB) Downloaded 371 times
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Mystery » Sat Sep 13, 2008 1:18 pm

Yay! :D
Great job, Doggy!
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby Lyberodoggy » Sat Sep 13, 2008 1:21 pm

Thanks! You too...

I can't get it to work with parameters though... Like adjustable timing, adjustable text(s) to be used and multiple messages per page (would require multiple msgtobedisp variables), but anyways, it's great already!
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Mystery » Sat Sep 13, 2008 1:23 pm

Thank you, was fun working with you :)
Lol, ShadowHunter always says "The sky is the limit", so maybe we're going to get it work, too, somehow :lol:
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby Lyberodoggy » Sat Sep 13, 2008 1:28 pm

I 'm in!

I just simulated a running bios, by making the script display the loading functions... It would be nice to be able to make it wait :)... Like if it was really loading.

Anyways, I got to go get some fresh air. I 'll work on the script later. Be sure to inform me on any progress :wink:
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Mystery » Sat Sep 13, 2008 1:54 pm

Small progress.

Created variable x.

Code: Select all
sub typemsgselfcall
If i=0 then i=1
letter=mid(msgtobedisp,i,1)
Text(x).caption=Text(x).caption+letter
If i<len(msgtobedisp) Then
 i=i+1
 CreateTimedEvent 0.1,"typemsgselfcall"
ElseIf i=len(msgtobedisp) Then i=0 : Exit Sub
End If
End Sub


Created 2 hotspots.

Hotspot properties of first hotspot:
Code: Select all
x=1
Text(x).caption=""
msgtobedisp="This is the first message."
typemsgselfcall


Hotspot properties of second hotspot:
Code: Select all
x=2
Text(x).caption=""
msgtobedisp="This is the second message."
typemsgselfcall


Unfortunately the Text(x).caption="" doesn't seem to work; I must be making a mistake :(
Last edited by Mystery on Sat Sep 13, 2008 1:56 pm, edited 1 time in total.
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby Chromegloss55 » Sat Sep 13, 2008 1:56 pm

I didn't even get a chance to work on this... :cry:

Well I'm still here if you need me...
_________________
Vaccinations Forum
Last edited by Chromegloss55 on Tue Feb 24, 2009 3:26 pm, edited 1 time in total.
Chromegloss55
Forum Master
 
Posts: 630
Joined: Sat Nov 03, 2007 2:49 pm
Location: God Knows!

Postby Mystery » Sat Sep 13, 2008 1:58 pm

Yeah, we need you to generalize it, i.e. make it work with
adjustable timing, adjustable text(s) to be used, and multiple messages per page as Doggy mentioned :)

You're very welcome to help us with that :D
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby Lyberodoggy » Sat Sep 13, 2008 2:54 pm

Yeah, feel free to cooperate with us!

Well, Mystery I thought of that solution too, but it doesn't help, because if they run at the same time they will be confused. A local variable should come in handy, but it doesn't work, so what about giving the reference of a local variable as a parameter?
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Mystery » Sat Sep 13, 2008 2:57 pm

Haven't managed yet to make parameters work, but I agree with the confunded variables, have experienced the same.
Trying different tracks :)
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby Lyberodoggy » Sat Sep 13, 2008 3:17 pm

Just posting to prevent you from spending time to solve this problem:
you have to place this code in "execute some code each time a frame is loaded":
Code: Select all
i=0


Else you will see your script typing from the last value of i, therefore missing some text..
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Next

Return to Adventure Maker Technical Support and Bug Reports

Who is online

Users browsing this forum: No registered users and 0 guests