mIRC Home    About    Download    Register    News    Help

Print Thread
#140305 24/01/06 08:57 AM
Joined: Jan 2006
Posts: 19
E
Pikka bird
OP Offline
Pikka bird
E
Joined: Jan 2006
Posts: 19
removing words in a ini file, i will try explain this as much as i can, i am making a rpg bot, and i need to know how i would get it to remove words

how would i make it remove the right word but still keep the rest of the line, like

weapon=dagger sword battleaxe

and i want it to remove dagger but keep sword and battleaxe, how would i go about that?

this is what i have so far:

Code:
alias weapon {
  if ($readini($nick $+ .chr,Weapons,weapon) = dagger2) {
    writeini $nick $+ .chr Weapons wearwep Dagger
    writeini $nick $+ .chr $nick $calc($att + 1)
  }
}
alias remweapon {
  if ($readini($nick $+ .chr,Weapons,wearwep) = dagger) {
    writeini $nick $+ .chr Weapons wearwep None
    writeini $nick $+ .chr Weapons weapon Dagger
    writeini $nick $+ .chr $nick $calc($att - 1)
  }
}

Last edited by evidence22; 24/01/06 09:18 AM.
#140306 24/01/06 09:56 AM
Joined: Apr 2005
Posts: 8
S
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
S
Joined: Apr 2005
Posts: 8
use $gettok and $istok to remove words, e.g. to check if the dagger is a token ("word") in the $nick .chr file and to remove the dagger:
Code:
if ( $istok(dagger,$readini($+($nick,.chr),weapons,weapon),32) ) {
writeini $+($nick,.chr) weapons weapon $remtok( $readini($+($nick,.chr),weapons,weapon),dagger,1,32)
}


32 is the character number for space.

*fixed the $istok and $+()* :tongue:

Last edited by SavvaS; 24/01/06 09:59 AM.
#140307 24/01/06 10:54 AM
Joined: Jan 2006
Posts: 19
E
Pikka bird
OP Offline
Pikka bird
E
Joined: Jan 2006
Posts: 19
i put:

on *:TEXT:`drop *:#: {
if ($istok($2,$readini($+($nick,.chr),weapons,weapon),32) ) {
writeini $+($nick,.chr) weapons weapon $remtok($readini($+($nick,.chr),weapons,weapon),$2,1,32)
}
}

but nothing happened when i used `drop dagger, its in there like this

[Weapons]
weapon=Dagger Sword Battleaxe

#140308 24/01/06 05:02 PM
Joined: Aug 2005
Posts: 525
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2005
Posts: 525
I could have sworn you posted this same topic here

Code:
on *:TEXT:`drop *:#:{
  var %w = $readini(weapons.ini,Weapons,weapon)
  if ($istok(%w,$2,32)) {
    writeini weapons.ini Weapons weapon $remtok(%w,$2,1,32)
  }
}


BTW, there is nothing advanced about this.

Modify to suit your needs.


Link Copied to Clipboard