WHAT IS WRONG WITH THIS SCRIPT?

This forum is meant for posting anything related to Adventure Maker that doesn't fit in the other forums.Please post technical questions in the Technical Support Forum!

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

WHAT IS WRONG WITH THIS SCRIPT?

Postby LindaCat » Sun Jan 14, 2007 1:10 pm

My scripting is shaky, but I AM TRYING.

However, what's wrong with this:

If MrT endConv2 #2 = 1 then
Action.GoToFrame "MrThPreConv2"
Else
If MrT endConv2 #2 = 0 then
Action.GoToFrame "MrThPreConv1"

I keep getting a message asking for ?then?? and can't use 'apply'.
:?
User avatar
LindaCat
Active Member
 
Posts: 98
Joined: Mon Sep 18, 2006 3:26 pm

Postby jeffer012 » Sun Jan 14, 2007 5:02 pm

After your if statements, you need an "End If" to close it . Also I think "Else If" needs to be on one line.So it should look like this:

If MrT endConv2 #2 = 1 then
Action.GoToFrame "MrThPreConv2"
Else If MrT endConv2 #2 = 0 then
Action.GoToFrame "MrThPreConv1"
End If
User avatar
jeffer012
Games Page Administrator
 
Posts: 50
Joined: Fri Nov 10, 2006 2:23 am
Location: Maryland

Postby LindaCat » Sun Jan 14, 2007 8:05 pm

Thanks for trying, but this didn't really work.
User avatar
LindaCat
Active Member
 
Posts: 98
Joined: Mon Sep 18, 2006 3:26 pm

Postby Candle » Sun Jan 14, 2007 8:09 pm

Please don't use all caps when posting. it looks like you are shouting.
Please don't PM me questions, ask here in the forums!
``````````````
Between grand theft and a legal fee, there only stands a law degree.
User avatar
Candle
Administrator
 
Posts: 3077
Joined: Sat Feb 07, 2004 2:21 am
Location: Rudy's Bar

Postby LindaCat » Sun Jan 14, 2007 10:27 pm

:oops:
User avatar
LindaCat
Active Member
 
Posts: 98
Joined: Mon Sep 18, 2006 3:26 pm

Postby LindaCat » Mon Jan 15, 2007 10:00 am

Dear Candle.

Now that I have apologised for the "shouting", - or at least the above was a kind of apology, - would you please look at my code and tell me why it does not stick?
User avatar
LindaCat
Active Member
 
Posts: 98
Joined: Mon Sep 18, 2006 3:26 pm

Postby Candle » Mon Jan 15, 2007 10:28 am

I'm sorry I wish I could help you but I'm just not that good with that code.
GM or Shadow would know better.
Please don't PM me questions, ask here in the forums!
``````````````
Between grand theft and a legal fee, there only stands a law degree.
User avatar
Candle
Administrator
 
Posts: 3077
Joined: Sat Feb 07, 2004 2:21 am
Location: Rudy's Bar

Postby Walter » Mon Jan 15, 2007 1:46 pm

Hi LindaCat,
I think it should be "elseif" not "else if"
Regards Walter
Walter
Junior Member
 
Posts: 11
Joined: Thu Dec 14, 2006 8:09 pm
Location: Graz - Austria

Postby LindaCat » Mon Jan 15, 2007 2:10 pm

Thanks for trying, but neither"elseif" or "else" work either. I'm still asked for an extra "then", and cannot "apply".
:cry:
User avatar
LindaCat
Active Member
 
Posts: 98
Joined: Mon Sep 18, 2006 3:26 pm

Postby LindaCat » Mon Jan 15, 2007 2:39 pm

I added some parathesis and at least I get no request for extra "then", but now I'm asked for ')' and still cannot "apply". Where on earth would an extra ')' go?
:? :? :?
Attachments
FaultyVBscript.jpg
FaultyVBscript.jpg (68.53 KiB) Viewed 10913 times
User avatar
LindaCat
Active Member
 
Posts: 98
Joined: Mon Sep 18, 2006 3:26 pm

Postby Walter » Mon Jan 15, 2007 3:12 pm

If "MrT endConv2 #2" is the name of ONE varriabel than the blank(s) could be the problem.

Try
If (MrT endConv2 #2 = 1) then msgbox "OK"

I suppose it won't work either beacause of the blanks. While something like
If a = 0 then msgbox "OK"
should work.
Walter
Junior Member
 
Posts: 11
Joined: Thu Dec 14, 2006 8:09 pm
Location: Graz - Austria

Postby jeffer012 » Mon Jan 15, 2007 3:24 pm

Yea hes right. You either need to change the variable name, or take out the spaces. Also the "#" is messing it up too. One more thing, you need to put it in a function.
User avatar
jeffer012
Games Page Administrator
 
Posts: 50
Joined: Fri Nov 10, 2006 2:23 am
Location: Maryland

Postby LindaCat » Mon Jan 15, 2007 6:13 pm

I can hardly remove the #s as these refer to hotspots. In fact they are all hotspots relating to different frames, and this troublesomeb VB-script is for another hotspot.

(If hotspot #2 in frame "MrT endConv2" is clicked (-and item is added) then go to frame "MrThPreConv2". If, on the other hand, hotspot #2 in frame "MrT endConv2" is not clicked (-and there is no new item), go to frame "MrThPreConv2".)
User avatar
LindaCat
Active Member
 
Posts: 98
Joined: Mon Sep 18, 2006 3:26 pm

Postby ShadowHunter » Mon Jan 15, 2007 9:01 pm

Hi LindaCat,

1. Don't use blanks
2. A variable between quotes is a text string, don't use quotes unless it's text
3. Not sure what the # means, but it is not valid in a variable name
4. Close each if with an "End"

TIP:

If you want to use a combination of a variable and a frame name use the ampersant "&"

Example:

MY_VAR has value "Hello"


MY_VAR1 & " world" results in "Hello world"

Get the picture :wink:

Hope this pushes you in the right direction and I'm happy to see you started coding :D

Don't give up, you will get it... I started that way too.

Kind regards,

ShAdOwHuNtEr
User avatar
ShadowHunter
Forum Admin and Games Page admin
 
Posts: 1304
Joined: Fri Jun 06, 2003 10:37 pm
Location: Belgium

Postby SeryousYew » Wed Jan 24, 2007 1:19 pm

Follwing the other's suggestion, here the code:

If MrTendConv2n2 = 1 Then
Action.GoToFrame "MrThPreConv2"
Else
Action.GoToFrame "MrThPreConv1"
End if

'or use this if you have more conditions:

If MrTendConv2n2 = 1 Then
Action.GoToFrame "MrThPreConv2"
ElseIf MrTendConv2n2 = 0 Then
Action.GoToFrame "MrThPreConv1"
End If
SeryousYew
Member
 
Posts: 29
Joined: Sat Nov 11, 2006 2:02 pm

Postby LindaCat » Thu Jan 25, 2007 10:28 am

To Seryous Yew:
Thanks, but how does the game recognize MrTendConv2n2 as hotspot#2 in frame "MrTendConv2"?

To Shaddowhunter:
I'm really trying, but getting utterly confused between variables and procedures.

If either of the hotspots is made into a variable and given the value of 0 which later on is changed to 1, will the game know that 0 and 1 relates to visible / invisible?

PS. I looked at your website and read some of your game ratings. It seems we have played many of the same games. Gabriel Knight I was the one that got me hooked in the first place, and made me begin to think away from films/books and into games. :wink:
User avatar
LindaCat
Active Member
 
Posts: 98
Joined: Mon Sep 18, 2006 3:26 pm

Postby ShadowHunter » Thu Jan 25, 2007 10:45 pm

Hi Linda,

Yeah... aren't those great games :D Too bad todays games can't seem to hook me up anymore. I have RunAWay 2 for over a month now... played it only a few hours :?

- If you whish to save a variable then make it a "global variable"
- For the visibility you need to code:

If myvar = 1 Then
HotSpot(1).Visible = False
Else
Hotspot(1).Visible = True
End if

That will work :D

Kind regards,

ShAdOwHuNtEr
User avatar
ShadowHunter
Forum Admin and Games Page admin
 
Posts: 1304
Joined: Fri Jun 06, 2003 10:37 pm
Location: Belgium


Return to Adventure Maker General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests