<function name="tryme" type="boolean">
msg ("Try me?")
get input {
if (result = "no") {
msg (" Okay im sad")
return (false)
}
else if (result = "yes") {
msg ("YaY")
return (true)
}
else {
msg ("What?")
return (tryme)
}
}
</function>
myvariable= tryme
switch (LCase(result)) {
case ("dingo") {
play sound ("alarm.mp3", false, false)
msg ("CLASSIFIED...<br/><br/>CLASSIFIED...<br/><br/>ACCESS DENIED.<br/><br/>CLASSIFIED...<br/><br/>CLASSIFIED...<br/><br/>ACCESS DENIED.")
wait {
computer loop
}
}
case ("magoo") {
msg ("<b><u>Name:</b></u> Xanadu Magoo<br/><br/><b><u>General Appearance:</b></u> Serious dork. Early thirties. 5'8\". 105 pounds. Light brown hair, hazel eyes, pasty white complexion.<br/><br/><b><u>Occupation:</b></u> Science Teacher at the Holy Moly Incapables<br/><b><u>Ethnicity:</b></u> Caucasian, American<br/><br/><b><u>Specialties:</b></u> Above average knowledge in science, especially physics and chemisty<br/><br/><b><u>Notes:</b></u> Escaped several assassination attempts in the desert. In doing so, killed two desert patrol guards, one via electrocution and one died of complication with an unknown biotic factor. Infiltrated our compound for unknown reasons. Was forced into unconsciousness by Dr. Dingo himself upon arrival. Assassination was to immediately follow, but Dr. Dingo would not allow it. Instead, Xanadu Magoo is currently being help captive in prison cell one by orders of Dr. Dingo.")
wait {
computer loop
}myvariable= tryme is not the right way to save the return value for a function.if (tryme = true) {
// do this
} else {
// do that
}<function name="critical_hit" type="int">
// blah scripting:
// if (...) { return 2 }
// else { return 1 }
</function>
some scripting elsewhere, such as a custom (self-made) 'fight' Verb on an 'orc' monster Object:
player.damage = player.weapon.damage * critical_hit ()
// it'll either be conceptually:
// player.damage = player.weapon.damage * 2
// or
// player.damage = player.weapon.damage * 1<function name="tryme" type="boolean">
msg ("Try me?")
get input {
if (result = "no") {
msg (" Okay im sad")
return (false)
}
else if (result = "yes") {
msg ("YaY")
return (true)
}
else {
msg ("What?")
tryme()
}
}
</function><asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="test">
<gameid>(put in your own generated number)</gameid>
<version>1.0</version>
<attr name="count" type="int">0</attr>
<start type="script">
recursion
</start>
<game>
<object name="room">
<object name="player">
</object>
</object>
<function name="recursion">
msg ("HK")
game.count = game.count + 1
if (game.count < 5) {
recursion
}
</function>
</asl>
<start>
var = tryme()
</start>
<function name="tryme" type="boolean">
get input {
if (result = "no") {
return false
}
}
</function>
max17 wrote:Actually there's nothing in my code, a part from what i wrote here. The problem is just as I and you said, with a "getinput", i can't use a variable assignation. If i write
<start>
var = tryme()
</start>
<function name="tryme" type="boolean">
get input {
if (result = "no") {
return false
}
}
</function>
there's no way he will store that false in that var
<function name="tryme" type="boolean">
get input {
if (result = "no") {
msg("Reply given")
return false
}
}
msg("At end of function")
</function>