de en es fr
Let the machine help
Light teasing, exhibition, BDSM, sissyfication, watersports... with sounds and pictures


Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Help! What's wrong with this script?! - multiple def
PostPosted: Sat Aug 06, 2011 10:55 am 
Offline
Veteran
User avatar
Can you take a quick look at this script, to see why I keep getting an error why I try to use the string 'implement' in it?

Example
Code:
show("You have the "+implement+".")


It's the only one not being 'set' right, even though as far as I can tell, I've handled it the same as every other similar string/value (eg 'position', 'scenario', etc.). It's driving me nuts trying to figure out what I've done different/wrong with it! Perhaps something to do with the loop, I thought, but I think it was giving me the same error before I added that code today.

So yeah... please help me figure it out! :)

(file removed, as problem solved)


Last edited by Banjo on Sun Aug 07, 2011 7:29 am, edited 1 time in total.

Top
 Profile Send private message 
 
 Re: Help! What's wrong with this script?!
PostPosted: Sat Aug 06, 2011 1:26 pm 
Offline
Site Admin
User avatar
There is a rule that you may not know : a variable defined in a block (anything surrounded with { }) is available only in this block.

Instead of
Code:
while (reroll_imp) {
  ...
  def implement = roll
  ...
}
show("You have the "+implement+".")

do :
Code:
implement = ""
while (reroll_imp) {
  ...
  implement = roll
  ...
}
show("You have the "+implement+".")

I'm sorry that the "check" tool do not detect this. Anyway, the rest of the code looks good.


Top
 Profile Send private message 
 
 Re: Help! What's wrong with this script?!
PostPosted: Sun Aug 07, 2011 7:28 am 
Offline
Veteran
User avatar
Makes sense, in fact I was even suspecting something like that was the case (not the "in a block", maybe, but "in a loop"). Since the check tool didn't pick it, I was going nuts! :)

So, that means I need to make sure no "def" variable commands are ever within { } (curly brackets) if I want to use that variable elsewhere, right?

One thing that threw me, though... doesn't it need to be:

Code:
def implement = ""
while (reroll_imp) {
  ...
  implement = roll
  ...
}
show("You have the "+implement+".")


... or not? I thought I'd need to "def" (define) it outside the block first? No?


Top
 Profile Send private message 
 
 Re: Help! What's wrong with this script?!
PostPosted: Sun Aug 07, 2011 2:33 pm 
Offline
Site Admin
User avatar
Yes, you are right, the def was missing


Top
 Profile Send private message 
 
 Re: Help! What's wrong with this script?!
PostPosted: Sun Aug 07, 2011 5:57 pm 
Offline
Veteran
User avatar
Thanks... and works perfectly! :)


Top
 Profile Send private message 
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 4 guests


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 post attachments in this forum

Search for:
Jump to:  


cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Maroon Fusion theme created by Oxydo
Software, theme modifications, phpBB modification by Doti 2010 - 2020
This website uses session cookies only.