Author Topic: RandomNum() issue.  (Read 2002 times)

Offline Duality

  • Planewalker
  • *****
  • Posts: 147
RandomNum() issue.
« on: April 09, 2006, 06:56:31 PM »
Is there any reason at all why this code snippet wouldn't work?

IF
   RandomNum(5, 1)
   Global("psGlobeCast", "LOCAL", 0)
THEN
   RESPONSE #100
END

IF
   RandomNum(5, 2)
   Global("psGlobeCast", "LOCAL", 0)
THEN
   RESPONSE #100
END

This goes on through (5,5)
With a DestroySelf() once the variable psGlobeCast is set to 1.
psGlobeCast is not defined before this, and it doesn't matter if I set it to 0, the script still doesn't work. So I am assuming that it is the RandomNum() that's causing the problem.

The .cre's in question just sit there stupidly. No matter how long I wait, they do nothing. Any idea as to why?
"I'll try being nicer if you try being smarter."

"There is a certain freedom in being totally screwed. It means that nothing you do is going to make it any worse."

"Eagles may soar, but weasels don't get sucked into jet engines."

Offline icelus

  • Global Moderator
  • Planewalker
  • *****
  • Posts: 3173
  • Gender: Male
Re: RandomNum() issue.
« Reply #1 on: April 09, 2006, 06:58:03 PM »
Do you have anything after RESPONSE #100?
<Moongaze> Luckily BWL has a very understanding and friendly admin.

Offline Duality

  • Planewalker
  • *****
  • Posts: 147
Re: RandomNum() issue.
« Reply #2 on: April 09, 2006, 07:06:06 PM »
Yep. Each block is a different ForceSpell (don't ask)

Wait(1)
SetGlobal("psGlobeCast", "LOCAL", 1)
ForceSpell(Player1,TRAP_MAGIC_MISSILE)

and the final block is

IF
   Global("psGlobeCast", "LOCAL", 1)
THEN
   RESPONSE #100
      DestroySelf()
END

The .bcs is assigned correctly, I checked, about 20 times.
"I'll try being nicer if you try being smarter."

"There is a certain freedom in being totally screwed. It means that nothing you do is going to make it any worse."

"Eagles may soar, but weasels don't get sucked into jet engines."

Offline devSin

  • Planewalker
  • *****
  • Posts: 1632
  • Gender: Male
Re: RandomNum() issue.
« Reply #3 on: April 09, 2006, 08:15:33 PM »
"LOCALS"

There isn't any other reason in the snippets you posted that it wouldn't work.

Offline Duality

  • Planewalker
  • *****
  • Posts: 147
Re: RandomNum() issue.
« Reply #4 on: April 09, 2006, 11:26:45 PM »
Well don't I feel silly.
They work fine once you use locals instead of local.
Why is it that the longer you stare at something, the less likely you are to notice the obvious?
"I'll try being nicer if you try being smarter."

"There is a certain freedom in being totally screwed. It means that nothing you do is going to make it any worse."

"Eagles may soar, but weasels don't get sucked into jet engines."

Offline devSin

  • Planewalker
  • *****
  • Posts: 1632
  • Gender: Male
Re: RandomNum() issue.
« Reply #5 on: April 09, 2006, 11:33:51 PM »
I'm just wondering what on earth compiler you're using that allows that. I thought they all more or less barfed on funky scope strings...

Offline Duality

  • Planewalker
  • *****
  • Posts: 147
Re: RandomNum() issue.
« Reply #6 on: April 10, 2006, 11:55:15 AM »
Weidu v.190

There might have been a warning, but no fatal error. And with all the scrolling text, I didn't notice anything. (especially since it was the 50th time I had installed it in the last two hours)
"I'll try being nicer if you try being smarter."

"There is a certain freedom in being totally screwed. It means that nothing you do is going to make it any worse."

"Eagles may soar, but weasels don't get sucked into jet engines."

Offline icelus

  • Global Moderator
  • Planewalker
  • *****
  • Posts: 3173
  • Gender: Male
Re: RandomNum() issue.
« Reply #7 on: April 10, 2006, 01:41:07 PM »
Yeah, WeiDU will still compile scripts even if, say, you use a trigger that isn't in TRIGGER.IDS.  I found out the hard way that Or() doesn't work in BG1.  :(
<Moongaze> Luckily BWL has a very understanding and friendly admin.

Offline Duality

  • Planewalker
  • *****
  • Posts: 147
Re: RandomNum() issue.
« Reply #8 on: April 10, 2006, 02:40:10 PM »
I found out the hard way that Or() doesn't work in BG1.  :(

So have I. I had a script that wasn't working, I finally checked the weidu install and low and behold, there was an error.

Maybe the_bigg can turn all those errors into fatal ones.
"I'll try being nicer if you try being smarter."

"There is a certain freedom in being totally screwed. It means that nothing you do is going to make it any worse."

"Eagles may soar, but weasels don't get sucked into jet engines."

Offline SimDing0™

  • Back In Black
  • Global Moderator
  • Planewalker
  • *****
  • Posts: 3496
  • Gender: Male
  • Word Enhancer
Re: RandomNum() issue.
« Reply #9 on: April 10, 2006, 02:44:14 PM »
You should really be paying attention to every error that crops up anyway. There's no reason for mods not to have error-free installs.

Offline Duality

  • Planewalker
  • *****
  • Posts: 147
Re: RandomNum() issue.
« Reply #10 on: April 10, 2006, 04:10:46 PM »
I know.  The problem is that when I am installing it repeatedly I get lax in watching for errors that scrawl by.
Thus, I don't usually notice the errors until far later.
"I'll try being nicer if you try being smarter."

"There is a certain freedom in being totally screwed. It means that nothing you do is going to make it any worse."

"Eagles may soar, but weasels don't get sucked into jet engines."

Offline devSin

  • Planewalker
  • *****
  • Posts: 1632
  • Gender: Male
Re: RandomNum() issue.
« Reply #11 on: April 10, 2006, 05:05:54 PM »
Since you're using Terminal, --log somewhere/mylog.whatever. After it runs, grep ERROR somewhere/mylog.whatever (in this case, I guess you should also grep WARNING; visit man grep for more help).

Offline Duality

  • Planewalker
  • *****
  • Posts: 147
Re: RandomNum() issue.
« Reply #12 on: April 10, 2006, 10:44:33 PM »
The things you learn.
That will be a huge help, it certainly beats scrolling through hundreds of lines of text, looking for a "warning".

Thank you.
"I'll try being nicer if you try being smarter."

"There is a certain freedom in being totally screwed. It means that nothing you do is going to make it any worse."

"Eagles may soar, but weasels don't get sucked into jet engines."

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: