Stream Posted January 19, 2008 Share Posted January 19, 2008 Hey all - I'm trying to create a script that contains several parameters to save having to write numerous separate scripts, if I use this code it complies fine void main() { int nParam1 = GetScriptParameter(1); if ((nParam1 == 1)) { object oPC=GetFirstPC(); CreateItemOnObject("g_w_shortsbr01", oPC); } else { if ((nParam1 == 2)) { object oPC=GetFirstPC(); CreateItemOnObject("g_w_shortsbr02", oPC); } else { if ((nParam1 == 3)) { object oPC=GetFirstPC(); CreateItemOnObject("g_w_shortsbr03", oPC); } } } } But I want it to also contain some conditional functions as well and this is where I run into some problems - if I change the script to read this it no longer complies; void main() { int nParam1 = GetScriptParameter(1); if ((nParam1 == 1)) { int StartingConditional() return (GetJournalEntry("deadlyictra")==110); } else { if ((nParam1 == 2)) { object oPC=GetFirstPC(); CreateItemOnObject("g_w_shortsbr02", oPC); } else { if ((nParam1 == 3)) { object oPC=GetFirstPC(); CreateItemOnObject("g_w_shortsbr03", oPC); } } } } That first part complies fine in a script of it's own so I'm guessing either I need to change it a little or you can't use conditionals in a script like this - dear god I hope it's not the latter. If anyone could give me a little help I'd be very greatful. Kind Regards --Stream Link to comment Share on other sites More sharing options...
stoffe Posted January 20, 2008 Share Posted January 20, 2008 But I want it to also contain some conditional functions as well and this is where I run into some problems - if I change the script to read this it no longer complies; It looks like you are trying to make a script that's both a conditional and action script in one. These two are handled differently and as such should be in separate scripts since you can only have one starter function in a script. Conditional scripts have an StartingConditional() starter function that returns either true (>0) or false (0). Action scripts have a main() starter function that doesn't return any value. Link to comment Share on other sites More sharing options...
Stream Posted January 20, 2008 Author Share Posted January 20, 2008 Sorry I should've been more specific with the post, I don't actually intend on using both conditionals and actions in the same script, that script was just a test to see how to do it and instead of actually trying to do one that only contained conditionals I assumed that it can't be done. Anyway thanks once again stoffe, you're really helping me out a lot here - If we ever meet I owe you a lot of drinks. Take care --Stream Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.