mIRC Homepage
Posted By: vegetate Problems with $? - 23/06/10 05:18 PM
So I'm trying to set up some variables in the on load section of my script and want to prompt the users for the information. So I did the following:

var %xhBotName = $?"What would you like your bot to be called (e.g. TPUBOT, ChanBot)"
var %xhChanName = $?="What is the name of your guild Channel (e.g. %xhEnabled)"
var %xhGuildName = $?="What is the abbreviation for your guild (e.g. TPU, RLOF, etc)"

I'm having two problems, first off only the first prompt is coming up. Second even though the first prompt comes up it doesn't create the variable xhBotName or obviously enter the value entered into it. Any suggestions?
Posted By: 5618 Re: Problems with $? - 23/06/10 05:25 PM
First off, see /help Variables

You're setting local variables instead of global variables.
Posted By: Tomao Re: Problems with $? - 23/06/10 05:27 PM
You should use the global variable for each prompt:
Quote:
set %xhBotName $$?="What would you like your bot to be called (e.g. TPUBOT, ChanBot)"
set %xhChanName $$?="What is the name of your guild Channel (e.g. %xhEnabled)"
set %xhGuildName $$?="What is the abbreviation for your guild (e.g. TPU, RLOF, etc)"
And make the $? and double $$? so you don't get the var set without a value being entered when you close it.

Ok 5618 beat me to it.
Posted By: vegetate Re: Problems with $? - 23/06/10 05:29 PM
Ok, thanks folks. Now I'm at the point where xhBotName gets set. But I still don't get the second or third prompt. Any ideas on that?
Posted By: Tomao Re: Problems with $? - 23/06/10 05:31 PM
Oh my bad. You need to remove the equals sign next to the vars when you set them as global variables.
Posted By: vegetate Re: Problems with $? - 23/06/10 05:38 PM
Yeah, so this is what I have at this point.

set %xhBotName $$?="What would you like your bot to be called (e.g. TPUBOT, ChanBot)"
set %xhChanName $$?="What is the name of your guild Channel (e.g. %xhEnabled)"
set %xhGuildName $$?="What is the abbreviation for your guild (e.g. TPU, RLOF, etc)"

Which works for BotName, but then doesn't prompt for ChanName or GuildName. In fact as a test after the three prompt I did "set %xhBotName DONE" and after loading the script the variable contained the value I entered, not DONE. So it's like it stops executing after the first prompt.
Posted By: 5618 Re: Problems with $? - 23/06/10 05:40 PM
Your problem is that it sees %xhEnabled) as an actual variable and it fails on that.

Use $chr(37) $+ hEnabled)

But I think you don't want %xhEnabled there at all? Don't you want an example of a channel name? Or do you want the value of the variable there?
Posted By: vegetate Re: Problems with $? - 23/06/10 05:43 PM
Ah thanks, actually that was just fallout from a previous find and replace. It's working now. Really appreciate the very quick help here guys smile
© mIRC Discussion Forums