Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → Testing$
Testing$
2003-07-22, 9:01 AM #1
Hi!
How do I test a string?
E.G.
template item

If(item=="random")

Oh, and any way of setting it?
E.G. item=+dredkey;

/Edward


[This message has been edited by Edward (edited July 22, 2003).]
Edward's Cognative Hazards
2003-07-22, 12:16 PM #2
Yes, double quotes are valid for strings. For setting and testing.

------------------
Bassoon, n. A brazen instrument into which a fool blows out his brains.
Bassoon, n. A brazen instrument into which a fool blows out his brains.
2003-07-22, 9:29 PM #3
Edward, you're talking about templates, right? Templates are just integers holding the template's number in the level or static jkls list. You can set templates directly with item=yourTempNum or item=LoadTemplate("temp");

Quote:
<font face="Verdana, Arial" size="2">Yes, double quotes are valid for strings. For setting and testing.</font>


But that's a whole lot more interesting. You can use double quotes for setting strings. Interesting...

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2003-07-22, 9:47 PM #4
OK, how does this look?
Code:
# You kill him, he drops stuff...
#
# By Edward
symbols

message		killed

thing		guy

template	item

end
#
code
killed:
	If(GetSenderRef()!=guy) return;
	if(item==LoadTemplate("random"))
	{
		     if(rand()==0.0)                { item=LoadTemplate("+drepeatergun"); }
		Else If(rand()>=0.0 && rand()<0.1)  { item=LoadTemplate("+dhealthpack"); }
		Else if(rand()>=0.1 && rand()<0.2)  { item=LoadTemplate("+dbactatank"); }
		else if(rand()>=0.2 && rand()<0.3)  { item=LoadTemplate("+dshield"); }
		Else if(rand()>=0.3 && rand()<0.4)  { item=LoadTemplate("+dbattery"); }
		else if(rand()>=0.4 && rand()<0.45) { item=LoadTemplate("+denergycell"); }
		else if(rand()>=0.45 && rand()<0.5) { item=LoadTemplate("+drailgun"); }
		else if(rand()>=0.5 && rand()<0.55) { item=LoadTemplate("+dpowercell"); }
		else if(rand()>=0.55 && rand()<0.6) { item=LoadTemplate("+dconcrifle"); }
		else if(rand()>=0.6 && rand()<0.7)  { item=LoadTemplate("+dsmbp"); }
		else if(rand()>=0.7 && rand()<0.8)  { item=LoadTemplate("+dgreedopistol"); }
		else if(rand()>=0.8 && rand()<0.9)  { item=LoadTemplate("+ddetonator"); }
		else if(rand()>=0.9 && rand()<1.0)  { item=LoadTemplate("+dsingle"); }
		else if(rand()==1.0)                { item=LoadTemplate("+dcrossbow"); }
	}
	CreateThing(item,guy);
return;
end


/Edward
Related Topic: http://forums.massassi.net/html/Forum4/HTML/003831.html

[This message has been edited by Edward (edited July 23, 2003).]
Edward's Cognative Hazards
2003-07-23, 5:15 AM #5
As long as random is a real template, your condition will work, but the rest of the cog needs help.

------------------
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.

[This message has been edited by SaberMaster (edited July 23, 2003).]
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.

↑ Up to the top!