Home   Help Search Login Register  

Author Topic: My script  (Read 527 times)

0 Members and 1 Guest are viewing this topic.

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
My script
« on: 19 Jul 2003, 19:50:00 »
OK, I know I ainÂ't a guru on this random command but can somebody take a quick look at this script and tell me whats wrong?

Code: [Select]
_tid = random 20

_tid  + 5

#tidloop
? _tid = 0: goto "cont"
_tid - 1
~1
goto "tidloop"

#cont

bomb="heat125" camcreate getpos boat
du setdammage 0

Thx!

deaddog

  • Guest
Re:My script
« Reply #1 on: 19 Jul 2003, 20:01:39 »
_tid=_tid+5

_tid=_tid-1

?_tid == 0:goto "cont"

Also, random does not generate integers, so _tid will never equal 0 and never goto "cont".    Do this instead:

?_tid < 1:goto "cont"

Hopefully that will work for ya.  :)

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:My script
« Reply #2 on: 19 Jul 2003, 20:07:21 »
Cheers! :cheers:

*Topic Solved*

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:My script
« Reply #3 on: 19 Jul 2003, 20:35:42 »
I have a problem again. I didnt show the whole script before. Now, I know this script sux and there should probably be 100000 better ways of doing this but I suck at scripting so it's OK isn't? ;D
+ That I modified it now like 5 times to try to make it work so it ain't the original script either.
Code: [Select]
_krandom = random 10
_whokill = random 10
_tid = random 20

_tid=_tid  + 5

#tidloop
_tid=_tid-1
?_tid < 1:goto "cont"
~1
goto "tidloop"

#cont

bomb="heat125" camcreate getpos boat
du setdammage 0

? _krandom < 2 : _kill=_kill + 1
? _krandom < 3 : _kill=_kill + 2
? _krandom < 4 : _kill=_kill + 3
? _krandom < 5 : _kill=_kill + 4
? _krandom < 6 : _kill=_kill + 5
? _krandom < 7 : _kill=_kill + 6
? _krandom < 8 : _kill=_kill + 7
? _krandom < 9 : _kill=_kill + 8
? _krandom < 10 : _kill=_kill + 9
? _krandom < 11 : _kill=_kill + 10

#whokillloop
? _whokill < 2 : kguy1=true AND goto "deletekill"
? _whokill < 3 : kguy2=true AND goto "deletekill"
? _whokill < 4 : kguy3=true AND goto "deletekill"
? _whokill < 5 : kguy4=true AND goto "deletekill"
? _whokill < 6 : kguy5=true AND goto "deletekill"
? _whokill < 7 : kguy6=true AND goto "deletekill"
? _whokill < 8 : kguy7=true AND goto "deletekill"
? _whokill < 9 : kguy8=true AND goto "deletekill"
? _whokill < 10 : kguy9=true AND goto "deletekill"
? _whokill < 11 : kguy10=true AND goto "deletekill"
#deletekill
_kill=_kill - 1
?_kill < 1 : goto "action"
~0.001
goto "whokillloop"

#action
? kguy1 : guy1 setdammage 1
? kguy2 : guy2 setdammage 1
? kguy3 : guy3 setdammage 1
? kguy4 : guy4 setdammage 1
? kguy5 : guy5 setdammage 1
? kguy6 : guy6 setdammage 1
? kguy7 : guy7 setdammage 1
? kguy8 : guy8 setdammage 1
? kguy9 : guy9 setdammage 1
? kguy10 : guy10 setdammage 1

exit

The problem is I canÂ't get past the whokillloop. Can any1 see whats wrong. I know this is a n00b Q but I really suck on scripting.
« Last Edit: 19 Jul 2003, 20:36:51 by The real Armstrong »

Offline KTottE

  • Former Staff
  • ****
Re:My script
« Reply #4 on: 19 Jul 2003, 21:03:09 »
This is one fool-proof technique to turn a number returned from the random command into a whole integer:

_num = random 10
_num = _num - (_num mod 1)

Now _num will contain a whole integer between 0 and 10, and then you can compare it like this:

?(_num == #) : foo
? (_num == ##) : bar

Start off with that, the rest I can't help you with since I'm not able to test anything myself, as on the girlfriends comp and stuff :)
"Life is not a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside, thoroughly used up, totally worn out, and loudly proclaiming 'WOW What a Ride!'"

deaddog

  • Guest
Re:My script
« Reply #5 on: 19 Jul 2003, 21:52:31 »
Is that the whole script?  If so, then:

Quote
_kill=_kill + xx
doesn't mean anything because _kill is never initialized to any value.  Is _kill supposed to be a global variable?  Is so, then remove the _.

Quote
kguy1=true AND goto "deletekill"
You can't use "AND" with goto.  "AND" is only used in conditions or "if" statements.  Do this:

? _whokill < 2 :kguy1=true;goto "deletekill"

« Last Edit: 19 Jul 2003, 21:52:58 by deaddog »

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:My script
« Reply #6 on: 19 Jul 2003, 23:27:14 »
Cheers guys, it works now!