![]() |
help with parseing?
I'm working on a script that involves checking the current weapon of the player, and some other weapons based on the index of the current weapon. The only problem is, weaponscount apears to include the -"hidden" weapons in its count, as do they have thier own weapons index. My script doesn't like hidden weapons.
To what I know there isn't any equivalent of visibleweaponscount or such, so my solution involves checking the first character of the weapon name to figure out if its hidden or not, wich leads me to my scripting problem: I can't get the engine to parse/check the first character :( I've tried the statswith flag, tokenize2, etc, but all to no avail. (and I'm not gonna rename every weapon for the sake of compatibility, thank you very much). any helpfull ideas? (a minor emphisis on 'helpfull' and 'ideas', btw) |
Use #e(startindex,length,string);
NPC Code: That would make the NPC say the first 5 letters of your name. Spaces also count as letters. |
I guess you can try something like:
NPC Code: Or something along the means of that. |
woah, nifty! thanks alot! I realy apreciate it.
|
use if (startswith(#w,-)) { i think it was that
|
Quote:
|
Quote:
|
startswith(partstr,str)
You people've got it backwards. |
Quote:
|
Quote:
but yeah, I used that kinda thing in the weaponselect systems i've made and it works just fine |
I wonder if startswith works anymore. regardless, I like #e better. Why? I can get it to work ^^
The script is still broken, but for different reasons now. (for the inquisitive, the reason is lazyness) |
I have not used strcontains much anymore, I use a #T on a #e, in a loop that checks every letter of the message.
|
Quote:
|
Quote:
|
Quote:
|
Quote:
|
Then it would be better to figure out how it works than to use such an inefficient solution.
|
you use
if (strcontains(#s(yourstring),partstring)) yes? |
Quote:
strcontains is if the partstring is existant at all... what he need is that if the partstring is the start of the string.. therefore, if(startswith(-,#w(i)) { } is the correct way to do. And yes i do suck on scripting. |
Quote:
|
Quote:
|
| All times are GMT +2. The time now is 11:44 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.