mIRC Home    About    Download    Register    News    Help

Print Thread
#125507 19/07/05 12:56 AM
Joined: Feb 2004
Posts: 45
N
Navid Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Feb 2004
Posts: 45
Here is my code:
Code:
on *:TEXT:*no2*:%DiGiT:{ if ($1 == $+($stats($nick,digital,trigger),no2)) {
    var %moves = $ini(Moves\ $+ $nick $+ .stats,0)
    var %num = 1
    var %section
    while (%num <= %moves) {
      ; get the name of the section on position "%use" (kick, punch, ...)
      %section = $ini(Moves\ $+ $nick $+ .stats,%num)
      ; read the value for "Cost"
      %Cost = $readini(Moves\ $+ $nick $+ .stats,np,%section,Cost)
      ; read the value for "level"
      %Level = $readini(Moves\ $+ $nick $+ .stats,np,%section,Level)
      ; read the value for "Base-Damage
      %Base-Damage = $readini(Moves\ $+ $nick $+ .stats,np,%section,Base-Damage)
      notice $nick 3 $+ %section $+ 10: Cost: %Cost Level: %Level Damage: %Base-Damage
    }
    inc %num
  } 
}


I dont know why the script seems okay, its not returning anything.

its suppose to read the folder Moves\ $nick.stats and reply like this.
-= [Topicname]: Cost- [costundertopicname] Level- [level] Damage- [damage] instead it just says:
: Cost: Level: Damage:
over and over and over until its Excess Flooded and this happened when I change the var %num = 1 TO var %num = 0 and tried the command.

Last edited by Navid; 19/07/05 01:08 AM.
#125508 19/07/05 02:06 AM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
1) Move the inc command within the while loop.

2) What is the "p" for in your $readini's? It makes |'s be treated as pipes rather than text. Unless you have commands in there, you don't want "p".

3) I've had issues with temporary variables not staying set if used within a while loop. Try setting it instead of using /var. It may help.


Invision Support
#Invision on irc.irchighway.net
#125509 19/07/05 03:03 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
try this , and watch the display of values being assigned,
Since you seemed to say it displaed nothing tell you set %num to 0 (not something you should have done), you most likely were getting a ZERO value loaded into %moves
This would suggest the file MOVES\$nick.stats does not contain INI data, and becuase it was zero, %num was > it and the while loop was never entered.

* i have also corrected as Ramius said the INC %NUM and placed it inside the while loop.

Code:
on *:TEXT:*no2*:%DiGiT:{
  if ($1 == $+($stats($nick,digital,trigger),no2)) {
    var -s %moves = $ini(Moves\ $+ $nick $+ .stats,0)
    var -s %num = 1
    var -s %section
    [color:blue];halt[/color] 
    while (%num <= %moves) {
      ; get the name of the section on position "%use" (kick, punch, ...)
      var -s %section = $ini(Moves\ $+ $nick $+ .stats,%num)
      ; read the value for "Cost"
      var -s %Cost = $readini(Moves\ $+ $nick $+ .stats,np,%section,Cost)
      ; read the value for "level"
      var -s %Level = $readini(Moves\ $+ $nick $+ .stats,np,%section,Level)
      ; read the value for "Base-Damage
      var -s %Base-Damage = $readini(Moves\ $+ $nick $+ .stats,np,%section,Base-Damage)
      notice $nick 3 $+ %section $+ 10: Cost: %Cost Level: %Level Damage: %Base-Damage
      inc -s %num
      [color:blue];halt[/color] 
    }
  } 
}


Note on: ;halt you can also use these unremarked to stop the script to examine execution up to these points.

Useing -s on VAR and SET and echo -s to rely info on what point is ececuting and the value of variabnles is often the fastets and easierst way of debugging code thats not working.

#125510 19/07/05 03:19 AM
Joined: Feb 2004
Posts: 45
N
Navid Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Feb 2004
Posts: 45
DaveC, I tried your code and nothing happens except I get this in my status:
Quote:
* Set %moves to 0
-
* Set %num to 0
-
* Set %section to

frown

Here is what i have in $nick(Navid).stats
....


EDIT: I FIXED IT!. You were right about not being a correct ini file. just a minor glitch sorry for making you guys write a lot for me smile.
It shows all the moves except the last one.
the last one is alittle longer 15chrs but has no space or anything its an all in one word but it doesn't show it in the `no2 even though it has the same settings as the rest except the name.

Last edited by Navid; 19/07/05 03:25 AM.
#125511 19/07/05 03:34 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:
It shows all the moves except the last one.
the last one is alittle longer 15chrs but has no space or anything its an all in one word but it doesn't show it in the `no2 even though it has the same settings as the rest except the name.


I dont even understand what you said here.

The last move?

in the `no2 even ? whats that!

#125512 19/07/05 03:57 AM
Joined: Feb 2004
Posts: 45
N
Navid Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Feb 2004
Posts: 45
Sorry for bad explanation.
When a user type `no2 its suppose to show all their attacks/moves they have with their chosen character, so `no2 works fine and shows all the attacks except the last one.
It shows 4 attacks and the last one (5th one) it doesnt. Here is in Navid.stats
Quote:
[Punch]
Cost=0
Base-Damage=3
level=1
[Kick]
level=1
Cost=0
Base-Damage=3
[Energybeam]
Cost=5
Base-Damage=6
level=1
[Dragonfist]
level=5
Cost=9
Base-Damage=19
[Superkamehameha]
level=5
Cost=5
Base-Damage=15


it doesnt show the last topic. I hope I made it understandble this time smile

#125513 19/07/05 04:08 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
* Set %moves to 5
* Set %num to 1
* Set %section to
* Set %section to Punch
* Set %Cost to 0
* Set %Level to 1
* Set %Base-Damage to 3
-> -DaveC- Punch: Cost: 0 Level: 1 Damage: 3
* Inc %num to 2
* Set %section to Kick
* Set %Cost to 0
* Set %Level to 1
* Set %Base-Damage to 3
-> -DaveC- Kick: Cost: 0 Level: 1 Damage: 3
* Inc %num to 3
* Set %section to Energybeam
* Set %Cost to 5
* Set %Level to 1
* Set %Base-Damage to 6
-> -DaveC- Energybeam: Cost: 5 Level: 1 Damage: 6
* Inc %num to 4
* Set %section to Dragonfist
* Set %Cost to 9
* Set %Level to 5
* Set %Base-Damage to 19
-> -DaveC- Dragonfist: Cost: 9 Level: 5 Damage: 19
* Inc %num to 5
* Set %section to Superkamehameha
* Set %Cost to 5
* Set %Level to 5
* Set %Base-Damage to 15
-> -DaveC- Superkamehameha: Cost: 5 Level: 5 Damage: 15
* Inc %num to 6

Worked fine for me!
Show me the code your actually using.

#125514 19/07/05 05:35 AM
Joined: Feb 2004
Posts: 45
N
Navid Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Feb 2004
Posts: 45
Code:
 on *:TEXT:*no2*:%DiGiT:{
  if ($1 == $+($stats($nick,digital,trigger),no2)) {
    var -s %moves = $ini(Moves\ $+ $nick $+ .moves,0)
    var -s %num = 1
    var -s %section
    ;halt
    while (%num < %moves) {
      ; get the name of the section on position "%use" (kick, punch, ...)
      var -s %section = $ini(Moves\ $+ $nick $+ .moves,%num)
      ; read the value for "Cost"
      var -s %Cost = $readini(Moves\ $+ $nick $+ .moves,np,%section,Cost)
      ; read the value for "level"
      var -s %Level = $readini(Moves\ $+ $nick $+ .moves,np,%section,Level)
      ; read the value for "Base-Damage
      var -s %Base-Damage = $readini(Moves\ $+ $nick $+ .moves,np,%section,Base-Damage)
      notice $nick 3 $+ %section $+ 10: Cost:3 %Cost 10Level:3 %Level 10Damage:3 %Base-Damage
      inc -s %num
      ;halt
    }
  } 
} 


EDIT: Dont Worry about it! I fixed it smile Hey DaveC, do you know how to insert Space in topics like: [This is a topic] or [This Topic] and when the topic name is viewed by the `no2 command it shows the space

Last edited by Navid; 19/07/05 05:48 AM.
#125515 19/07/05 01:16 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Unless someone has a better idea, you can use _ for a space in the topic name and then $replace the _ with a space:

$replace(%section,_,$chr(32))


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard