![]() |
how to make...
if player says belt red
it will make the belt red, so... how to make the npc read chat message of the players which are separated by space ? |
NPC Code: |
I think he means without having to write out every single color... you use string parsing.. its pretty easy:
NPC Code: Make an npc and put that in it, and then run the level and say "belt red" or any other color in place of red The npc check to see if the player chats, and then it tokenizes the words the player says, it sets two temporary strings temp 1 is "belt" and temp 2 is the color Then it checks if temp 1 = belt, if it does, then set the players belt to temp 2 (color) There you go.. if you wanted to add different parts do something like this NPC Code: Place that before the last } and that will add changing the players coat color as well ;) |
Quote:
NPC Code: not sure if #s() is needed tho. |
I know, really!
|
thanx :)
|
Let's try this one, mixing together the Clothes Chest and some of WhoopA's excellent scripting techniques...
NPC Code: One of those variations should do the trick. |
Wow, old thread...
|
Quote:
|
The hell? Tokenize is basic to pretty much every string parsing language. If Scheme has it, it's gotta be pretty lame!
|
Yeah. The more common it is, the earlier it appeared, so consequently the simpler it is and the more it's been optimized over the years. I mean, take the * operator verses the for-next loop. You COULD compute x * y as
result=0; for(i=0;i<x;i++) result+=y; return result; but it'd be less efficient because for-next loops are another step removed from the core language. In fact, the computer has to translate THAT into basically a multiplication operator just to cope! |
Ummmmmm
Quote:
|
| All times are GMT +2. The time now is 03:32 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.